Skip to content

Commit

Permalink
fix(cues): only copy cue props that don't exist (#4146)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkatsev authored Mar 2, 2017
1 parent 5c3be8b commit de08669
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/js/tracks/text-track.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,9 @@ class TextTrack extends Track {
cue = new window.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);

for (const prop in originalCue) {
cue[prop] = originalCue[prop];
if (!(prop in cue)) {
cue[prop] = originalCue[prop];
}
}
}

Expand Down
12 changes: 11 additions & 1 deletion test/unit/tracks/text-track.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,17 @@ const defaultTech = {
currentTime() {}
};

QUnit.module('Text Track');
QUnit.module('Text Track', {
beforeEach() {
this.oldVttjs = window.vttjs;
window.vttjs = {
VTTCue: Object
};
},
afterEach() {
window.vttjs = this.oldVttjs;
}
});

// do baseline track testing
TrackBaseline(TextTrack, {
Expand Down

0 comments on commit de08669

Please sign in to comment.