spec/unit/screen_helpers_spec.rb in ProMotion-2.0.1 vs spec/unit/screen_helpers_spec.rb in ProMotion-2.1.0.beta1
- old
+ new
@@ -98,17 +98,17 @@
@second_vc = UIViewController.alloc.initWithNibName(nil, bundle:nil)
end
it "#push_view_controller should use the default navigation controller if not provided" do
vcs = @screen.navigationController.viewControllers
- @screen.push_view_controller @second_vc
+ @screen.push_view_controller @second_vc, @screen.navigationController, false
@screen.navigationController.viewControllers.count.should == vcs.count + 1
end
it "#push_view_controller should use a provided navigation controller" do
second_nav_controller = UINavigationController.alloc.initWithRootViewController @screen
- @screen.push_view_controller @second_vc, second_nav_controller
+ @screen.push_view_controller @second_vc, second_nav_controller, false
second_nav_controller.viewControllers.count.should == 2
end
it "should return the application delegate" do
@screen.app_delegate.should == UIApplication.sharedApplication.delegate
@@ -121,17 +121,18 @@
it "should create an instance from class when opening a new screen" do
@screen.send(:set_up_screen_for_open, BasicScreen).should.be.instance_of BasicScreen
end
it "should apply properties when opening a new screen" do
- new_screen = @screen.send(:set_up_screen_for_open, BasicScreen, { title: 'Some Title', modal: true, hide_tab_bar: true, nav_bar: true })
+ new_screen = @screen.send(:set_up_screen_for_open, BasicScreen, { title: 'Some Title', modal: true, hide_tab_bar: true, nav_bar: true, hide_nav_bar: true })
new_screen.parent_screen.should == @screen
new_screen.title.should == 'Some Title'
new_screen.modal?.should == true
new_screen.hidesBottomBarWhenPushed.should == true
new_screen.nav_bar?.should == true
+ new_screen.navigationController.isNavigationBarHidden.should == true
end
it "should present the navigationController when showing a modal screen" do
new_screen = @screen.send(:set_up_screen_for_open, BasicScreen, modal: true)
@@ -197,11 +198,11 @@
screen.should.be.kind_of BasicScreen
end
it "should ignore its own navigation controller if current screen has a navigation controller" do
basic = BasicScreen.new(nav_bar: true) # creates a dangling nav_bar that will be discarded.
- screen = @screen.open basic
+ screen = @screen.open basic, animated: false
screen.should.be.kind_of BasicScreen
basic.navigationController.should == @screen.navigationController
end
it "should open the provided view controller as root view if no other conditions are met" do
@@ -299,16 +300,16 @@
@screen.close({ key: :value, to_screen: first_screen })
end
it "#send_on_return should pass args to the first screen with :root" do
first_screen = HomeScreen.new(nav_bar: true)
- second_screen = first_screen.open(BasicScreen)
- second_screen.open @screen
+ second_screen = first_screen.open(BasicScreen, animated: false)
+ second_screen.open @screen, animated: false
second_screen.stub!(:on_return) { |args| should.flunk "shouldn't call on_return on second_screen!" }
first_screen.mock!(:on_return) { |args| args[:key].should == :value }
- @screen.close({ key: :value, to_screen: :root })
+ @screen.close key: :value, to_screen: :root, animated: false
end
end
end