1
0
mirror of https://github.com/videojs/video.js.git synced 2025-05-23 22:50:21 +02:00

Making sure that the title element gets placed into the UL element

Included are two sanity check tests for the two areas being checked
to make sure that the menu title items are being correctly placed
in the actual UL element of the menu.

Fixes 
This commit is contained in:
Jon Wong 2014-03-26 00:40:14 -07:00
parent 0f2aadcfcd
commit c7e35e51de
5 changed files with 41 additions and 3 deletions

@ -129,7 +129,7 @@ vjs.MenuButton.prototype.createMenu = function(){
// Add a title list item to the top // Add a title list item to the top
if (this.options().title) { if (this.options().title) {
menu.el().appendChild(vjs.createEl('li', { menu.contentEl().appendChild(vjs.createEl('li', {
className: 'vjs-menu-title', className: 'vjs-menu-title',
innerHTML: vjs.capitalize(this.kind_), innerHTML: vjs.capitalize(this.kind_),
tabindex: -1 tabindex: -1

@ -948,7 +948,7 @@ vjs.ChaptersButton.prototype.createMenu = function(){
var menu = this.menu = new vjs.Menu(this.player_); var menu = this.menu = new vjs.Menu(this.player_);
menu.el_.appendChild(vjs.createEl('li', { menu.contentEl().appendChild(vjs.createEl('li', {
className: 'vjs-menu-title', className: 'vjs-menu-title',
innerHTML: vjs.capitalize(this.kind_), innerHTML: vjs.capitalize(this.kind_),
tabindex: -1 tabindex: -1

@ -33,7 +33,9 @@
'test/unit/poster.js', 'test/unit/poster.js',
'test/unit/plugins.js', 'test/unit/plugins.js',
'test/unit/flash.js', 'test/unit/flash.js',
'test/unit/api.js' 'test/unit/api.js',
'test/unit/menu.js',
'test/unit/tracks.js'
]; ];
var projectRoot = '../'; var projectRoot = '../';

20
test/unit/menu.js Normal file

@ -0,0 +1,20 @@
module('MenuButton');
test('should place title list item into ul', function() {
var player, menuButton;
player = PlayerTest.makePlayer();
vjs.MenuButton.prototype.kind_ = 'testTitle';
menuButton = new vjs.MenuButton(player, {
'title': true
});
var menuContentElement = menuButton.el().getElementsByTagName('UL')[0];
var titleElement = menuContentElement.children[0];
ok(titleElement.innerHTML === 'TestTitle', 'title element placed in ul');
player.dispose();
});

16
test/unit/tracks.js Normal file

@ -0,0 +1,16 @@
module('Tracks');
test('should place title list item into ul', function() {
var player, chaptersButton;
player = PlayerTest.makePlayer();
chaptersButton = new vjs.ChaptersButton(player);
var menuContentElement = chaptersButton.el().getElementsByTagName('UL')[0];
var titleElement = menuContentElement.children[0];
ok(titleElement.innerHTML === 'Chapters', 'title element placed in ul');
player.dispose();
});