mirror of
https://github.com/videojs/video.js.git
synced 2024-12-27 02:43:45 +02:00
Merge branch 'stable'
This commit is contained in:
commit
b91018952e
@ -10,6 +10,7 @@ CHANGELOG
|
||||
* @gkatsev added an option to keep the tooltips inside the player bounds ([view](https://github.com/videojs/video.js/pull/3149))
|
||||
* @defli added currentWidth and currentHeight methods to the player ([view](https://github.com/videojs/video.js/pull/3144))
|
||||
* fix IE8 tests for VIDEOJS_NO_DYNAMIC_STYLE ([view](https://github.com/videojs/video.js/pull/3215))
|
||||
* @llun fixed menus from throwing when focused when empty ([view](https://github.com/videojs/video.js/pull/3218))
|
||||
|
||||
--------------------
|
||||
|
||||
|
@ -118,14 +118,13 @@ class Menu extends Component {
|
||||
*/
|
||||
focus (item = 0) {
|
||||
let children = this.children().slice();
|
||||
let haveTitle = children[0].className &&
|
||||
let haveTitle = children.length && children[0].className &&
|
||||
/vjs-menu-title/.test(children[0].className);
|
||||
|
||||
if (haveTitle) {
|
||||
children.shift();
|
||||
}
|
||||
|
||||
|
||||
if (children.length > 0) {
|
||||
if (item < 0) {
|
||||
item = 0;
|
||||
|
@ -4,10 +4,27 @@ import * as Events from '../../src/js/utils/events.js';
|
||||
|
||||
q.module('MenuButton');
|
||||
|
||||
q.test('should place title list item into ul', function() {
|
||||
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 menuButton = new MenuButton(player);
|
||||
let el = menuButton.el();
|
||||
|
||||
try {
|
||||
Events.trigger(el, 'click');
|
||||
} catch (error) {
|
||||
ok(!error, 'click should not throw anything');
|
||||
}
|
||||
|
||||
player.dispose();
|
||||
});
|
||||
|
||||
q.test('should place title list item into ul', function() {
|
||||
var player, menuButton;
|
||||
player = TestHelpers.makePlayer();
|
||||
|
||||
menuButton = new MenuButton(player, {
|
||||
'title': 'testTitle'
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user