summaryrefslogtreecommitdiff
path: root/javascript/videojs/test/unit/video.test.js
blob: f110f759490ce32ec5d57961bf6677950d4d09e5 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
/* eslint-env qunit */
import videojs from '../../src/js/video.js';
import * as Dom from '../../src/js/utils/dom.js';
import log from '../../src/js/utils/log.js';
import document from 'global/document';
import window from 'global/window';
import sinon from 'sinon';
// import custom element for Shadow DOM test
import './utils/custom-element.test';

QUnit.module('video.js', {
  beforeEach() {
    this.clock = sinon.useFakeTimers();
  },
  afterEach() {
    this.clock.restore();
    videojs.getAllPlayers().forEach(p => p.dispose());
  }
});

QUnit.test('should return a video player instance', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video id="test_vid_id"></video>' +
                       '<video id="test_vid_id2"></video>';

  const player = videojs('test_vid_id', { techOrder: ['techFaker'] });

  assert.ok(player, 'created player from tag');
  assert.ok(player.id() === 'test_vid_id');
  assert.ok(
    videojs.getPlayers().test_vid_id === player,
    'added player to global reference'
  );

  const playerAgain = videojs('test_vid_id');

  assert.ok(player === playerAgain, 'did not create a second player from same tag');

  assert.equal(player, playerAgain, 'we did not make a new player');

  const tag2 = document.getElementById('test_vid_id2');
  const player2 = videojs(tag2, { techOrder: ['techFaker'] });

  assert.ok(player2.id() === 'test_vid_id2', 'created player from element');
});

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');

    vid.id = 'test_vid_id';
    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');

    vid2.id = 'test_vid_id2';
    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'
    );

    // should only log warnings on the first creation
    videojs(vid2);
    videojs('test_vid_id2');
    assert.equal(warnLogs.length, 1, 'did not log another warning');

    log.warn = origWarnLog;
  }
);

const skipWithoutCustomElements = 'customElements' in window ? 'test' : 'skip';

QUnit[skipWithoutCustomElements](
  'should not log if the supplied element is included in the Shadow DOM',
  function(assert) {
    const origWarnLog = log.warn;
    const fixture = document.getElementById('qunit-fixture');
    const warnLogs = [];

    log.warn = (args) => {
      warnLogs.push(args);
    };

    const customElem = document.createElement('test-custom-element');

    fixture.appendChild(customElem);
    const innerPlayer = customElem.innerPlayer;

    assert.ok(innerPlayer, 'created player within Shadow DOM');
    assert.equal(warnLogs.length, 0, 'no warn logs');

    log.warn = origWarnLog;
  }
);

QUnit.test(
  'should log about already initialized players if options already passed',
  function(assert) {
    const origWarnLog = log.warn;
    const fixture = document.getElementById('qunit-fixture');
    const warnLogs = [];

    log.warn = (args) => {
      warnLogs.push(args);
    };

    fixture.innerHTML += '<video id="test_vid_id"></video>';

    const player = videojs('test_vid_id', { techOrder: ['techFaker'] });

    assert.ok(player, 'created player from tag');
    assert.equal(player.id(), 'test_vid_id', 'player has the right ID');
    assert.equal(warnLogs.length, 0, 'no warn logs');

    const playerAgain = videojs('test_vid_id');

    assert.equal(player, playerAgain, 'did not create a second player from same tag');
    assert.equal(warnLogs.length, 0, 'no warn logs');

    const playerAgainWithOptions = videojs('test_vid_id', { techOrder: ['techFaker'] });

    assert.equal(
      player,
      playerAgainWithOptions,
      'did not create a second player from same tag'
    );
    assert.equal(warnLogs.length, 1, 'logged a warning');
    assert.equal(
      warnLogs[0],
      'Player "test_vid_id" is already initialised. Options will not be applied.',
      'logged the right message'
    );

    log.warn = origWarnLog;
  }
);

QUnit.test('should return a video player instance from el html5 tech', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video id="test_vid_id"></video>' +
                       '<video id="test_vid_id2"></video>';

  const vid = document.querySelector('#test_vid_id');

  const player = videojs(vid);

  assert.ok(player, 'created player from tag');
  assert.ok(player.id() === 'test_vid_id');
  assert.ok(
    videojs.getPlayers().test_vid_id === player,
    'added player to global reference'
  );

  const playerAgain = videojs(vid);

  assert.ok(player === playerAgain, 'did not create a second player from same tag');
  assert.equal(player, playerAgain, 'we did not make a new player');

  const tag2 = document.getElementById('test_vid_id2');
  const player2 = videojs(tag2, { techOrder: ['techFaker'] });

  assert.ok(player2.id() === 'test_vid_id2', 'created player from element');
});

QUnit.test('should return a video player instance from el techfaker', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video id="test_vid_id"></video>' +
                       '<video id="test_vid_id2"></video>';

  const vid = document.querySelector('#test_vid_id');
  const player = videojs(vid, {techOrder: ['techFaker']});

  assert.ok(player, 'created player from tag');
  assert.ok(player.id() === 'test_vid_id');
  assert.ok(
    videojs.getPlayers().test_vid_id === player,
    'added player to global reference'
  );

  const playerAgain = videojs(vid);

  assert.ok(player === playerAgain, 'did not create a second player from same tag');
  assert.equal(player, playerAgain, 'we did not make a new player');

  const tag2 = document.getElementById('test_vid_id2');
  const player2 = videojs(tag2, { techOrder: ['techFaker'] });

  assert.ok(player2.id() === 'test_vid_id2', 'created player from element');
});

QUnit.test('should add the value to the languages object', function(assert) {
  const code = 'es';
  const data = {Hello: 'Hola'};
  const result = videojs.addLanguage(code, data);

  assert.ok(videojs.options.languages[code], 'should exist');
  assert.equal(videojs.options.languages.es.Hello, 'Hola', 'should match');
  assert.deepEqual(result.Hello, videojs.options.languages.es.Hello, 'should also match');
});

QUnit.test('should add the value to the languages object with lower case lang code', function(assert) {
  const code = 'DE';
  const data = {Hello: 'Guten Tag'};
  const result = videojs.addLanguage(code, data);

  assert.ok(videojs.options.languages[code.toLowerCase()], 'should exist');
  assert.equal(
    videojs.options.languages[code.toLowerCase()].Hello,
    'Guten Tag',
    'should match'
  );
  assert.deepEqual(
    result,
    videojs.options.languages[code.toLowerCase()],
    'should also match'
  );
});

QUnit.test('should expose plugin functions', function(assert) {
  [
    'registerPlugin',
    'plugin',
    'getPlugins',
    'getPlugin',
    'getPluginVersion'
  ].forEach(name => {
    assert.strictEqual(typeof videojs[name], 'function', `videojs.${name} is a function`);
  });
});

QUnit.test('should expose options and players properties for backward-compatibility', function(assert) {
  assert.ok(typeof videojs.options, 'object', 'options should be an object');
  assert.ok(typeof videojs.players, 'object', 'players should be an object');
});

QUnit.test('should expose DOM functions', function(assert) {
  const methods = [
    'isEl',
    'isTextNode',
    'createEl',
    'hasClass',
    'addClass',
    'removeClass',
    'toggleClass',
    'setAttributes',
    'getAttributes',
    'emptyEl',
    'insertContent',
    'appendContent'
  ];

  methods.forEach(name => {
    assert.strictEqual(typeof videojs[name], 'function', `function videojs.${name}`);
    assert.strictEqual(typeof Dom[name], 'function', `Dom.${name} function exists`);
  });
});

QUnit.test('ingest player div if data-vjs-player attribute is present on video parentNode', function(assert) {
  const fixture = document.querySelector('#qunit-fixture');

  fixture.innerHTML = `
    <div data-vjs-player class="foo">
      <video id="test_vid_id">
        <source src="http://example.com/video.mp4" type="video/mp4"></source>
      </video>
    </div>
  `;

  const playerDiv = document.querySelector('.foo');
  const vid = document.querySelector('#test_vid_id');

  const player = videojs(vid, {
    techOrder: ['html5']
  });

  assert.equal(player.el(), playerDiv, 'we re-used the given div');
  assert.ok(player.hasClass('foo'), 'keeps any classes that were around previously');
});

QUnit.test('ingested player div should not create a new tag for movingMediaElementInDOM', function(assert) {
  const Html5 = videojs.getTech('Html5');
  const oldIS = Html5.isSupported;
  const oldMoving = Html5.prototype.movingMediaElementInDOM;
  const oldCPT = Html5.nativeSourceHandler.canPlayType;
  const fixture = document.querySelector('#qunit-fixture');

  fixture.innerHTML = `
    <div data-vjs-player class="foo">
      <video id="test_vid_id">
        <source src="http://example.com/video.mp4" type="video/mp4"></source>
      </video>
    </div>
  `;
  Html5.prototype.movingMediaElementInDOM = false;
  Html5.isSupported = () => true;
  Html5.nativeSourceHandler.canPlayType = () => true;

  const playerDiv = document.querySelector('.foo');
  const vid = document.querySelector('#test_vid_id');

  const player = videojs(vid, {
    techOrder: ['html5']
  });

  this.clock.tick(1);

  assert.equal(player.el(), playerDiv, 'we re-used the given div');
  assert.equal(player.tech_.el(), vid, 'we re-used the video element');
  assert.ok(player.hasClass('foo'), 'keeps any classes that were around previously');

  Html5.prototype.movingMediaElementInDOM = oldMoving;
  Html5.isSupported = oldIS;
  Html5.nativeSourceHandler.canPlayType = oldCPT;
});

QUnit.test('should create a new tag for movingMediaElementInDOM', function(assert) {
  const Html5 = videojs.getTech('Html5');
  const oldMoving = Html5.prototype.movingMediaElementInDOM;
  const oldCPT = Html5.nativeSourceHandler.canPlayType;
  const fixture = document.querySelector('#qunit-fixture');
  const oldIS = Html5.isSupported;

  fixture.innerHTML = `
    <div class="foo">
      <video id="test_vid_id">
        <source src="http://example.com/video.mp4" type="video/mp4"></source>
      </video>
    </div>
  `;
  Html5.prototype.movingMediaElementInDOM = false;
  Html5.isSupported = () => true;
  Html5.nativeSourceHandler.canPlayType = () => true;

  const playerDiv = document.querySelector('.foo');
  const vid = document.querySelector('#test_vid_id');

  const player = videojs(vid, {
    techOrder: ['html5']
  });

  this.clock.tick(1);

  assert.notEqual(player.el(), playerDiv, 'we used a new div');
  assert.notEqual(player.tech_.el(), vid, 'we a new video element');

  Html5.prototype.movingMediaElementInDOM = oldMoving;
  Html5.isSupported = oldIS;
  Html5.nativeSourceHandler.canPlayType = oldCPT;
});

QUnit.test('getPlayer', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video-js id="test_vid_id"></video-js>';

  assert.notOk(videojs.getPlayer('test_vid_id'), 'no player was created yet');

  const tag = document.querySelector('#test_vid_id');
  const player = videojs(tag);

  assert.strictEqual(videojs.getPlayer('#test_vid_id'), player, 'the player was returned when using a jQuery-style ID selector');
  assert.strictEqual(videojs.getPlayer('test_vid_id'), player, 'the player was returned when using a raw ID value');
  assert.strictEqual(videojs.getPlayer(tag), player, 'the player was returned when using the original tag/element');

  player.dispose();
});

QUnit.test('videojs() works with the tech id', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video-js id="player"></video-js>';

  const tag = document.querySelector('#player');
  const player = videojs('#player', {techOrder: ['html5']});

  assert.strictEqual(videojs('player_html5_api'), player, 'the player was returned for the tech id');
  assert.strictEqual(videojs(tag), player, 'the player was returned when using the original tag/element');

  player.dispose();
});

QUnit.test('getPlayer works with the tech id', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video-js id="player"></video-js>';

  const tag = document.querySelector('#player');
  const player = videojs('#player', {techOrder: ['html5']});

  assert.strictEqual(videojs.getPlayer('player_html5_api'), player, 'the player was returned for the tech id');
  assert.strictEqual(videojs.getPlayer(tag), player, 'the player was returned when using the original tag/element');

  player.dispose();
});

QUnit.test('getAllPlayers', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video id="test_vid_id"></video>' +
                       '<video id="test_vid_id2"></video>';

  let all = videojs.getAllPlayers();

  assert.ok(Array.isArray(all), 'an array was returned');
  assert.strictEqual(all.length, 0, 'the array was empty because no players have been created yet');

  const player = videojs('test_vid_id');
  const player2 = videojs('test_vid_id2');

  all = videojs.getAllPlayers();

  assert.ok(Array.isArray(all), 'an array was returned');
  assert.strictEqual(all.length, 2, 'the array had two items');
  assert.notStrictEqual(all.indexOf(player), -1, 'the first player was in the array');
  assert.notStrictEqual(all.indexOf(player2), -1, 'the second player was in the array');
});

/* **************************************************** *
 * div embed tests copied from video emebed tests above *
 * **************************************************** */
QUnit.module('video.js video-js embed', {
  beforeEach() {
    this.clock = sinon.useFakeTimers();
  },
  afterEach() {
    this.clock.restore();
    videojs.getAllPlayers().forEach(p => p.dispose());
  }
});

QUnit.test('should return a video player instance', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video-js id="test_vid_id"></video-js>' +
                       '<video-js id="test_vid_id2"></video-js>';

  const player = videojs('test_vid_id', { techOrder: ['techFaker'] });

  assert.ok(player, 'created player from tag');
  assert.ok(player.id() === 'test_vid_id');
  assert.ok(
    videojs.getPlayers().test_vid_id === player,
    'added player to global reference'
  );

  const playerAgain = videojs('test_vid_id');

  assert.ok(player === playerAgain, 'did not create a second player from same tag');

  assert.equal(player, playerAgain, 'we did not make a new player');

  const tag2 = document.getElementById('test_vid_id2');
  const player2 = videojs(tag2, { techOrder: ['techFaker'] });

  assert.ok(player2.id() === 'test_vid_id2', 'created player from element');
});

QUnit.test('should add video-js class to video-js embed if missing', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video-js id="test_vid_id"></video-js>' +
                       '<video-js id="test_vid_id2" class="foo"></video-js>';

  const player = videojs('test_vid_id', { techOrder: ['techFaker'] });

  assert.ok(player, 'created player from tag');
  assert.ok(player.id() === 'test_vid_id');
  assert.ok(player.hasClass('video-js'), 'we have the video-js class');

  const tag2 = document.getElementById('test_vid_id2');
  const player2 = videojs(tag2, { techOrder: ['techFaker'] });

  assert.ok(player2.id() === 'test_vid_id2', 'created player from element');
  assert.ok(player2.hasClass('video-js'), 'we have the video-js class');
  assert.ok(player2.hasClass('foo'), 'we have the foo class');
});

QUnit.test(
  'should log about already initialized players if options already passed',
  function(assert) {
    const origWarnLog = log.warn;
    const fixture = document.getElementById('qunit-fixture');
    const warnLogs = [];

    log.warn = (args) => {
      warnLogs.push(args);
    };

    fixture.innerHTML += '<video-js id="test_vid_id"></video-js>';

    const player = videojs('test_vid_id', { techOrder: ['techFaker'] });

    assert.ok(player, 'created player from tag');
    assert.equal(player.id(), 'test_vid_id', 'player has the right ID');
    assert.equal(warnLogs.length, 0, 'no warn logs');

    const playerAgain = videojs('test_vid_id');

    assert.equal(player, playerAgain, 'did not create a second player from same tag');
    assert.equal(warnLogs.length, 0, 'no warn logs');

    const playerAgainWithOptions = videojs('test_vid_id', { techOrder: ['techFaker'] });

    assert.equal(
      player,
      playerAgainWithOptions,
      'did not create a second player from same tag'
    );
    assert.equal(warnLogs.length, 1, 'logged a warning');
    assert.equal(
      warnLogs[0],
      'Player "test_vid_id" is already initialised. Options will not be applied.',
      'logged the right message'
    );

    log.warn = origWarnLog;
  }
);

QUnit.test('should return a video player instance from el html5 tech', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video-js id="test_vid_id"></video-js>' +
                       '<video-js id="test_vid_id2"></video-js>';

  const vid = document.querySelector('#test_vid_id');

  const player = videojs(vid);

  assert.ok(player, 'created player from tag');
  assert.ok(player.id() === 'test_vid_id');
  assert.ok(
    videojs.getPlayers().test_vid_id === player,
    'added player to global reference'
  );

  const playerAgain = videojs(vid);

  assert.ok(player === playerAgain, 'did not create a second player from same tag');
  assert.equal(player, playerAgain, 'we did not make a new player');

  const tag2 = document.getElementById('test_vid_id2');
  const player2 = videojs(tag2, { techOrder: ['techFaker'] });

  assert.ok(player2.id() === 'test_vid_id2', 'created player from element');
});

QUnit.test('should return a video player instance from el techfaker', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video-js id="test_vid_id"></video-js>' +
                       '<video-js id="test_vid_id2"></video-js>';

  const vid = document.querySelector('#test_vid_id');
  const player = videojs(vid, {techOrder: ['techFaker']});

  assert.ok(player, 'created player from tag');
  assert.ok(player.id() === 'test_vid_id');
  assert.ok(
    videojs.getPlayers().test_vid_id === player,
    'added player to global reference'
  );

  const playerAgain = videojs(vid);

  assert.ok(player === playerAgain, 'did not create a second player from same tag');
  assert.equal(player, playerAgain, 'we did not make a new player');

  const tag2 = document.getElementById('test_vid_id2');
  const player2 = videojs(tag2, { techOrder: ['techFaker'] });

  assert.ok(player2.id() === 'test_vid_id2', 'created player from element');
});

QUnit.test('adds video-js class name with the video-js embed', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  fixture.innerHTML += '<video-js id="test_vid_id"></video-js>' +
                       '<video-js class="video-js" id="test_vid_id2"></video-js>';

  const vid = document.querySelector('#test_vid_id');
  const player = videojs(vid, {techOrder: ['techFaker']});
  const tag2 = document.getElementById('test_vid_id2');
  const player2 = videojs(tag2, { techOrder: ['techFaker'] });

  assert.ok(player.hasClass('video-js'), 'video-js class was added to the first embed');
  assert.ok(player2.hasClass('video-js'), 'video-js class was preserved to the second embed');
});

let testOrSkip = 'test';

// The following test uses some DocumentFragment properties that are not
// available in IE or older Safaris, so we skip it.
if (videojs.browser.IE_VERSION || videojs.browser.IS_ANY_SAFARI) {
  testOrSkip = 'skip';
}

QUnit[testOrSkip]('stores placeholder el and restores on dispose', function(assert) {
  const fixture = document.getElementById('qunit-fixture');

  const embeds = [
    {
      type: 'video el',
      src: '<video id="test1"><source src="http://example.com/video.mp4" type="video/mp4"></source></video>',
      initSelector: 'test1',
      testSelector: '#test1'
    },
    {
      type: 'video-js el',
      src: '<video-js id="test2"><source src="http://example.com/video.mp4" type="video/mp4"></source></video-js>',
      initSelector: 'test2',
      testSelector: '#test2'
    },
    {
      type: 'div ingest',
      src: '<div data-vjs-player><video id="test3"><source src="http://example.com/video.mp4" type="video/mp4"></source></video></div>',
      initSelector: 'test3',
      testSelector: 'div[data-vjs-player]'
    }
  ];

  embeds.forEach(embed => {
    const comparisonEl = document.createRange().createContextualFragment(embed.src).children[0];

    fixture.innerHTML += embed.src;

    const player = videojs(embed.initSelector, {restoreEl: true});

    assert.ok(comparisonEl.isEqualNode(player.options_.restoreEl), `${embed.type}: restoreEl option replaced by an element`);
    assert.notOk(document.querySelector(embed.testSelector).isSameNode(player.options_.restoreEl), `${embed.type}: restoreEl is not the original element`);
    assert.notOk(comparisonEl.isSameNode(player.options_.restoreEl), `${embed.type}: restoreEl is not the control element`);

    player.dispose();

    const expectedEl = document.querySelector(embed.testSelector);

    assert.ok(comparisonEl.isEqualNode(expectedEl), `${embed.type}: element was restored`);

  });
});