Merge pull request #128 from clearsightstudio/bugfix/issue_127

Fix for issue #127 reported by @markrickert
This commit is contained in:
Jamon Holmgren
2013-06-07 08:56:52 -07:00
5 changed files with 107 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
PATH
remote: .
specs:
ProMotion (0.7.2)
ProMotion (0.7.3)
GEM
remote: https://rubygems.org/

View File

@@ -14,6 +14,21 @@ module ProMotion
end
alias :makeRefreshable :make_refreshable
def start_refreshing
return unless @refresh_control
@refresh_control.beginRefreshing
end
alias :begin_refreshing :start_refreshing
def end_refreshing
return unless @refresh_control
@refresh_control.attributedTitle = NSAttributedString.alloc.initWithString(sprintf(@updated_format, Time.now.strftime(@updated_time_format)))
@refresh_control.endRefreshing
end
alias :stop_refreshing :end_refreshing
######### iOS methods, headless camel case #######
# UIRefreshControl Delegates
@@ -26,17 +41,5 @@ module ProMotion
end
end
def start_refreshing
return unless @refresh_control
@refresh_control.beginRefreshing
end
def end_refreshing
return unless @refresh_control
@refresh_control.attributedTitle = NSAttributedString.alloc.initWithString(sprintf(@updated_format, Time.now.strftime(@updated_time_format)))
@refresh_control.endRefreshing
end
end
end

View File

@@ -49,6 +49,7 @@ module ProMotion
@promotion_table_data.stop_searching
@promotion_table_data_data = nil
self.table_view.setScrollEnabled true
self.table_view.reloadData
end
def searchDisplayControllerWillBeginSearch(controller)

View File

@@ -0,0 +1,32 @@
describe "Searchable table spec" do
tests TableScreenSearchable
# Override controller to properly instantiate
def controller
@controller ||= TableScreenSearchable.new(nav_bar: true)
@controller.on_load
@controller.main_controller
end
it "should be rotated in portrait mode" do
rotate_device to: :portrait, button: :bottom
true.should == true
end
it "should show all 50 states" do
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 50
end
it "should allow searching for all the 'New' states" do
@controller.searchDisplayController(@controller, shouldReloadTableForSearchString:"New")
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 4
end
it "should allow ending searches" do
@controller.searchDisplayController(@controller, shouldReloadTableForSearchString:"North")
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 2
@controller.searchDisplayControllerWillEndSearch(@controller)
@controller.tableView(@controller.tableView, numberOfRowsInSection:0).should == 50
end
end

View File

@@ -1,5 +1,62 @@
class TableScreenSearchable < TestTableScreen
searchable
def table_data
@search_table_data ||= [{
cells: [
{ title: "Alabama" },
{ title: "Alaska" },
{ title: "Arizona" },
{ title: "Arkansas" },
{ title: "California" },
{ title: "Colorado" },
{ title: "Connecticut" },
{ title: "Delaware" },
{ title: "Florida" },
{ title: "Georgia" },
{ title: "Hawaii" },
{ title: "Idaho" },
{ title: "Illinois" },
{ title: "Indiana" },
{ title: "Iowa" },
{ title: "Kansas" },
{ title: "Kentucky" },
{ title: "Louisiana" },
{ title: "Maine" },
{ title: "Maryland" },
{ title: "Massachusetts" },
{ title: "Michigan" },
{ title: "Minnesota" },
{ title: "Mississippi" },
{ title: "Missouri" },
{ title: "Montana" },
{ title: "Nebraska" },
{ title: "Nevada" },
{ title: "New Hampshire" },
{ title: "New Jersey" },
{ title: "New Mexico" },
{ title: "New York" },
{ title: "North Carolina" },
{ title: "North Dakota" },
{ title: "Ohio" },
{ title: "Oklahoma" },
{ title: "Oregon" },
{ title: "Pennsylvania" },
{ title: "Rhode Island" },
{ title: "South Carolina" },
{ title: "South Dakota" },
{ title: "Tennessee" },
{ title: "Texas" },
{ title: "Utah" },
{ title: "Vermont" },
{ title: "Virginia" },
{ title: "Washington" },
{ title: "West Virginia" },
{ title: "Wisconsin" },
{ title: "Wyoming" }
]
}]
end
end
end