mirror of
https://github.com/videojs/video.js.git
synced 2025-07-15 01:34:23 +02:00
@misteroneill updated tests to qunit 2.0. closes #3509
This commit is contained in:
committed by
Gary Katsevman
parent
b3e4e95f9c
commit
72c44daaf3
@ -8,8 +8,8 @@ import document from 'global/document';
|
||||
|
||||
QUnit.module('Controls');
|
||||
|
||||
QUnit.test('should hide volume control if it\'s not supported', function() {
|
||||
QUnit.expect(2);
|
||||
QUnit.test('should hide volume control if it\'s not supported', function(assert) {
|
||||
assert.expect(2);
|
||||
const noop = function() {};
|
||||
const player = {
|
||||
id: noop,
|
||||
@ -26,11 +26,11 @@ QUnit.test('should hide volume control if it\'s not supported', function() {
|
||||
const volumeControl = new VolumeControl(player);
|
||||
const muteToggle = new MuteToggle(player);
|
||||
|
||||
QUnit.ok(volumeControl.el().className.indexOf('vjs-hidden') >= 0, 'volumeControl is not hidden');
|
||||
QUnit.ok(muteToggle.el().className.indexOf('vjs-hidden') >= 0, 'muteToggle is not hidden');
|
||||
assert.ok(volumeControl.el().className.indexOf('vjs-hidden') >= 0, 'volumeControl is not hidden');
|
||||
assert.ok(muteToggle.el().className.indexOf('vjs-hidden') >= 0, 'muteToggle is not hidden');
|
||||
});
|
||||
|
||||
QUnit.test('should test and toggle volume control on `loadstart`', function() {
|
||||
QUnit.test('should test and toggle volume control on `loadstart`', function(assert) {
|
||||
const noop = function() {};
|
||||
const listeners = [];
|
||||
const player = {
|
||||
@ -57,27 +57,27 @@ QUnit.test('should test and toggle volume control on `loadstart`', function() {
|
||||
const volumeControl = new VolumeControl(player);
|
||||
const muteToggle = new MuteToggle(player);
|
||||
|
||||
QUnit.equal(volumeControl.hasClass('vjs-hidden'), false, 'volumeControl is hidden initially');
|
||||
QUnit.equal(muteToggle.hasClass('vjs-hidden'), false, 'muteToggle is hidden initially');
|
||||
assert.equal(volumeControl.hasClass('vjs-hidden'), false, 'volumeControl is hidden initially');
|
||||
assert.equal(muteToggle.hasClass('vjs-hidden'), false, 'muteToggle is hidden initially');
|
||||
|
||||
player.tech_.featuresVolumeControl = false;
|
||||
for (let i = 0; i < listeners.length; i++) {
|
||||
listeners[i]();
|
||||
}
|
||||
|
||||
QUnit.equal(volumeControl.hasClass('vjs-hidden'), true, 'volumeControl does not hide itself');
|
||||
QUnit.equal(muteToggle.hasClass('vjs-hidden'), true, 'muteToggle does not hide itself');
|
||||
assert.equal(volumeControl.hasClass('vjs-hidden'), true, 'volumeControl does not hide itself');
|
||||
assert.equal(muteToggle.hasClass('vjs-hidden'), true, 'muteToggle does not hide itself');
|
||||
|
||||
player.tech_.featuresVolumeControl = true;
|
||||
for (let i = 0; i < listeners.length; i++) {
|
||||
listeners[i]();
|
||||
}
|
||||
|
||||
QUnit.equal(volumeControl.hasClass('vjs-hidden'), false, 'volumeControl does not show itself');
|
||||
QUnit.equal(muteToggle.hasClass('vjs-hidden'), false, 'muteToggle does not show itself');
|
||||
assert.equal(volumeControl.hasClass('vjs-hidden'), false, 'volumeControl does not show itself');
|
||||
assert.equal(muteToggle.hasClass('vjs-hidden'), false, 'muteToggle does not show itself');
|
||||
});
|
||||
|
||||
QUnit.test('calculateDistance should use changedTouches, if available', function() {
|
||||
QUnit.test('calculateDistance should use changedTouches, if available', function(assert) {
|
||||
const noop = function() {};
|
||||
const player = {
|
||||
id: noop,
|
||||
@ -99,14 +99,14 @@ QUnit.test('calculateDistance should use changedTouches, if available', function
|
||||
}]
|
||||
};
|
||||
|
||||
QUnit.equal(slider.calculateDistance(event), 0.5, 'we should have touched exactly in the center, so, the ratio should be half');
|
||||
assert.equal(slider.calculateDistance(event), 0.5, 'we should have touched exactly in the center, so, the ratio should be half');
|
||||
});
|
||||
|
||||
QUnit.test('should hide playback rate control if it\'s not supported', function() {
|
||||
QUnit.expect(1);
|
||||
QUnit.test('should hide playback rate control if it\'s not supported', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
const player = TestHelpers.makePlayer();
|
||||
const playbackRate = new PlaybackRateMenuButton(player);
|
||||
|
||||
QUnit.ok(playbackRate.el().className.indexOf('vjs-hidden') >= 0, 'playbackRate is not hidden');
|
||||
assert.ok(playbackRate.el().className.indexOf('vjs-hidden') >= 0, 'playbackRate is not hidden');
|
||||
});
|
||||
|
Reference in New Issue
Block a user