spec/functional/func_screen_spec.rb in ProMotion-1.2.1 vs spec/functional/func_screen_spec.rb in ProMotion-2.0.0.rc1
- old
+ new
@@ -2,42 +2,38 @@
tests PM::Screen
# Override controller to properly instantiate
def controller
rotate_device to: :portrait, button: :bottom
- @controller ||= FunctionalScreen.new(nav_bar: true)
- @root_screen = @controller
+ @controller = FunctionalScreen.new(nav_bar: true)
@controller.navigationController
end
- after do
- @controller = nil
- @root_screen = nil
- end
-
it "should have a navigation bar" do
- view("Functional").should.be.kind_of UINavigationItemView
+ 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
- @root_screen.set_nav_bar_button :left, title: "Cool", action: :triggered_button
+ @controller.set_nav_bar_button :left, title: "Cool", action: :triggered_button
tap("Cool")
- @root_screen.button_was_triggered.should.be.true
+ @controller.button_was_triggered.should.be.true
end
it "should allow setting a right nav bar button" do
- @root_screen.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
+ @controller.set_nav_bar_button :right, title: "Cool2", action: :triggered_button
tap("Cool2")
- @root_screen.button_was_triggered.should.be.true
+ @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
- @root_screen.open BasicScreen
+ @controller.open BasicScreen
wait 0.5 do
view("Basic").should.be.kind_of UINavigationItemView
view("Functional").should.be.kind_of UINavigationItemButtonView
@@ -50,35 +46,35 @@
end
end
it "should push another screen with animation by default" do
- basic = @root_screen.open BasicScreen
+ 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 = @root_screen.open BasicScreen, animated: true
+ 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 = @root_screen.open BasicScreen, animated: false
+ basic = @controller.open BasicScreen, animated: false
wait 0.5 do
basic.animation_ts.should.be < 0.2
end
end
it "should allow opening and closing a modal screen" do
@basic = BasicScreen.new(nav_bar: true)
wait 0.1 do
- @root_screen.open_modal @basic
+ @controller.open_modal @basic
wait 0.6 do
view("Basic").should.be.kind_of UINavigationItemView
@basic.close
@@ -92,10 +88,10 @@
end
end
it "should fire the will_present, on_present, will_dismiss, and on_dismiss_methods" do
@presented_screen = PresentScreen.new
- @root_screen.open @presented_screen
+ @controller.open @presented_screen
wait 0.6 do
@presented_screen.will_present_fired.should == true
@presented_screen.on_present_fired.should == true
@presented_screen.will_dismiss_fired.should.not == true