Permalink
Browse files

test: warning, if the element is not in the DOM (#4723)

Add test to #4698
  • Loading branch information...
odisei369 authored and gkatsev committed Nov 7, 2017
1 parent acc641a commit c213737f7a432215446a24af24552f0657a7eccb
Showing with 32 additions and 0 deletions.
  1. +32 −0 test/unit/video.test.js
View
@@ -53,6 +53,38 @@ QUnit.test('should return a video player instance', function(assert) {
player2.dispose();
});
QUnit.test('should log if the supplied element is not included in the DOM',
function(assert) {
const origWarnLog = log.warn;
const fixture = document.getElementById('qunit-fixture');
const warnLogs = [];
log.warn = (args) => {
warnLogs.push(args);
};
const vid = document.createElement('video');
fixture.appendChild(vid);
const player = videojs(vid);
assert.ok(player, 'created player from tag');
assert.equal(warnLogs.length, 0, 'no warn logs');
const vid2 = document.createElement('video');
const player2 = videojs(vid2);
assert.ok(player2, 'created player from tag');
assert.equal(warnLogs.length, 1, 'logged a warning');
assert.equal(warnLogs[0],
'The element supplied is not included in the DOM',
'logged the right message');
log.warn = origWarnLog;
player.dispose();
player2.dispose();
});
QUnit.test('should log about already initalized players if options already passed',
function(assert) {
const origWarnLog = log.warn;

0 comments on commit c213737

Please sign in to comment.