diff --git a/cms/djangoapps/contentstore/features/common.py b/cms/djangoapps/contentstore/features/common.py
index 30ee0518c1..e06f27bcea 100644
--- a/cms/djangoapps/contentstore/features/common.py
+++ b/cms/djangoapps/contentstore/features/common.py
@@ -256,14 +256,14 @@ 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):
+@step('when I view the (video.*) it (.*) show the captions')
+def shows_captions(_step, video_type, show_captions):
# Prevent cookies from overriding course settings
world.browser.cookies.delete('hide_captions')
if show_captions == 'does not':
- assert world.css_has_class('.video', 'closed')
+ assert world.css_has_class('.%s' % video_type, 'closed')
else:
- assert world.is_css_not_present('.video.closed')
+ assert world.is_css_not_present('.%s.closed' % video_type)
@step('the save button is disabled$')
diff --git a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
index 513eb699e9..f240386f26 100644
--- a/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
+++ b/cms/djangoapps/contentstore/features/component_settings_editor_helpers.py
@@ -59,6 +59,12 @@ def edit_component_and_select_settings():
world.css_click('#settings-mode')
+@world.absorb
+def edit_component():
+ world.wait_for(lambda _driver: world.css_visible('a.edit-button'))
+ world.css_click('a.edit-button')
+
+
@world.absorb
def verify_setting_entry(setting, display_name, value, explicitly_set):
assert_equal(display_name, setting.find_by_css('.setting-label')[0].value)
diff --git a/cms/djangoapps/contentstore/features/video-editor.py b/cms/djangoapps/contentstore/features/video-editor.py
index b74f37bb85..ad3229ab53 100644
--- a/cms/djangoapps/contentstore/features/video-editor.py
+++ b/cms/djangoapps/contentstore/features/video-editor.py
@@ -29,8 +29,10 @@ def correct_videoalpha_settings(_step):
world.verify_all_setting_entries([['Display Name', 'Video Alpha', False],
['Download Track', '', False],
['Download Video', '', False],
+ ['End Time', '0', False],
['HTML5 Subtitles', '', False],
['Show Captions', 'True', False],
+ ['Start Time', '0', False],
['Video Sources', '', False],
['Youtube ID', 'OEoXaMPEzfM', False],
['Youtube ID for .75x speed', '', False],
diff --git a/cms/djangoapps/contentstore/features/video.feature b/cms/djangoapps/contentstore/features/video.feature
index 86cd2c27c9..dc85bbb17f 100644
--- a/cms/djangoapps/contentstore/features/video.feature
+++ b/cms/djangoapps/contentstore/features/video.feature
@@ -29,23 +29,21 @@ Feature: Video Component
Scenario: User can view Video Alpha metadata
Given I have created a Video Alpha component
- And I edit and select Settings
+ And I edit the component
Then I see the correct videoalpha settings and default values
Scenario: User can modify Video Alpha display name
Given I have created a Video Alpha component
- And I edit and select Settings
+ And I edit the component
Then I can modify the display name
- And my display name change is persisted on save
+ And my videoalpha display name change is persisted on save
- @skip
Scenario: Video Alpha captions are hidden when "show captions" is false
Given I have created a Video Alpha component
And I have set "show captions" to False
- Then when I view the video it does not show the captions
+ Then when I view the videoalpha it does not show the captions
- @skip
Scenario: Video Alpha captions are shown when "show captions" is true
Given I have created a Video Alpha component
And I have set "show captions" to True
- Then when I view the video it does show the captions
+ Then when I view the videoalpha it does show the captions
diff --git a/cms/djangoapps/contentstore/features/video.py b/cms/djangoapps/contentstore/features/video.py
index d22e580222..72a8762197 100644
--- a/cms/djangoapps/contentstore/features/video.py
+++ b/cms/djangoapps/contentstore/features/video.py
@@ -1,6 +1,7 @@
#pylint: disable=C0111
from lettuce import world, step
+from terrain.steps import reload_the_page
############### ACTIONS ####################
@@ -31,3 +32,15 @@ def hide_or_show_captions(step, shown):
button = world.css_find(button_css)
button.mouse_out()
world.css_click(button_css)
+
+@step('I edit the component')
+def i_edit_the_component(_step):
+ world.edit_component()
+
+
+@step('my videoalpha display name change is persisted on save')
+def videoalpha_name_persisted(step):
+ world.css_click('a.save-button')
+ reload_the_page(step)
+ world.edit_component()
+ world.verify_setting_entry(world.get_setting_entry('Display Name'), 'Display Name', '3.4', True)
diff --git a/cms/static/coffee/spec/views/metadata_edit_spec.coffee b/cms/static/coffee/spec/views/metadata_edit_spec.coffee
index bcc3cb436b..926e5be315 100644
--- a/cms/static/coffee/spec/views/metadata_edit_spec.coffee
+++ b/cms/static/coffee/spec/views/metadata_edit_spec.coffee
@@ -107,7 +107,8 @@ describe "Test Metadata Editor", ->
view = new CMS.Views.Metadata.Editor({collection: @model})
childModels = view.collection.models
expect(childModels.length).toBe(6)
- childViews = view.$el.find('.setting-input')
+ # Be sure to check list view as well as other input types
+ childViews = view.$el.find('.setting-input, .list-settings')
expect(childViews.length).toBe(6)
verifyEntry = (index, display_name, type) ->
@@ -116,7 +117,7 @@ describe "Test Metadata Editor", ->
verifyEntry(0, 'Display Name', 'text')
verifyEntry(1, 'Inputs', 'number')
- verifyEntry(2, 'List', 'text')
+ verifyEntry(2, 'List', '')
verifyEntry(3, 'Show Answer', 'select-one')
verifyEntry(4, 'Unknown', 'text')
verifyEntry(5, 'Weight', 'number')
@@ -319,9 +320,7 @@ describe "Test Metadata Editor", ->
beforeEach ->
listModel = new CMS.Models.Metadata(listEntry)
@listView = new CMS.Views.Metadata.List({model: listModel})
-
- it "uses a text input type", ->
- assertInputType(@listView, 'text')
+ @el = @listView.$el
it "returns the initial value upon initialization", ->
assertValueInView(@listView, ['the first display value', 'the second'])
@@ -337,10 +336,24 @@ describe "Test Metadata Editor", ->
it "can add an entry", ->
expect(@listView.model.get('value').length).toEqual(2)
- @listView.$el.find('.setting-add').click()
- expect(@listView.$el.find('input.input').length).toEqual(3)
+ @el.find('.create-setting').click()
+ expect(@el.find('input.input').length).toEqual(3)
it "can remove an entry", ->
expect(@listView.model.get('value').length).toEqual(2)
- @listView.$el.find('.setting-remove').first().click()
+ @el.find('.remove-setting').first().click()
expect(@listView.model.get('value').length).toEqual(1)
+
+ it "only allows one blank entry at a time", ->
+ expect(@el.find('input').length).toEqual(2)
+ @el.find('.create-setting').click()
+ @el.find('.create-setting').click()
+ expect(@el.find('input').length).toEqual(3)
+
+ it "re-enables the add setting button after entering a new value", ->
+ expect(@el.find('input').length).toEqual(2)
+ @el.find('.create-setting').click()
+ expect(@el.find('.create-setting')).toHaveClass('is-disabled')
+ @el.find('input').last().val('third setting')
+ @el.find('input').last().trigger('input')
+ expect(@el.find('.create-setting')).not.toHaveClass('is-disabled')
diff --git a/cms/static/js/views/metadata_editor_view.js b/cms/static/js/views/metadata_editor_view.js
index bf74c4212f..f8c093e62a 100644
--- a/cms/static/js/views/metadata_editor_view.js
+++ b/cms/static/js/views/metadata_editor_view.js
@@ -320,6 +320,7 @@ CMS.Views.Metadata.List = CMS.Views.Metadata.AbstractEditor.extend({
"click .setting-clear" : "clear",
"keypress .setting-input" : "showClearButton",
"change input" : "updateModel",
+ "input input" : "enableAdd",
"click .create-setting" : "addEntry",
"click .remove-setting" : "removeEntry"
},
@@ -353,6 +354,7 @@ CMS.Views.Metadata.List = CMS.Views.Metadata.AbstractEditor.extend({
// change event
var list = this.model.get('value') || [];
this.setValueInEditor(list.concat(['']))
+ this.$el.find('.create-setting').addClass('is-disabled');
},
removeEntry: function(event) {
@@ -360,5 +362,10 @@ CMS.Views.Metadata.List = CMS.Views.Metadata.AbstractEditor.extend({
var entry = $(event.currentTarget).siblings().val();
this.setValueInEditor(_.without(this.model.get('value'), entry));
this.updateModel();
+ this.$el.find('.create-setting').removeClass('is-disabled');
+ },
+
+ enableAdd: function() {
+ this.$el.find('.create-setting').removeClass('is-disabled');
}
});
diff --git a/cms/templates/js/metadata-list-entry.underscore b/cms/templates/js/metadata-list-entry.underscore
index d4f79e2e17..8b3d99c507 100644
--- a/cms/templates/js/metadata-list-entry.underscore
+++ b/cms/templates/js/metadata-list-entry.underscore
@@ -6,7 +6,7 @@
- Add <%= model.get('display_name')%>
+ <%= gettext("Add") %> <%= model.get('display_name')%>