From ffa49b03910891ffa8595e453971b2d2ae8c8a85 Mon Sep 17 00:00:00 2001 From: jmclaus Date: Mon, 23 Sep 2013 17:37:35 +0200 Subject: [PATCH] Added tests --- .../js/spec/video/video_speed_control_spec.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js index af919e135e..4b650d11be 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/video_speed_control_spec.js @@ -138,6 +138,28 @@ expect(videoSpeedControl.currentSpeed).toEqual(0.75); }); }); + + describe('make sure the speed control gets the focus afterwards', function() { + var focusSpy; + + beforeEach(function() { + initialize(); + videoSpeedControl.setSpeed(1.0); + focusSpy = spyOn($.fn, 'focus').andCallThrough(); + }); + + it('when the speed is the same', function() { + $('li[data-speed="1.0"] a').click(); + expect(focusSpy).toHaveBeenCalled(); + expect(focusSpy.mostRecentCall.object.selector).toEqual('.parent().parent().siblings(a)'); + }); + + it('when the speed is not the same', function() { + $('li[data-speed="0.75"] a').click(); + expect(focusSpy).toHaveBeenCalled(); + expect(focusSpy.mostRecentCall.object.selector).toEqual('.parent().parent().siblings(a)'); + }); + }); }); describe('onSpeedChange', function() {