diff --git a/src/js/component.js b/src/js/component.js index e3248fd27a..f96ee75e04 100644 --- a/src/js/component.js +++ b/src/js/component.js @@ -731,12 +731,6 @@ class Component { * @return {Component} */ triggerReady() { - - // // Ready should only be fired once - // if (this.isReady_) { - // return; - // } - this.isReady_ = true; // Ensure ready is triggerd asynchronously diff --git a/src/js/tracks/text-track-display.js b/src/js/tracks/text-track-display.js index c041fdfe49..deba42bf5e 100644 --- a/src/js/tracks/text-track-display.js +++ b/src/js/tracks/text-track-display.js @@ -47,7 +47,6 @@ class TextTrackDisplay extends Component { player.on('fullscreenchange', Fn.bind(this, this.updateDisplay)); let tracks = player.options_['tracks'] || []; - for (let i = 0; i < tracks.length; i++) { let track = tracks[i]; this.player_.addRemoteTextTrack(track); diff --git a/test/globals-shim.js b/test/globals-shim.js index cbcf7b034c..df9a6d7d23 100644 --- a/test/globals-shim.js +++ b/test/globals-shim.js @@ -1,3 +1,4 @@ +import document from 'global/document'; import window from 'global/window'; import sinon from 'sinon'; @@ -6,5 +7,5 @@ window.sinon = sinon; // This may not be needed anymore, but double check before removing window.fixture = document.createElement('div'); -fixture.id = 'qunit-fixture'; -document.body.appendChild(fixture); +window.fixture.id = 'qunit-fixture'; +document.body.appendChild(window.fixture); diff --git a/test/unit/tracks/tracks.test.js b/test/unit/tracks/tracks.test.js index ca11ea2017..1cd65c3945 100644 --- a/test/unit/tracks/tracks.test.js +++ b/test/unit/tracks/tracks.test.js @@ -48,6 +48,24 @@ test('Player track methods call the tech', function() { equal(calls, 2, 'both textTrack and addTextTrack defer to the tech'); }); +test('TextTrackDisplay initializes tracks on player ready', function() { + var calls = 0, + ttd = new TextTrackDisplay({ + on: Function.prototype, + addTextTracks: function() { + calls--; + }, + getChild: function() { + calls--; + }, + ready: function() { + calls++; + } + }, {}); + + equal(calls, 1, 'only a player.ready call was made'); +}); + test('listen to remove and add track events in native text tracks', function() { var oldTestVid = Html5.TEST_VID, player,