Skip to content

Commit

Permalink
Merge pull request #337 from ooyala/PLAYER-4422_units
Browse files Browse the repository at this point in the history
[PLAYER-4422] add unit tests
  • Loading branch information
zelibobla authored Nov 2, 2018
2 parents 02081e0 + 698f343 commit 43c8e3f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/unit/main_html5/wrapper-event-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,41 @@ describe('main_html5 wrapper tests', function () {
}]);
});

it('should not notify DURATION_CHANGE or PROGRESS during failover', function(){
vtc.notifyParameters = [];
wrapper.handleFailover(100);
$(element).triggerHandler("duration");
expect(vtc.notifyParameters).to.eql([]);
$(element).triggerHandler("progress");
expect(vtc.notifyParameters).to.eql([]);
});

it('should seek to saved dvr position after play during failover', function(){
var savedPlayhead = 100;
const spy = sinon.spy(wrapper, "seek");
var originalPlay = element.play;
var playPromiseThen = null;
var playCalled = 0;
element.play = function() {
playCalled++;
return {
then: function(callback) {
playPromiseThen = callback;
}
};
};
wrapper.setVideoUrl("url", OO.VIDEO.ENCODING.HLS, true);
wrapper.handleFailover(savedPlayhead);
wrapper.play();
expect(playCalled).to.be(1);
stubSeekable(element, 0, savedPlayhead * 2);
playPromiseThen();
expect(spy.callCount).to.be(1);
expect(spy.calledWith(savedPlayhead)).to.be(true);
expect(element.currentTime).to.eql(100);
element.play = originalPlay;
});

it('should notify CAPTIONS_FOUND_ON_PLAYING with multiple in-manifest/in-stream captions', function() {
element.textTracks = [
{ language: "", label: "", kind: "subtitles" },
Expand Down

0 comments on commit 43c8e3f

Please sign in to comment.