Commit 50250d82 by polesye

Merge pull request #1653 from edx/anton/video-add-test

Video: tests to check speed change
parents e2926a94 526f7918
...@@ -411,8 +411,6 @@ ...@@ -411,8 +411,6 @@
beforeEach(function () { beforeEach(function () {
initialize(); initialize();
videoPlayer.currentTime = 60;
spyOn(videoPlayer, 'updatePlayTime').andCallThrough(); spyOn(videoPlayer, 'updatePlayTime').andCallThrough();
spyOn(state, 'setSpeed').andCallThrough(); spyOn(state, 'setSpeed').andCallThrough();
spyOn(videoPlayer, 'log').andCallThrough(); spyOn(videoPlayer, 'log').andCallThrough();
...@@ -421,6 +419,8 @@ ...@@ -421,6 +419,8 @@
describe('always', function () { describe('always', function () {
beforeEach(function () { beforeEach(function () {
videoPlayer.currentTime = 60;
videoPlayer.onSpeedChange('0.75', false); videoPlayer.onSpeedChange('0.75', false);
}); });
...@@ -446,8 +446,8 @@ ...@@ -446,8 +446,8 @@
describe('when the video is playing', function () { describe('when the video is playing', function () {
beforeEach(function () { beforeEach(function () {
videoPlayer.currentTime = 60;
videoPlayer.play(); videoPlayer.play();
videoPlayer.onSpeedChange('0.75', false); videoPlayer.onSpeedChange('0.75', false);
}); });
...@@ -459,8 +459,6 @@ ...@@ -459,8 +459,6 @@
describe('when the video is not playing', function () { describe('when the video is not playing', function () {
beforeEach(function () { beforeEach(function () {
videoPlayer.pause();
videoPlayer.onSpeedChange('0.75', false); videoPlayer.onSpeedChange('0.75', false);
}); });
...@@ -468,6 +466,15 @@ ...@@ -468,6 +466,15 @@
expect(videoPlayer.player.setPlaybackRate) expect(videoPlayer.player.setPlaybackRate)
.toHaveBeenCalledWith('0.75'); .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);
});
}); });
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment