From b02fdef05955a68184c458d5162a7d3174056f8f Mon Sep 17 00:00:00 2001 From: Garrett Singer Date: Fri, 20 Nov 2015 17:21:55 -0800 Subject: [PATCH] Check for text track changes that occurred before tech was listening --- src/js/tech/tech.js | 1 + test/unit/tracks/tracks.test.js | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/js/tech/tech.js b/src/js/tech/tech.js index 866bf81a93..b7d76dd283 100644 --- a/src/js/tech/tech.js +++ b/src/js/tech/tech.js @@ -335,6 +335,7 @@ class Tech extends Component { } }); + textTracksChanges(); tracks.addEventListener('change', textTracksChanges); this.on('dispose', function() { diff --git a/test/unit/tracks/tracks.test.js b/test/unit/tracks/tracks.test.js index 7a51f465b9..7b0663259c 100644 --- a/test/unit/tracks/tracks.test.js +++ b/test/unit/tracks/tracks.test.js @@ -342,3 +342,13 @@ if (Html5.supportsNativeTextTracks()) { emulatedTt.on('addtrack', addtrack); }); } + +test('should check for text track changes when emulating text tracks', function() { + let tech = new Tech(); + let numTextTrackChanges = 0; + tech.on('texttrackchange', function() { + numTextTrackChanges++; + }); + tech.emulateTextTracks(); + equal(numTextTrackChanges, 1, 'we got a texttrackchange event'); +});