Sha256: c706a84a1203f13be89779dab511ed6370837194b6590873d308abf79cc37572

Contents?: true

Size: 1.2 KB

Versions: 5

Compression:

Stored size: 1.2 KB

Contents

describe "tab bar functionality" do

  before do
    @app = TestDelegate.new

    @tab_1 = TabScreen.new
    @tab_2 = BasicScreen.new
    @tab_3 = HomeScreen.new
    @tab_4 = TestTableScreen.new

    @tab_bar = @app.open_tab_bar @tab_1, @tab_2, @tab_3, @tab_4
  end

  after do

  end

  it "should have created a tab bar with four items" do
    @tab_bar.should != nil
    @tab_bar.should.be.kind_of(UITabBarController)
    @tab_bar.viewControllers.length.should == 4
  end

  it "should have set a custom tab bar item" do
    @tab_bar.tabBar.items.first.title.should == "Tab Item"
  end

  it "should have set the others to their respective titles" do
    @tab_bar.tabBar.items[1].title.should == "Basic"
    @tab_bar.tabBar.items[2].title.should == "Home"
    @tab_bar.tabBar.items[3].title.should == "Test tab title"
  end

  it "should allow changing the tab bar item with set_tab_bar_item" do
    @tab_1.set_tab_bar_item title: "Custom", item: "test.jpeg"
    @tab_bar.tabBar.items.first.title.should == "Custom"
  end

  it "should allow replacing a view controller with `open`" do
    new_screen = BasicScreen.new
    @tab_4.open new_screen, in_tab: "Home"
    @tab_bar.viewControllers[2].should == new_screen
  end

end


Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ProMotion-2.2.2 spec/unit/tab_spec.rb
ProMotion-2.2.1 spec/unit/tab_spec.rb
ProMotion-2.2.0 spec/unit/tab_spec.rb
ProMotion-2.1.0 spec/unit/tab_spec.rb
ProMotion-2.1.0.beta1 spec/unit/tab_spec.rb