Tracking de l'application VApp (IHM du jeu)
This commit is contained in:
59
VApp/node_modules/videojs-contrib-quality-levels/test/plugin.test.js
generated
vendored
Normal file
59
VApp/node_modules/videojs-contrib-quality-levels/test/plugin.test.js
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import document from 'global/document';
|
||||
import QUnit from 'qunit';
|
||||
import sinon from 'sinon';
|
||||
import videojs from 'video.js';
|
||||
import plugin from '../src/plugin';
|
||||
|
||||
const Player = videojs.getComponent('Player');
|
||||
|
||||
QUnit.test('the environment is sane', function(assert) {
|
||||
assert.strictEqual(typeof Array.isArray, 'function', 'es5 exists');
|
||||
assert.strictEqual(typeof sinon, 'object', 'sinon exists');
|
||||
assert.strictEqual(typeof videojs, 'function', 'videojs exists');
|
||||
assert.strictEqual(typeof plugin, 'function', 'plugin is a function');
|
||||
});
|
||||
|
||||
QUnit.module('videojs-contrib-quality-levels', {
|
||||
|
||||
beforeEach() {
|
||||
|
||||
// Mock the environment's timers because certain things - particularly
|
||||
// player readiness - are asynchronous in video.js 5. This MUST come
|
||||
// before any player is created; otherwise, timers could get created
|
||||
// with the actual timer methods!
|
||||
this.clock = sinon.useFakeTimers();
|
||||
|
||||
this.fixture = document.getElementById('qunit-fixture');
|
||||
this.video = document.createElement('video');
|
||||
this.fixture.appendChild(this.video);
|
||||
this.player = videojs(this.video);
|
||||
},
|
||||
|
||||
afterEach() {
|
||||
this.player.dispose();
|
||||
this.clock.restore();
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test('registers itself with video.js', function(assert) {
|
||||
assert.strictEqual(
|
||||
typeof Player.prototype.qualityLevels,
|
||||
'function',
|
||||
'videojs-contrib-quality-levels plugin was registered'
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test('player qualityLevels method returns the proper object', function(assert) {
|
||||
const qualityLevels = this.player.qualityLevels();
|
||||
|
||||
assert.equal(
|
||||
qualityLevels.length,
|
||||
0,
|
||||
'the returned object contained the length property with the proper value'
|
||||
);
|
||||
assert.equal(
|
||||
qualityLevels.selectedIndex,
|
||||
-1,
|
||||
'the returned object contained the selectedIndex property with the proper value'
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user