Skip to content

Commit

Permalink
add on to fake tech
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Dec 7, 2020
1 parent a4d71b3 commit 5ce1af2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
6 changes: 4 additions & 2 deletions test/unit/tech/tech.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,9 @@ QUnit.test('dispose() should stop time tracking', function(assert) {
QUnit.test('dispose() should clear all tracks that are passed when its created', function(assert) {
const audioTracks = new AudioTrackList([new AudioTrack(), new AudioTrack()]);
const videoTracks = new VideoTrackList([new VideoTrack(), new VideoTrack()]);
const textTracks = new TextTrackList([new TextTrack({tech: {}}),
new TextTrack({tech: {}})]);
const pretech = new Tech();
const textTracks = new TextTrackList([new TextTrack({tech: pretech}),
new TextTrack({tech: pretech})]);

assert.equal(audioTracks.length, 2, 'should have two audio tracks at the start');
assert.equal(videoTracks.length, 2, 'should have two video tracks at the start');
Expand All @@ -167,6 +168,7 @@ QUnit.test('dispose() should clear all tracks that are passed when its created',
'should hold text tracks that we passed'
);

pretech.dispose();
tech.dispose();

assert.equal(audioTracks.length, 0, 'should have zero audio tracks after dispose');
Expand Down
2 changes: 1 addition & 1 deletion test/unit/tracks/html-track-element.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ QUnit.test('fires loadeddata when track cues become populated', function(assert)
changes++;
};
const htmlTrackElement = new HTMLTrackElement({
tech() {}
tech: this.tech
});

htmlTrackElement.addEventListener('load', loadHandler);
Expand Down
25 changes: 18 additions & 7 deletions test/unit/tracks/text-track-list-converter.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ if (Html5.supportsNativeTextTracks()) {
tech: {
crossOrigin() {
return null;
}
},
on() {}
}
});

Expand All @@ -75,6 +76,7 @@ if (Html5.supportsNativeTextTracks()) {
}
};
},
on() {},
crossOrigin() {
return null;
},
Expand Down Expand Up @@ -108,7 +110,8 @@ if (Html5.supportsNativeTextTracks()) {
tech: {
crossOrigin() {
return null;
}
},
on() {}
}
});

Expand Down Expand Up @@ -140,6 +143,7 @@ if (Html5.supportsNativeTextTracks()) {
crossOrigin() {
return null;
},
on() {},
textTracks() {
return tt;
},
Expand Down Expand Up @@ -169,7 +173,8 @@ QUnit.test('trackToJson_ produces correct representation for emulated track obje
tech: {
crossOrigin() {
return null;
}
},
on() {}
}
});

Expand All @@ -191,7 +196,8 @@ QUnit.test('textTracksToJson produces good json output for emulated only', funct
tech: {
crossOrigin() {
return null;
}
},
on() {}
}
});

Expand All @@ -203,7 +209,8 @@ QUnit.test('textTracksToJson produces good json output for emulated only', funct
tech: {
crossOrigin() {
return null;
}
},
on() {}
}
});

Expand All @@ -227,6 +234,7 @@ QUnit.test('textTracksToJson produces good json output for emulated only', funct
crossOrigin() {
return null;
},
on() {},
textTracks() {
return tt;
}
Expand Down Expand Up @@ -259,7 +267,8 @@ QUnit.test('jsonToTextTracks calls addRemoteTextTrack on the tech with emulated
tech: {
crossOrigin() {
return null;
}
},
on() {}
}
});

Expand All @@ -271,7 +280,8 @@ QUnit.test('jsonToTextTracks calls addRemoteTextTrack on the tech with emulated
tech: {
crossOrigin() {
return null;
}
},
on() {}
}
});

Expand All @@ -296,6 +306,7 @@ QUnit.test('jsonToTextTracks calls addRemoteTextTrack on the tech with emulated
crossOrigin() {
return null;
},
on() {},
textTracks() {
return tt;
},
Expand Down

0 comments on commit 5ce1af2

Please sign in to comment.