Skip to content

Commit

Permalink
dispose players
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev committed Dec 15, 2016
1 parent d0ce789 commit a85eb5b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/unit/video.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ QUnit.test('ingest player div if data-vjs-player attribute is present on video p
fixture.innerHTML = `
<div data-vjs-player class="foo">
<video id="test_vid_id">
<source type="video/mp4"></source>
<source src="http://example.com/video.mp4" type="video/mp4"></source>
</video>
</div>
`;
Expand All @@ -187,6 +187,8 @@ QUnit.test('ingest player div if data-vjs-player attribute is present on video p

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

player.dispose();
});

QUnit.test('ingested player div should not create a new tag for movingMediaElementInDOM', function(assert) {
Expand All @@ -197,7 +199,7 @@ QUnit.test('ingested player div should not create a new tag for movingMediaEleme
fixture.innerHTML = `
<div data-vjs-player class="foo">
<video id="test_vid_id">
<source type="video/mp4"></source>
<source src="http://example.com/video.mp4" type="video/mp4"></source>
</video>
</div>
`;
Expand All @@ -214,6 +216,7 @@ QUnit.test('ingested player div should not create a new tag for movingMediaEleme
assert.equal(player.tech_.el(), vid, 'we re-used the video element');
assert.ok(player.hasClass('foo'), 'keeps any classes that were around previously');

player.dispose();
Html5.prototype.movingMediaElementInDOM = oldMoving;
});

Expand All @@ -225,7 +228,7 @@ QUnit.test('should create a new tag for movingMediaElementInDOM', function(asser
fixture.innerHTML = `
<div class="foo">
<video id="test_vid_id">
<source type="video/mp4"></source>
<source src="http://example.com/video.mp4" type="video/mp4"></source>
</video>
</div>
`;
Expand All @@ -241,5 +244,6 @@ QUnit.test('should create a new tag for movingMediaElementInDOM', function(asser
assert.notEqual(player.el(), playerDiv, 'we used a new div');
assert.notEqual(player.tech_.el(), vid, 'we a new video element');

player.dispose();
Html5.prototype.movingMediaElementInDOM = oldMoving;
});

0 comments on commit a85eb5b

Please sign in to comment.