From 6910ac953547606dd018e4a386d63a554eb3c665 Mon Sep 17 00:00:00 2001 From: Valera Rozuvan Date: Tue, 19 Nov 2013 12:44:37 +0200 Subject: [PATCH] Addressing reviewer's comments. Updated Change Log. BLD-488 --- CHANGELOG.rst | 2 + .../js/spec/video/video_player_spec.js | 52 +++++++++---------- .../js/src/video/06_video_progress_slider.js | 5 +- 3 files changed, 29 insertions(+), 30 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 91eac8f611..551ae2e7b9 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,8 @@ These are notable changes in edx-platform. This is a rolling list of changes, in roughly chronological order, most recent first. Add your entries at or near the top. Include a label indicating the component affected. +Blades: a11y - Videos will alert screenreaders when the video is over. + LMS: Trap focus on the loading element when a user loads more threads in the forum sidebar to improve accessibility. diff --git a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js index cf785e79f1..62e1475356 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js +++ b/common/lib/xmodule/xmodule/js/spec/video/video_player_spec.js @@ -4,28 +4,23 @@ videoProgressSlider, videoSpeedControl, videoVolumeControl, oldOTBD; - function initialize(config) { - if (config) { - if (config.fixture) { - loadFixtures(config.fixture); - } else { - loadFixtures('video_all.html'); + function initialize(fixture, params) { + if (_.isString(fixture)) { + loadFixtures(fixture); + } else { + if (_.isObject(fixture)) { + params = fixture; } - if (config.startTime) { - $('#example') - .find('#video_id') - .data('start', config.startTime); - } - if (config.endTime) { - $('#example') - .find('#video_id') - .data('end', config.endTime); - } - } else { loadFixtures('video_all.html'); } + if (_.isObject(params)) { + $('#example') + .find('#video_id') + .data(params); + } + state = new Video('#example'); state.videoEl = $('video, iframe'); @@ -56,7 +51,7 @@ } function initializeYouTube() { - initialize({fixture: 'video.html'}); + initialize('video.html'); } beforeEach(function () { @@ -548,10 +543,10 @@ }); describe('update with start & end time', function () { - var START_TIME = 2, END_TIME = 4; + var START_TIME = 1, END_TIME = 2; beforeEach(function () { - initialize({startTime: START_TIME, endTime: END_TIME}); + initialize({start: START_TIME, end: END_TIME}); spyOn(videoPlayer, 'update').andCallThrough(); spyOn(videoPlayer, 'pause').andCallThrough(); @@ -673,9 +668,12 @@ }); }); - describe('updatePlayTime with start & end times', function () { + describe('updatePlayTime when start & end times are defined', function () { + var START_TIME = 1, + END_TIME = 2; + beforeEach(function () { - initialize({startTime: 2, endTime: 4}); + initialize({start: START_TIME, end: END_TIME}); spyOn(videoPlayer, 'updatePlayTime').andCallThrough(); spyOn(videoPlayer.player, 'seekTo').andCallThrough(); @@ -699,16 +697,14 @@ }, 'duration becomes available', 1000); runs(function () { - expect(videoPlayer.startTime).toBe(2); - expect(videoPlayer.endTime).toBe(4); + expect(videoPlayer.startTime).toBe(START_TIME); + expect(videoPlayer.endTime).toBe(END_TIME); - expect(videoPlayer.player.seekTo).toHaveBeenCalledWith(2); + expect(videoPlayer.player.seekTo).toHaveBeenCalledWith(START_TIME); expect(videoProgressSlider.updateStartEndTimeRegion) .toHaveBeenCalledWith({duration: duration}); - // videoProgressSlider.updateStartEndTimeRegion - expect(videoPlayer.seekToStartTimeOldSpeed).toBe(state.speed); }); }); @@ -716,7 +712,7 @@ describe('updatePlayTime with invalid endTime', function () { beforeEach(function () { - initialize({endTime: 100000}); + initialize({end: 100000}); spyOn(videoPlayer, 'updatePlayTime').andCallThrough(); }); diff --git a/common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js b/common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js index 6a3deff974..e10c4fbb24 100644 --- a/common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js +++ b/common/lib/xmodule/xmodule/js/src/video/06_video_progress_slider.js @@ -228,8 +228,9 @@ function () { // onPlay(), and update() (update method handles endTime). function notifyThroughHandleEnd(params) { if (params.end) { - this.videoProgressSlider.handle.attr('title', 'video ended'); - this.videoProgressSlider.handle.focus(); + this.videoProgressSlider.handle + .attr('title', 'video ended') + .focus(); } else { this.videoProgressSlider.handle.attr('title', 'video position'); }