1
0
mirror of https://github.com/videojs/video.js.git synced 2025-07-17 01:42:41 +02:00

@misteroneill updated tests to qunit 2.0. closes #3509

This commit is contained in:
Pat O'Neill
2016-08-12 13:51:31 -04:00
committed by Gary Katsevman
parent b3e4e95f9c
commit 72c44daaf3
45 changed files with 1701 additions and 1700 deletions

View File

@ -5,8 +5,8 @@ import * as Events from '../../src/js/utils/events.js';
QUnit.module('MenuButton');
QUnit.test('should not throw an error when there is no children', function() {
QUnit.expect(0);
QUnit.test('should not throw an error when there is no children', function(assert) {
assert.expect(0);
const player = TestHelpers.makePlayer();
const menuButton = new MenuButton(player);
@ -15,13 +15,13 @@ QUnit.test('should not throw an error when there is no children', function() {
try {
Events.trigger(el, 'click');
} catch (error) {
QUnit.ok(!error, 'click should not throw anything');
assert.ok(!error, 'click should not throw anything');
}
player.dispose();
});
QUnit.test('should place title list item into ul', function() {
QUnit.test('should place title list item into ul', function(assert) {
const player = TestHelpers.makePlayer();
const menuButton = new MenuButton(player, {
@ -31,13 +31,13 @@ QUnit.test('should place title list item into ul', function() {
const menuContentElement = menuButton.el().getElementsByTagName('UL')[0];
const titleElement = menuContentElement.children[0];
QUnit.ok(titleElement.innerHTML === 'TestTitle', 'title element placed in ul');
assert.ok(titleElement.innerHTML === 'TestTitle', 'title element placed in ul');
player.dispose();
});
QUnit.test('clicking should display the menu', function() {
QUnit.expect(6);
QUnit.test('clicking should display the menu', function(assert) {
assert.expect(6);
const player = TestHelpers.makePlayer();
@ -47,29 +47,29 @@ QUnit.test('clicking should display the menu', function() {
});
const el = menuButton.el();
QUnit.ok(menuButton.menu !== undefined, 'menu is created');
assert.ok(menuButton.menu !== undefined, 'menu is created');
QUnit.equal(menuButton.menu.hasClass('vjs-lock-showing'), false, 'menu defaults to hidden');
assert.equal(menuButton.menu.hasClass('vjs-lock-showing'), false, 'menu defaults to hidden');
Events.trigger(el, 'click');
QUnit.equal(menuButton.menu.hasClass('vjs-lock-showing'), true, 'clicking on the menu button shows the menu');
assert.equal(menuButton.menu.hasClass('vjs-lock-showing'), true, 'clicking on the menu button shows the menu');
Events.trigger(el, 'click');
QUnit.equal(menuButton.menu.hasClass('vjs-lock-showing'), false, 'clicking again on the menu button hides the menu');
assert.equal(menuButton.menu.hasClass('vjs-lock-showing'), false, 'clicking again on the menu button hides the menu');
menuButton.disable();
Events.trigger(el, 'click');
QUnit.equal(menuButton.menu.hasClass('vjs-lock-showing'), false, 'disable() prevents clicking from showing the menu');
assert.equal(menuButton.menu.hasClass('vjs-lock-showing'), false, 'disable() prevents clicking from showing the menu');
menuButton.enable();
Events.trigger(el, 'click');
QUnit.equal(menuButton.menu.hasClass('vjs-lock-showing'), true, 'enable() allows clicking to show the menu');
assert.equal(menuButton.menu.hasClass('vjs-lock-showing'), true, 'enable() allows clicking to show the menu');
player.dispose();
});