mirror of
https://github.com/zhigang1992/ProMotion.git
synced 2026-05-28 23:50:54 +08:00
implemented and tested "close to_screen: :root"
Also accepts other close parameters like animated:true|false
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user