mirror of
https://github.com/videojs/video.js.git
synced 2025-02-12 12:16:27 +02:00
test(hooks): remove errors logged in tests (#3865)
This commit is contained in:
parent
559297a376
commit
3f724f9349
@ -118,7 +118,7 @@ function videojs(id, options, ready) {
|
|||||||
const opts = hookFunction(tag, mergeOptions(options));
|
const opts = hookFunction(tag, mergeOptions(options));
|
||||||
|
|
||||||
if (!isObject(opts) || Array.isArray(opts)) {
|
if (!isObject(opts) || Array.isArray(opts)) {
|
||||||
videojs.log.error('please return an object in beforesetup hooks');
|
log.error('please return an object in beforesetup hooks');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-env qunit */
|
/* eslint-env qunit */
|
||||||
import videojs from '../../src/js/video.js';
|
import videojs from '../../src/js/video.js';
|
||||||
import document from 'global/document';
|
import document from 'global/document';
|
||||||
|
import log from '../../src/js/utils/log.js';
|
||||||
|
|
||||||
QUnit.module('video.js:hooks ', {
|
QUnit.module('video.js:hooks ', {
|
||||||
beforeEach() {
|
beforeEach() {
|
||||||
@ -112,6 +113,8 @@ QUnit.test('should trigger beforesetup and setup during videojs setup', function
|
|||||||
assert.equal(setupCalled, false, 'setup should be called after beforesetup');
|
assert.equal(setupCalled, false, 'setup should be called after beforesetup');
|
||||||
assert.deepEqual(options, vjsOptions, 'options should be the same');
|
assert.deepEqual(options, vjsOptions, 'options should be the same');
|
||||||
assert.equal(video.id, 'test_vid_id', 'video id should be correct');
|
assert.equal(video.id, 'test_vid_id', 'video id should be correct');
|
||||||
|
|
||||||
|
return options;
|
||||||
};
|
};
|
||||||
const setup = function(player) {
|
const setup = function(player) {
|
||||||
setupCalled = true;
|
setupCalled = true;
|
||||||
@ -140,9 +143,14 @@ QUnit.test('should trigger beforesetup and setup during videojs setup', function
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('beforesetup returns dont break videojs options', function(assert) {
|
QUnit.test('beforesetup returns dont break videojs options', function(assert) {
|
||||||
|
const oldLogError = log.error;
|
||||||
const vjsOptions = {techOrder: ['techFaker']};
|
const vjsOptions = {techOrder: ['techFaker']};
|
||||||
const fixture = document.getElementById('qunit-fixture');
|
const fixture = document.getElementById('qunit-fixture');
|
||||||
|
|
||||||
|
log.error = function(err) {
|
||||||
|
assert.equal(err, 'please return an object in beforesetup hooks', 'we have the correct error');
|
||||||
|
};
|
||||||
|
|
||||||
fixture.innerHTML += '<video id="test_vid_id"><source type="video/mp4"></video>';
|
fixture.innerHTML += '<video id="test_vid_id"><source type="video/mp4"></video>';
|
||||||
|
|
||||||
const vid = document.getElementById('test_vid_id');
|
const vid = document.getElementById('test_vid_id');
|
||||||
@ -161,6 +169,8 @@ QUnit.test('beforesetup returns dont break videojs options', function(assert) {
|
|||||||
|
|
||||||
assert.ok(player.options_, 'beforesetup should not destory options');
|
assert.ok(player.options_, 'beforesetup should not destory options');
|
||||||
assert.equal(player.options_.techOrder, vjsOptions.techOrder, 'options set by user should exist');
|
assert.equal(player.options_.techOrder, vjsOptions.techOrder, 'options set by user should exist');
|
||||||
|
|
||||||
|
log.error = oldLogError;
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('beforesetup options override videojs options', function(assert) {
|
QUnit.test('beforesetup options override videojs options', function(assert) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user