blob: 030235e793316788d0591a0fcbede9d0b72a4796 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
/* eslint-env qunit */
import TestHelpers from './test-helpers.js';
import sinon from 'sinon';
import window from 'global/window';
QUnit.module('Setup');
QUnit.test('should set options from data-setup even if autoSetup is not called before initialisation', function(assert) {
const el = TestHelpers.makeTag();
el.setAttribute(
'data-setup',
'{"controls": true, "autoplay": false, "preload": "auto", "playsinline": true}'
);
const player = TestHelpers.makePlayer({}, el);
assert.ok(player.options_.controls === true);
assert.ok(player.options_.autoplay === false);
assert.ok(player.options_.preload === 'auto');
assert.ok(player.options_.playsinline === true);
player.dispose();
});
QUnit.test('should log an error if data-setup has invalid JSON', function(assert) {
const logError = sinon.spy(window.console, 'error');
const el = TestHelpers.makeTag();
el.setAttribute(
'data-setup',
"{'controls': true}"
);
const player = TestHelpers.makePlayer({}, el);
assert.ok(logError.calledWith('VIDEOJS:', 'ERROR:', 'data-setup'));
player.dispose();
window.console.error.restore();
});
|