implemented and tested "close to_screen: :root"

Also accepts other close parameters like animated:true|false
This commit is contained in:
Mark Rickert
2013-06-28 15:29:48 -04:00
parent b482a15724
commit ac177d82fb
2 changed files with 4 additions and 6 deletions

View File

@@ -40,10 +40,6 @@ module ProMotion
app_delegate.open_root_screen(screen)
end
def pop_to_root(animated = false)
self.navigation_controller.popToRootViewControllerAnimated animated
end
def open_modal(screen, args = {})
open screen, args.merge({ modal: true })
end
@@ -154,7 +150,9 @@ module ProMotion
def close_nav_screen(args={})
args[:animated] = true unless args.has_key?(:animated)
if args[:to_screen] && args[:to_screen].is_a?(UIViewController)
if args[:to_screen] == :root
self.navigation_controller.popToRootViewControllerAnimated args[:animated]
elsif args[:to_screen] && args[:to_screen].is_a?(UIViewController)
self.parent_screen = args[:to_screen]
self.navigation_controller.popToViewController(args[:to_screen], animated: args[:animated])
else

View File

@@ -100,7 +100,7 @@ describe "ProMotion::Screen functional" do
@controller.open BasicScreen.new
wait 0.6 do
@controller.navigation_controller.viewControllers.count.should == 4
@controller.pop_to_root true
@controller.close to_screen: :root
wait 0.6 do
@controller.navigation_controller.viewControllers.count.should == 1
@controller.navigation_controller.topViewController.should == @root_vc