BLD-424: Add test to check speed change.

This commit is contained in:
polesye
2013-11-13 12:02:16 +02:00
parent 81e1d18de3
commit 526f791800

View File

@@ -411,8 +411,6 @@
beforeEach(function () {
initialize();
videoPlayer.currentTime = 60;
spyOn(videoPlayer, 'updatePlayTime').andCallThrough();
spyOn(state, 'setSpeed').andCallThrough();
spyOn(videoPlayer, 'log').andCallThrough();
@@ -421,6 +419,8 @@
describe('always', function () {
beforeEach(function () {
videoPlayer.currentTime = 60;
videoPlayer.onSpeedChange('0.75', false);
});
@@ -446,8 +446,8 @@
describe('when the video is playing', function () {
beforeEach(function () {
videoPlayer.currentTime = 60;
videoPlayer.play();
videoPlayer.onSpeedChange('0.75', false);
});
@@ -459,8 +459,6 @@
describe('when the video is not playing', function () {
beforeEach(function () {
videoPlayer.pause();
videoPlayer.onSpeedChange('0.75', false);
});
@@ -468,6 +466,15 @@
expect(videoPlayer.player.setPlaybackRate)
.toHaveBeenCalledWith('0.75');
});
it('video has a correct speed', function () {
spyOn(videoPlayer, 'onSpeedChange');
state.speed = '2.0';
videoPlayer.onPlay();
expect(videoPlayer.onSpeedChange).toHaveBeenCalledWith('2.0');
videoPlayer.onPlay();
expect(videoPlayer.onSpeedChange.calls.length).toEqual(1);
});
});
});