Permalink
Browse files

Add feature for reordering.

  • Loading branch information...
1 parent f0405f9 commit d9f0da3abd3da8c318271f7ffa5113fc145b162b @jgarber committed Sep 1, 2009
Showing with 18 additions and 1 deletion.
  1. +8 −1 features/attachments.feature
  2. +10 −0 features/step_definitions/attachment_steps.rb
@@ -32,4 +32,11 @@ Feature: attachments
When I edit the page
And I delete the first attachment
And I save
- Then the page should have 1 attachment
+ Then the page should have 1 attachment
+
+ Scenario: reorder attachments
+ Given I have a page with 2 attachments
+ When I edit the page
+ And I drag attachment 2 above attachment 1
+ And I save
+ Then attachment 2 should be in position 1
@@ -37,6 +37,12 @@
selenium.click "xpath=id('attachment_list')/li[1]//img[@alt='Delete']"
end
+When /^I drag attachment 2 above attachment 1$/ do
+ @attachment = @page.attachments[1]
+ @attachment.position.should == 2
+ selenium.dragdrop("id=attachment_#{@attachment.id}", "0, -200")
+end
+
When /^I save$/ do
click_button "Save"
response.should_not contain("errors")
@@ -49,3 +55,7 @@
Then /^the page should have (\d+) attachment(?:s)?$/ do |number|
@page.reload.attachments.length.should == number.to_i
end
+
+Then /^attachment 2 should be in position 1$/ do
+ @attachment.reload.position.should == 1
+end

0 comments on commit d9f0da3

Please sign in to comment.