diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f865c09840..0e161e4f72 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,9 @@ 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. +Studio: Remove XML from the video component editor. All settings are +moved to be edited as metadata. + XModule: Only write out assets files if the contents have changed. XModule: Don't delete generated xmodule asset files when compiling (for diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py index d833c6f58e..e0f20d3d6e 100644 --- a/cms/djangoapps/contentstore/features/common.py +++ b/cms/djangoapps/contentstore/features/common.py @@ -171,6 +171,16 @@ def open_new_unit(step): world.css_click('a.new-unit-item') +@step('when I view the video it (.*) show the captions') +def shows_captions(step, show_captions): + # Prevent cookies from overriding course settings + world.browser.cookies.delete('hide_captions') + if show_captions == 'does not': + assert world.css_find('.video')[0].has_class('closed') + else: + assert world.is_css_not_present('.video.closed') + + def type_in_codemirror(index, text): world.css_click(".CodeMirror", index=index) g = world.css_find("div.CodeMirror.CodeMirror-focused > div > textarea") diff --git a/cms/djangoapps/contentstore/features/video-editor.feature b/cms/djangoapps/contentstore/features/video-editor.feature index 4c2a460042..f28ee568dc 100644 --- a/cms/djangoapps/contentstore/features/video-editor.feature +++ b/cms/djangoapps/contentstore/features/video-editor.feature @@ -4,10 +4,20 @@ Feature: Video Component Editor Scenario: User can view metadata Given I have created a Video component And I edit and select Settings - Then I see only the Video display name setting + Then I see the correct settings and default values Scenario: User can modify display name Given I have created a Video component And I edit and select Settings Then I can modify the display name And my display name change is persisted on save + + Scenario: Captions are hidden when "show captions" is false + 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 + + Scenario: Captions are shown when "show captions" is true + Given I have created a Video component + And I have set "show captions" to True + Then when I view the video it does show the captions diff --git a/cms/djangoapps/contentstore/features/video-editor.py b/cms/djangoapps/contentstore/features/video-editor.py index 27423575c3..987b4959b8 100644 --- a/cms/djangoapps/contentstore/features/video-editor.py +++ b/cms/djangoapps/contentstore/features/video-editor.py @@ -4,6 +4,20 @@ from lettuce import world, step -@step('I see only the video display name setting$') -def i_see_only_the_video_display_name(step): - world.verify_all_setting_entries([['Display Name', "default", True]]) +@step('I see the correct settings and default values$') +def i_see_the_correct_settings_and_values(step): + world.verify_all_setting_entries([['Default Speed', 'OEoXaMPEzfM', False], + ['Display Name', 'default', True], + ['Download Track', '', False], + ['Download Video', '', False], + ['Show Captions', 'True', False], + ['Speed: .75x', '', False], + ['Speed: 1.25x', '', False], + ['Speed: 1.5x', '', False]]) + + +@step('I have set "show captions" to (.*)') +def set_show_captions(step, setting): + world.css_click('a.edit-button') + world.browser.select('Show Captions', setting) + world.css_click('a.save-button') diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature index 0129732d30..e4caa70ef6 100644 --- a/cms/djangoapps/contentstore/features/video.feature +++ b/cms/djangoapps/contentstore/features/video.feature @@ -9,7 +9,16 @@ Feature: Video Component Given I have clicked the new unit button Then creating a video takes a single click - Scenario: Captions are shown correctly + Scenario: Captions are hidden correctly Given I have created a Video component And I have hidden captions Then when I view the video it does not show the captions + + Scenario: Captions are shown correctly + Given I have created a Video component + Then when I view the video it does show the captions + + Scenario: Captions are toggled correctly + Given I have created a Video component + And I have toggled captions + Then when I view the video it does show the captions diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py index c48b36a5aa..190f8e9f1e 100644 --- a/cms/djangoapps/contentstore/features/video.py +++ b/cms/djangoapps/contentstore/features/video.py @@ -18,11 +18,16 @@ def video_takes_a_single_click(_step): assert(world.is_css_present('.xmodule_VideoModule')) -@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') -def does_not_show_captions(step): - assert world.css_find('.video')[0].has_class('closed') +@step('I have (hidden|toggled) captions') +def hide_or_show_captions(step, shown): + button_css = 'a.hide-subtitles' + if shown == 'hidden': + world.css_click(button_css) + if shown == 'toggled': + world.css_click(button_css) + # When we click the first time, a tooltip shows up. We want to + # click the button rather than the tooltip, so move the mouse + # away to make it disappear. + button = world.css_find(button_css) + button.mouse_out() + world.css_click(button_css) diff --git a/common/lib/xmodule/xmodule/js/fixtures/video.html b/common/lib/xmodule/xmodule/js/fixtures/video.html index e86a24dc5c..1b27255b1e 100644 --- a/common/lib/xmodule/xmodule/js/fixtures/video.html +++ b/common/lib/xmodule/xmodule/js/fixtures/video.html @@ -2,7 +2,8 @@
-
\ No newline at end of file + diff --git a/common/lib/xmodule/xmodule/js/spec/video/display_spec.coffee b/common/lib/xmodule/xmodule/js/spec/video/display_spec.coffee index a83fa3905c..0ba0cc85f8 100644 --- a/common/lib/xmodule/xmodule/js/spec/video/display_spec.coffee +++ b/common/lib/xmodule/xmodule/js/spec/video/display_spec.coffee @@ -5,7 +5,6 @@ describe 'Video', -> loadFixtures 'video.html' jasmine.stubRequests() - @videosDefinition = '0.75:slowerSpeedYoutubeId,1.0:normalSpeedYoutubeId' @slowerSpeedYoutubeId = 'slowerSpeedYoutubeId' @normalSpeedYoutubeId = 'normalSpeedYoutubeId' metadata = @@ -30,7 +29,7 @@ describe 'Video', -> beforeEach -> spyOn(window.Video.prototype, 'fetchMetadata').andCallFake -> @metadata = metadata - @video = new Video '#example', @videosDefinition + @video = new Video '#example' it 'reset the current video player', -> expect(window.player).toBeNull() @@ -60,7 +59,7 @@ describe 'Video', -> @originalYT = window.YT window.YT = { Player: true } spyOn(window, 'VideoPlayer').andReturn(@stubVideoPlayer) - @video = new Video '#example', @videosDefinition + @video = new Video '#example' afterEach -> window.YT = @originalYT @@ -73,7 +72,7 @@ describe 'Video', -> beforeEach -> @originalYT = window.YT window.YT = {} - @video = new Video '#example', @videosDefinition + @video = new Video '#example' afterEach -> window.YT = @originalYT @@ -86,7 +85,7 @@ describe 'Video', -> @originalYT = window.YT window.YT = {} spyOn(window, 'VideoPlayer').andReturn(@stubVideoPlayer) - @video = new Video '#example', @videosDefinition + @video = new Video '#example' window.onYouTubePlayerAPIReady() afterEach -> @@ -99,7 +98,7 @@ describe 'Video', -> describe 'youtubeId', -> beforeEach -> $.cookie.andReturn '1.0' - @video = new Video '#example', @videosDefinition + @video = new Video '#example' describe 'with speed', -> it 'return the video id for given speed', -> @@ -112,7 +111,7 @@ describe 'Video', -> describe 'setSpeed', -> beforeEach -> - @video = new Video '#example', @videosDefinition + @video = new Video '#example' describe 'when new speed is available', -> beforeEach -> @@ -133,14 +132,14 @@ describe 'Video', -> describe 'getDuration', -> beforeEach -> - @video = new Video '#example', @videosDefinition + @video = new Video '#example' it 'return duration for current video', -> expect(@video.getDuration()).toEqual 200 describe 'log', -> beforeEach -> - @video = new Video '#example', @videosDefinition + @video = new Video '#example' @video.setSpeed '1.0' spyOn Logger, 'log' @video.player = { currentTime: 25 } diff --git a/common/lib/xmodule/xmodule/js/src/video/display.coffee b/common/lib/xmodule/xmodule/js/src/video/display.coffee index 0393fe8b9c..d9c31b2c8d 100644 --- a/common/lib/xmodule/xmodule/js/src/video/display.coffee +++ b/common/lib/xmodule/xmodule/js/src/video/display.coffee @@ -8,7 +8,7 @@ class @Video @show_captions = @el.data('show-captions') window.player = null @el = $("#video_#{@id}") - @parseVideos @el.data('streams') + @parseVideos() @fetchMetadata() @parseSpeed() $("#video_#{@id}").data('video', this).addClass('video-load-complete') @@ -27,10 +27,14 @@ class @Video parseVideos: (videos) -> @videos = {} - $.each videos.split(/,/), (index, video) => - video = video.split(/:/) - speed = parseFloat(video[0]).toFixed(2).replace /\.00$/, '.0' - @videos[speed] = video[1] + if @el.data('youtube-id-0-75') + @videos['0.75'] = @el.data('youtube-id-0-75') + if @el.data('youtube-id-1-0') + @videos['1.0'] = @el.data('youtube-id-1-0') + if @el.data('youtube-id-1-25') + @videos['1.25'] = @el.data('youtube-id-1-25') + if @el.data('youtube-id-1-5') + @videos['1.50'] = @el.data('youtube-id-1-5') parseSpeed: -> @setSpeed($.cookie('video_speed')) diff --git a/common/lib/xmodule/xmodule/templates/video/default.yaml b/common/lib/xmodule/xmodule/templates/video/default.yaml index 0ce2046ebe..048e7396c7 100644 --- a/common/lib/xmodule/xmodule/templates/video/default.yaml +++ b/common/lib/xmodule/xmodule/templates/video/default.yaml @@ -1,7 +1,5 @@ --- metadata: display_name: default - data_dir: a_made_up_name -data: | -