spec/unit/screen_spec.rb in ProMotion-1.2.1 vs spec/unit/screen_spec.rb in ProMotion-2.0.0.rc1

- old
+ new

@@ -7,11 +7,11 @@ @screen.on_load end it "should store title" do - HomeScreen.get_title.should == 'Home' + HomeScreen.title.should == 'Home' end it "should set default title on new instances" do @screen.title.should == "Home" end @@ -21,37 +21,32 @@ @screen.title.should == 'instance method' end it "should not let the instance reset the default title" do @screen.title = "instance method" - HomeScreen.get_title.should != 'instance method' + HomeScreen.title.should != 'instance method' end - it "should set the tab bar item with a system icon" do - @screen.set_tab_bar_item system_icon: :contacts + it "should set the tab bar item with a system item" do + @screen.set_tab_bar_item system_item: :contacts comparison = UITabBarItem.alloc.initWithTabBarSystemItem(UITabBarSystemItemContacts, tag: 0) @screen.tabBarItem.systemItem.should == comparison.systemItem @screen.tabBarItem.tag.should == comparison.tag @screen.tabBarItem.image.should == comparison.image end - it "should set the tab bar item with a custom icon and title" do - @screen.set_tab_bar_item title: "My Screen", icon: "list" + it "should set the tab bar item with a custom item and title" do + @screen.set_tab_bar_item title: "My Screen", item: "list" - icon_image = UIImage.imageNamed("list") - comparison = UITabBarItem.alloc.initWithTitle("My Screen", image: icon_image, tag: 0) + item_image = UIImage.imageNamed("list") + comparison = UITabBarItem.alloc.initWithTitle("My Screen", image: item_image, tag: 0) @screen.tabBarItem.systemItem.should == comparison.systemItem @screen.tabBarItem.tag.should == comparison.tag @screen.tabBarItem.image.should == comparison.image end - it "should store debug mode" do - HomeScreen.debug_mode = true - HomeScreen.debug_mode.should == true - end - it "#modal? should be true" do @screen.modal?.should == true end it "should know it is the first screen" do @@ -149,11 +144,11 @@ end describe "bar button behavior" do describe "system bar buttons" do before do - @screen.set_nav_bar_right_button nil, action: :add_something, system_icon: UIBarButtonSystemItemAdd + @screen.set_nav_bar_button :right, title: nil, action: :add_something, system_item: UIBarButtonSystemItemAdd end it "has a right bar button item of the correct type" do @screen.navigationItem.rightBarButtonItem.should.be.instance_of UIBarButtonItem end @@ -161,13 +156,23 @@ it "is an add button" do @screen.navigationItem.rightBarButtonItem.action.should == :add_something end end + describe "bar button tint colors" do + before do + @screen.set_nav_bar_button :right, title: nil, action: :add_something, system_item: UIBarButtonSystemItemAdd, tint_color: UIColor.blueColor + end + + it "sets the tint color" do + CGColorEqualToColor(@screen.navigationItem.rightBarButtonItem.tintColor, UIColor.blueColor).should == true + end + end + describe 'titled bar buttons' do before do - @screen.set_nav_bar_right_button "Save", action: :save_something, style: UIBarButtonItemStyleDone + @screen.set_nav_bar_button :right, title: "Save", action: :save_something, style: UIBarButtonItemStyleDone end it "has a right bar button item of the correct type" do @screen.navigationItem.rightBarButtonItem.should.be.instance_of UIBarButtonItem end @@ -182,11 +187,11 @@ end describe 'image bar buttons' do before do @image = UIImage.alloc.init - @screen.set_nav_bar_right_button @image, action: :save_something, style: UIBarButtonItemStyleDone + @screen.set_nav_bar_button :right, title: @image, action: :save_something, style: UIBarButtonItemStyleDone end it "has a right bar button item of the correct type" do @screen.navigationItem.rightBarButtonItem.should.be.instance_of UIBarButtonItem end @@ -254,6 +259,5 @@ screen.navigationController.toolbarHidden?.should == true screen.set_toolbar_button([{title: "Testing Toolbar"}], false) screen.navigationController.toolbarHidden?.should == false end end -