spec/helpers/table_screen.rb in ProMotion-0.7.8 vs spec/helpers/table_screen.rb in ProMotion-1.0.0
- old
+ new
@@ -1,8 +1,8 @@
-class TestTableScreen < ProMotion::SectionedTableScreen
+class TestTableScreen < ProMotion::TableScreen
- attr_accessor :tap_counter
+ attr_accessor :tap_counter, :cell_was_deleted
def promotion_table_data
@promotion_table_data
end
@@ -15,11 +15,12 @@
title: "Your Account",
cells: [
{ 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: "A non-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" }
]
}, {
title: "App Stuff",
@@ -81,9 +82,17 @@
if args[:animated]
delete_row(NSIndexPath.indexPathForRow(args[:row], inSection:args[:section]))
else
@data[args[:section]][:cells].delete_at args[:row]
update_table_data
+ end
+ end
+
+ def on_cell_deleted(cell)
+ if cell[:title] == "A non-deletable blank row"
+ false
+ else
+ self.cell_was_deleted = true
end
end
def increment_counter
self.tap_counter = self.tap_counter + 1