Fixing issue #109 - iOS 6 doesn't call screen shouldAutorotate when in navigation bar. Added tests too.

This commit is contained in:
Jamon Holmgren
2013-06-04 12:37:53 -07:00
parent 5215c6b949
commit a192c00d07
3 changed files with 18 additions and 2 deletions

View File

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

View File

@@ -1,4 +1,7 @@
module ProMotion
class NavigationController < UINavigationController
def shouldAutorotate
visibleViewController.shouldAutorotate
end
end
end
end

View File

@@ -43,6 +43,19 @@ describe "screen properties" do
@screen.should_autorotate.should == true
end
# Issue https://github.com/clearsightstudio/ProMotion/issues/109
it "#should_autorotate should fire when shouldAutorotate fires when in a navigation bar" do
parent_screen = BasicScreen.new(nav_bar: true)
parent_screen.open @screen
@screen.mock!(:should_autorotate) { true.should == true }
parent_screen.navigationController.shouldAutorotate
end
# <= iOS 5 only
it "#should_rotate(orientation) should fire when shouldAutorotateToInterfaceOrientation(orientation) fires" do
@screen.mock!(:should_rotate) { |orientation| orientation.should == UIInterfaceOrientationMaskPortrait }
@screen.shouldAutorotateToInterfaceOrientation(UIInterfaceOrientationMaskPortrait)
end
describe "iOS lifecycle methods" do