mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-25 11:56:02 +08:00
Add tests for deleting with a swipe and hitting the delete button.
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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" }
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user