1 | import document from 'global/document';
|
2 |
|
3 | import QUnit from 'qunit';
|
4 | import sinon from 'sinon';
|
5 | import videojs from 'video.js';
|
6 |
|
7 | import plugin from '../src/plugin';
|
8 |
|
9 | const Player = videojs.getComponent('Player');
|
10 |
|
11 | QUnit.test('the environment is sane', function(assert) {
|
12 | assert.strictEqual(typeof Array.isArray, 'function', 'es5 exists');
|
13 | assert.strictEqual(typeof sinon, 'object', 'sinon exists');
|
14 | assert.strictEqual(typeof videojs, 'function', 'videojs exists');
|
15 | assert.strictEqual(typeof plugin, 'function', 'plugin is a function');
|
16 | });
|
17 |
|
18 | QUnit.module('videojs-dock', {
|
19 |
|
20 | beforeEach() {
|
21 | this.fixture = document.getElementById('qunit-fixture');
|
22 | this.video = document.createElement('video');
|
23 | this.fixture.appendChild(this.video);
|
24 | this.player = videojs(this.video);
|
25 |
|
26 |
|
27 |
|
28 | this.clock = sinon.useFakeTimers();
|
29 | },
|
30 |
|
31 | afterEach() {
|
32 |
|
33 |
|
34 |
|
35 | this.clock.restore();
|
36 | this.player.dispose();
|
37 | }
|
38 | });
|
39 |
|
40 | QUnit.test('registers itself with video.js', function(assert) {
|
41 | assert.expect(2);
|
42 |
|
43 | assert.strictEqual(
|
44 | Player.prototype.dock,
|
45 | plugin,
|
46 | 'videojs-dock plugin was registered'
|
47 | );
|
48 |
|
49 | this.player.dock();
|
50 |
|
51 |
|
52 | this.clock.tick(1);
|
53 |
|
54 | assert.ok(
|
55 | this.player.hasClass('vjs-dock'),
|
56 | 'the plugin adds a class to the player'
|
57 | );
|
58 | });
|