Add tests for deleting with a swipe and hitting the delete button.

This commit is contained in:
Mark Rickert
2013-07-02 19:46:27 -04:00
parent 2294850103
commit 89fb30b42b
2 changed files with 19 additions and 1 deletions

View File

@@ -49,6 +49,24 @@ describe "ProMotion::TestTableScreen functionality" do
end
end
# TODO: Why is it so complicated to find the delete button??
it "should use editing_style to delete the table row" do
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 6
flick("Just another deletable blank row", :to => :left)
wait 0.25 do
# Tap the delete button
view('Just another deletable blank row').superview.superview.subviews.each do |subview|
if subview.class == UITableViewCellDeleteConfirmationControl
tap subview
wait 0.25 do
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 5
end
end
end
end
end
it "should call a method when the switch is flipped" do
@controller.scroll_to_bottom
tap "switch_1"

View File

@@ -17,7 +17,7 @@ class TestTableScreen < ProMotion::TableScreen
{ title: "Increment", action: :increment_counter_by, arguments: {number: 3} },
{ title: "Add New Row", action: :add_tableview_row },
{ title: "Delete the row below", action: :delete_cell, arguments: {section: 0, row:3} },
{ title: "Just another blank row" },
{ title: "Just another deletable blank row", editing_style: :delete },
{ title: "Delete the row below with an animation", action: :delete_cell, arguments: {animated: true, section: 0, row:5 } },
{ title: "Just another blank row" }
]