2015-04-14 22:08:32 +02:00
|
|
|
import MenuButton from '../../src/js/menu/menu-button.js';
|
2015-03-26 06:43:41 +02:00
|
|
|
import TestHelpers from './test-helpers.js';
|
2016-03-29 22:09:10 +02:00
|
|
|
import * as Events from '../../src/js/utils/events.js';
|
2015-03-26 06:43:41 +02:00
|
|
|
|
|
|
|
q.module('MenuButton');
|
2014-03-26 10:40:14 +03:00
|
|
|
|
2016-03-29 22:09:10 +02:00
|
|
|
q.test('should not throw an error when there is no children', function() {
|
|
|
|
expect(0);
|
|
|
|
let player = TestHelpers.makePlayer();
|
|
|
|
|
|
|
|
let menuButton = new MenuButton(player);
|
|
|
|
let el = menuButton.el();
|
|
|
|
|
|
|
|
try {
|
|
|
|
Events.trigger(el, 'click');
|
|
|
|
} catch (error) {
|
|
|
|
ok(!error, 'click should not throw anything');
|
|
|
|
}
|
2014-03-26 10:40:14 +03:00
|
|
|
|
2016-03-29 22:09:10 +02:00
|
|
|
player.dispose();
|
|
|
|
});
|
|
|
|
|
|
|
|
q.test('should place title list item into ul', function() {
|
|
|
|
var player, menuButton;
|
2015-03-26 06:43:41 +02:00
|
|
|
player = TestHelpers.makePlayer();
|
2014-03-26 10:40:14 +03:00
|
|
|
|
2015-03-26 06:43:41 +02:00
|
|
|
menuButton = new MenuButton(player, {
|
2014-04-04 09:35:15 +03:00
|
|
|
'title': 'testTitle'
|
2014-03-26 10:40:14 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
var menuContentElement = menuButton.el().getElementsByTagName('UL')[0];
|
|
|
|
var titleElement = menuContentElement.children[0];
|
|
|
|
|
|
|
|
ok(titleElement.innerHTML === 'TestTitle', 'title element placed in ul');
|
|
|
|
|
|
|
|
player.dispose();
|
2016-03-29 22:09:10 +02:00
|
|
|
});
|