From 8543043f861cc110e4322ff695daf72068b404e5 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Tue, 11 Jun 2013 13:39:15 -0400 Subject: [PATCH 1/4] Make video captions respect course author's setting. --- common/lib/xmodule/xmodule/js/src/video/display.coffee | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/display.coffee b/common/lib/xmodule/xmodule/js/src/video/display.coffee index aadafbc8d0..2bd39ce91a 100644 --- a/common/lib/xmodule/xmodule/js/src/video/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/video/display.coffee @@ -5,7 +5,7 @@ class @Video @start = @el.data('start') @end = @el.data('end') @caption_asset_path = @el.data('caption-asset-path') - @show_captions = @el.data('show-captions') == "true" + @show_captions = !!@el.data('show-captions') window.player = null @el = $("#video_#{@id}") @parseVideos @el.data('streams') @@ -13,7 +13,7 @@ class @Video @parseSpeed() $("#video_#{@id}").data('video', this).addClass('video-load-complete') - @hide_captions = $.cookie('hide_captions') == 'true' + @hide_captions = $.cookie('hide_captions') == 'true' or (not @show_captions) if YT.Player @embed() From 0149766710ee34a8e6d4693e628add76509f96ba Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Tue, 11 Jun 2013 14:07:40 -0400 Subject: [PATCH 2/4] Add acceptance test to ensure that show_captions has the right effect. --- cms/djangoapps/contentstore/features/video.feature | 5 +++++ cms/djangoapps/contentstore/features/video.py | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index 07771c9d61..ca6e4716a9 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -8,3 +8,8 @@ Feature: Video Component Scenario: Creating a video takes a single click Given I have clicked the new unit button Then creating a video takes a single click + + Scenario: Captions are shown correctly + Given I have created a Video component + And I have set 'show captions' to false + Then when I view the video it does not show the captions by default diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py index 7cbe8a2258..9760ee00ea 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -16,3 +16,13 @@ def video_takes_a_single_click(step): assert(not world.is_css_present('.xmodule_VideoModule')) world.css_click("a[data-location='i4x://edx/templates/video/default']") assert(world.is_css_present('.xmodule_VideoModule')) + + +@step("I have set 'show captions' to false") +def set_show_captions_false(step): + world.css_click('a.hide-subtitles') + + +@step('when I view the video it does not show the captions by default') +def does_not_show_captions(step): + assert world.css_find('.video')[0].has_class('closed') From fc6f0606c2e53560a6eea32aae40a00d66dd7a11 Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Tue, 11 Jun 2013 14:33:24 -0400 Subject: [PATCH 3/4] 0;95;cRemove unnecessary boolean conversion. --- common/lib/xmodule/xmodule/js/src/video/display.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/lib/xmodule/xmodule/js/src/video/display.coffee b/common/lib/xmodule/xmodule/js/src/video/display.coffee index 2bd39ce91a..0393fe8b9c 100644 --- a/common/lib/xmodule/xmodule/js/src/video/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/video/display.coffee @@ -5,7 +5,7 @@ class @Video @start = @el.data('start') @end = @el.data('end') @caption_asset_path = @el.data('caption-asset-path') - @show_captions = !!@el.data('show-captions') + @show_captions = @el.data('show-captions') window.player = null @el = $("#video_#{@id}") @parseVideos @el.data('streams') From 45527bf92122eca792e456357207d3a33198afce Mon Sep 17 00:00:00 2001 From: Peter Fogg Date: Tue, 11 Jun 2013 15:07:01 -0400 Subject: [PATCH 4/4] Reword acceptance test. --- cms/djangoapps/contentstore/features/video.feature | 4 ++-- cms/djangoapps/contentstore/features/video.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index ca6e4716a9..0129732d30 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -11,5 +11,5 @@ Feature: Video Component Scenario: Captions are shown correctly Given I have created a Video component - And I have set 'show captions' to false - Then when I view the video it does not show the captions by default + And I have hidden captions + Then when I view the video it does not show the captions diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py index 9760ee00ea..fd8624999e 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -18,11 +18,11 @@ def video_takes_a_single_click(step): assert(world.is_css_present('.xmodule_VideoModule')) -@step("I have set 'show captions' to false") +@step('I have hidden captions') def set_show_captions_false(step): world.css_click('a.hide-subtitles') -@step('when I view the video it does not show the captions by default') +@step('when I view the video it does not show the captions') def does_not_show_captions(step): assert world.css_find('.video')[0].has_class('closed')