spec/functional/func_screen_spec.rb in ProMotion-2.2.1 vs spec/functional/func_screen_spec.rb in ProMotion-2.2.2
- old
+ new
@@ -8,70 +8,10 @@
rotate_device to: :portrait, button: :bottom
@controller = FunctionalScreen.new(nav_bar: true)
@controller.navigationController
end
- it "should have a navigation bar" do
- wait 0.5 do
- view("Functional").should.be.kind_of UINavigationItemView
- end
- end
-
- it "should allow a string title" do
- views(UINavigationItemView).include?(UIImageView).should.not.be.true
- end
-
- it "should allow setting a left nav bar button" do
- @controller.set_nav_bar_button :left, title: "Cool", action: :triggered_button
- tap("Cool")
- @controller.button_was_triggered.should.be.true
- end
-
- it "should allow setting a right nav bar button" do
- @controller.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
- tap("Cool2")
- @controller.button_was_triggered.should.be.true
- end
-
- it "should allow opening another screen in the same nav bar and have a back button that is operational" do
- @controller.open BasicScreen
-
- wait 0.5 do
-
- view("Basic").should.be.kind_of UINavigationItemView
- view("Functional").should.be.kind_of UINavigationItemButtonView
-
- tap("Functional")
- wait 0.5 do
- view("Functional").should.be.kind_of UINavigationItemView
- end
-
- end
-
- end
-
- it "should push another screen with animation by default" do
- basic = @controller.open BasicScreen
- wait 0.5 do
- basic.animation_ts.should.be > 0.2
- end
- end
-
- it "should push another screen with animation when animated: true" do
- basic = @controller.open BasicScreen, animated: true
- wait 0.5 do
- basic.animation_ts.should.be > 0.2
- end
- end
-
- it "should push another screen without animation when animated: false" do
- basic = @controller.open BasicScreen, animated: false
- wait 0.5 do
- basic.animation_ts.should.be < 0.2
- end
- end
-
it "should call the on_back method on the root controller when navigating back" do
presented_screen = PresentScreen.new
@controller.open presented_screen, animated: false
@controller.navigationController.viewControllers.should == [ @controller, presented_screen ]
presented_screen.close animated: false
@@ -87,43 +27,25 @@
child_screen.on_back_fired.should == true
child_screen.close animated: false
@controller.on_back_fired.should == true
end
- it "should allow opening and closing a modal screen" do
- @basic = BasicScreen.new(nav_bar: true)
- wait 0.1 do
- @controller.open_modal @basic
-
- wait 0.6 do
-
- view("Basic").should.be.kind_of UINavigationItemView
- @basic.close
-
- wait 0.6 do
- @basic = nil
- view("Functional").should.be.kind_of UINavigationItemView
- end
-
- end
- end
- end
-
it "should fire the will_present, on_present, will_dismiss, and on_dismiss_methods" do
@presented_screen = PresentScreen.new
- @controller.open @presented_screen
- wait 0.6 do
+ @controller.open @presented_screen, animated: false
+
+ wait 0.01 do
@presented_screen.will_present_fired.should == true
@presented_screen.on_present_fired.should == true
@presented_screen.will_dismiss_fired.should.not == true
@presented_screen.on_dismiss_fired.should.not == true
@presented_screen.reset
+ @presented_screen.close animated: false
- @presented_screen.close
- wait 0.6 do
+ wait 0.01 do
@presented_screen.will_dismiss_fired.should == true
@presented_screen.on_dismiss_fired.should == true
@presented_screen.will_present_fired.should.not == true
@presented_screen.on_present_fired.should.not == true
@@ -134,23 +56,22 @@
end
it "should pop to the root view controller" do
@root_vc = @controller.navigationController.visibleViewController
@controller.navigationController.viewControllers.count.should == 1
- @controller.open BasicScreen.new
- wait 0.6 do
- @controller.open BasicScreen.new
- wait 0.6 do
- @controller.open BasicScreen.new
- wait 0.6 do
+ @controller.open BasicScreen.new, animated: false
+ wait 0.01 do
+ @controller.open BasicScreen.new, animated: false
+ wait 0.01 do
+ @controller.open BasicScreen.new, animated: false
+ wait 0.01 do
@controller.navigationController.viewControllers.count.should == 4
- @controller.close to_screen: :root
- wait 0.6 do
+ @controller.close to_screen: :root, animated: false
+ wait 0.01 do
@controller.navigationController.viewControllers.count.should == 1
@controller.navigationController.topViewController.should == @root_vc
end
end
end
end
end
-
end