Make ordinal in duplication statement friendlier.

This commit is contained in:
cahrens
2014-01-22 14:11:23 -05:00
parent a1cb0a128b
commit 3eb0018629
2 changed files with 9 additions and 3 deletions

View File

@@ -106,7 +106,7 @@ Feature: CMS.Component Adding
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
And I duplicate the first 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"

View File

@@ -134,8 +134,14 @@ def edit_and_save_component(step):
world.css_click('.save-button')
@step(u'I duplicate the "([^"]*)" component$')
def duplicated_component(step, index):
@step(u'I duplicate the (first|second|third) component$')
def duplicated_component(step, ordinal):
ord_map = {
"first": 0,
"second": 1,
"third": 2,
}
index = ord_map[ordinal]
duplicate_btn_css = 'a.duplicate-button'
world.css_click(duplicate_btn_css, int(index))