Commit 934b5198 by polesye

Address comments.

parent afec2dd4
...@@ -6,12 +6,12 @@ in roughly chronological order, most recent first. Add your entries at or near ...@@ -6,12 +6,12 @@ in roughly chronological order, most recent first. Add your entries at or near
the top. Include a label indicating the component affected. the top. Include a label indicating the component affected.
Blades: Video player improvements: Blades: Video player improvements:
- Disable edX controls for iPhone (native controls are used). - Disable edX controls on iPhone/iPod (native controls are used).
- Disable volume and speed controls for iPad. - Disable unsupported controls (volume, playback rate) on iPad/Android.
- controls becomes visible after click on video or play placeholder to avoid - Controls becomes visible after click on video or play placeholder to avoid
issues with YouTube API. issues with YouTube API on iPad/Android.
- Captions becomes visible just after full initialization of video player. - Captions becomes visible just after full initialization of video player.
- Fix blinking of captions after video player initialization. BLD-206. - Fix blinking of captions after initialization of video player. BLD-206.
LMS: Fix answer distribution download for small courses. LMS-922, LMS-811 LMS: Fix answer distribution download for small courses. LMS-922, LMS-811
......
...@@ -209,34 +209,15 @@ ...@@ -209,34 +209,15 @@
}); });
describe('mouse movement', function () { describe('mouse movement', function () {
// We will store default window.setTimeout() function here.
var oldSetTimeout = null;
beforeEach(function () { beforeEach(function () {
// Store original window.setTimeout() function. If we do not do jasmine.Clock.useMock();
// this, then all other tests that rely on code which uses
// window.setTimeout() function might (and probably will) fail.
oldSetTimeout = window.setTimeout;
// Redefine window.setTimeout() function as a spy.
window.setTimeout = jasmine.createSpy().andCallFake(
function (callback, timeout) {
return 5;
}
);
window.setTimeout.andReturn(100);
spyOn(window, 'clearTimeout'); spyOn(window, 'clearTimeout');
}); });
afterEach(function () {
// Reset the default window.setTimeout() function. If we do not
// do this, then all other tests that rely on code which uses
// window.setTimeout() function might (and probably will) fail.
window.setTimeout = oldSetTimeout;
});
describe('when cursor is outside of the caption box', function () { describe('when cursor is outside of the caption box', function () {
beforeEach(function () { beforeEach(function () {
$(window).trigger(jQuery.Event('mousemove')); $(window).trigger(jQuery.Event('mousemove'));
jasmine.Clock.tick(state.config.captionsFreezeTime);
}); });
it('does not set freezing timeout', function () { it('does not set freezing timeout', function () {
...@@ -246,11 +227,14 @@ ...@@ -246,11 +227,14 @@
describe('when cursor is in the caption box', function () { describe('when cursor is in the caption box', function () {
beforeEach(function () { beforeEach(function () {
spyOn(videoCaption, 'onMouseLeave');
$('.subtitles').trigger(jQuery.Event('mouseenter')); $('.subtitles').trigger(jQuery.Event('mouseenter'));
jasmine.Clock.tick(state.config.captionsFreezeTime);
}); });
it('set the freezing timeout', function () { it('set the freezing timeout', function () {
expect(videoCaption.frozen).toEqual(100); expect(videoCaption.frozen).not.toBeFalsy();
expect(videoCaption.onMouseLeave).toHaveBeenCalled();
}); });
describe('when the cursor is moving', function () { describe('when the cursor is moving', function () {
...@@ -259,7 +243,7 @@ ...@@ -259,7 +243,7 @@
}); });
it('reset the freezing timeout', function () { it('reset the freezing timeout', function () {
expect(window.clearTimeout).toHaveBeenCalledWith(100); expect(window.clearTimeout).toHaveBeenCalled();
}); });
}); });
...@@ -269,7 +253,7 @@ ...@@ -269,7 +253,7 @@
}); });
it('reset the freezing timeout', function () { it('reset the freezing timeout', function () {
expect(window.clearTimeout).toHaveBeenCalledWith(100); expect(window.clearTimeout).toHaveBeenCalled();
}); });
}); });
}); });
......
...@@ -152,28 +152,14 @@ ...@@ -152,28 +152,14 @@
}); });
describe('onStop', function() { describe('onStop', function() {
// We will store default window.setTimeout() function here.
var oldSetTimeout = null;
beforeEach(function() { beforeEach(function() {
// Store original window.setTimeout() function. If we do not do jasmine.Clock.useMock();
// this, then all other tests that rely on code which uses
// window.setTimeout() function might (and probably will) fail.
oldSetTimeout = window.setTimeout;
// Redefine window.setTimeout() function as a spy.
window.setTimeout = jasmine.createSpy().andReturn(100);
initialize(); initialize();
spyOn(videoPlayer, 'onSlideSeek').andCallThrough(); spyOn(videoPlayer, 'onSlideSeek').andCallThrough();
}); });
afterEach(function () {
// Reset the default window.setTimeout() function. If we do not
// do this, then all other tests that rely on code which uses
// window.setTimeout() function might (and probably will) fail.
window.setTimeout = oldSetTimeout;
});
it('freeze the slider', function() { it('freeze the slider', function() {
videoProgressSlider.onStop( videoProgressSlider.onStop(
jQuery.Event('stop'), { value: 20 } jQuery.Event('stop'), { value: 20 }
...@@ -195,10 +181,8 @@ ...@@ -195,10 +181,8 @@
jQuery.Event('stop'), { value: 20 } jQuery.Event('stop'), { value: 20 }
); );
expect(window.setTimeout).toHaveBeenCalledWith( jasmine.Clock.tick(200);
jasmine.any(Function), 200
);
window.setTimeout.mostRecentCall.args[0]();
expect(videoProgressSlider.frozen).toBeFalsy(); expect(videoProgressSlider.frozen).toBeFalsy();
}); });
}); });
......
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