mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-25 20:05:20 +08:00
Fixing issue #109 - iOS 6 doesn't call screen shouldAutorotate when in navigation bar. Added tests too.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
PATH
|
||||
remote: .
|
||||
specs:
|
||||
ProMotion (0.7.0)
|
||||
ProMotion (0.7.1)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
module ProMotion
|
||||
class NavigationController < UINavigationController
|
||||
def shouldAutorotate
|
||||
visibleViewController.shouldAutorotate
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user