spec/features/screens/open_screen.rb in motion-prime-0.9.6 vs spec/features/screens/open_screen.rb in motion-prime-0.9.7
- old
+ new
@@ -1,10 +1,10 @@
describe "open screen" do
describe "from app delegate with default options" do
before do
App.delegate.open_screen :sample
- @controller = App.delegate.window.rootViewController
+ @controller = App.delegate.content_controller
end
it "should open with navigation by default" do
@controller.is_a?(UINavigationController).should.be.true
end
@@ -23,17 +23,29 @@
@controller.is_a?(SampleScreen).should.be.true
@controller.visible?.should.be.true
end
end
+ describe "from app delegate with action" do
+ before do
+ App.delegate.open_screen 'tasks#new'
+ @controller = App.delegate.content_controller.childViewControllers.last
+ end
+
+ it "should open screen with action" do
+ @controller.is_a?(TasksScreen).should.be.true
+ @controller.title.should == 'New Task'
+ end
+ end
+
describe "from another screen with navigation: true" do
before do
@parent_screen = SampleScreen.new(navigation: true)
@child_screen = SampleScreen.new(navigation: true)
App.delegate.open_screen @parent_screen
@parent_screen.open_screen @child_screen
- @controller = App.delegate.window.rootViewController
+ @controller = App.delegate.content_controller
# we should call it because will_appear will happen async
@child_screen.will_appear
@parent_screen.will_disappear
end
\ No newline at end of file