Sha256: 19b9e51e7a5b148f9c915b1afc228431c8001024911649ad2633d0cce3964ab5

Contents?: true

Size: 1.58 KB

Versions: 7

Compression:

Stored size: 1.58 KB

Contents

describe "open screen" do
  describe "from app delegate with default options" do
    before do
      App.delegate.open_screen :sample
      @controller = App.delegate.window.rootViewController
    end
    it "should open with navigation by default" do
      @controller.is_a?(UINavigationController).should.be.true
    end

    it "should open screen" do
      @controller.childViewControllers.first.is_a?(SampleScreen).should.be.true
      @controller.childViewControllers.first.visible?.should.be.true
    end
  end

  describe "from app delegate with navigation false" do
    before do
      App.delegate.open_screen :sample, navigation: false
      @controller = App.delegate.window.rootViewController
    end
    it "should open screen" do
      @controller.is_a?(SampleScreen).should.be.true
      @controller.visible?.should.be.true
    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

      # we should call it because will_appear will happen async
      @child_screen.will_appear
      @parent_screen.will_disappear
    end

    it "should open child screen navigational" do
      @controller.childViewControllers.last.should == @child_screen
      @child_screen.visible?.should.be.true
    end

    it "should make parent screen invisible" do
      @parent_screen.visible?.should.be.false
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
motion-prime-0.9.6 spec/features/screens/open_screen.rb
motion-prime-0.9.5 spec/features/screens/open_screen.rb
motion-prime-0.9.4 spec/features/screens/open_screen.rb
motion-prime-0.9.3 spec/features/screens/open_screen.rb
motion-prime-0.9.2 spec/features/screens/open_screen.rb
motion-prime-0.9.1 spec/features/screens/open_screen.rb
motion-prime-0.9.0 spec/features/screens/open_screen.rb