UNPKG

1.14 kBJavaScriptView Raw
1import document from 'global/document';
2
3import QUnit from 'qunit';
4import sinon from 'sinon';
5import videojs from 'video.js';
6
7import handler from '../src/index';
8
9QUnit.test('the environment is sane', function(assert) {
10 assert.strictEqual(typeof Array.isArray, 'function', 'es5 exists');
11 assert.strictEqual(typeof sinon, 'object', 'sinon exists');
12 assert.strictEqual(typeof videojs, 'function', 'videojs exists');
13 assert.strictEqual(typeof handler, 'object', 'handler is a function');
14});
15
16QUnit.module('videojs-flashls-source-handler', {
17
18 beforeEach() {
19
20 // Mock the environment's timers because certain things - particularly
21 // player readiness - are asynchronous in video.js 5. This MUST come
22 // before any player is created; otherwise, timers could get created
23 // with the actual timer methods!
24 this.clock = sinon.useFakeTimers();
25
26 this.fixture = document.getElementById('qunit-fixture');
27 this.video = document.createElement('video');
28 this.fixture.appendChild(this.video);
29 this.player = videojs(this.video);
30 },
31
32 afterEach() {
33 this.player.dispose();
34 this.clock.restore();
35 }
36});
37