Front-end work for duplicating components on the unit page.

STUD-1186
This commit is contained in:
cahrens
2014-01-16 16:09:46 -05:00
parent 58e6f60ebf
commit b5726a6889
13 changed files with 262 additions and 15 deletions

View File

@@ -101,3 +101,14 @@ Feature: CMS.Component Adding
And I add a "Blank Advanced Problem" "Advanced Problem" component
And I delete all components
Then I see no components
Scenario: I can duplicate a component
Given I am in Studio editing a new unit
And I add a "Blank Common Problem" "Problem" component
And I add a "Multiple Choice" "Problem" component
And I duplicate the "0" component
Then I see a Problem component with display name "Duplicate of 'Blank Common Problem'" in position "1"
And I reload the page
Then I see a Problem component with display name "Blank Common Problem" in position "0"
And I see a Problem component with display name "Duplicate of 'Blank Common Problem'" in position "1"
And I see a Problem component with display name "Multiple Choice" in position "2"

View File

@@ -132,3 +132,19 @@ def delete_one_component(step):
def edit_and_save_component(step):
world.css_click('.edit-button')
world.css_click('.save-button')
@step(u'I duplicate the "([^"]*)" component$')
def duplicated_component(step, index):
duplicate_btn_css = 'a.duplicate-button'
world.css_click(duplicate_btn_css, int(index))
@step(u'I see a Problem component with display name "([^"]*)" in position "([^"]*)"$')
def see_component_in_position(step, display_name, index):
component_css = 'section.xmodule_CapaModule'
def find_problem(_driver):
return world.css_text(component_css, int(index)).startswith(display_name.upper())
world.wait_for(find_problem, timeout_msg='Did not find the duplicated problem')