spec/lib/under_os/ui/input_spec.rb in under-os-1.1.0 vs spec/lib/under_os/ui/input_spec.rb in under-os-1.2.0

- old
+ new

@@ -14,10 +14,15 @@ it "should assign correct tag name" do @input.tagName.should == 'INPUT' end + it "should accept the 'name' option" do + input = UnderOs::UI::Input.new(name: 'some_name') + input.name.should == 'some_name' + end + it "should accept the 'value' option" do input = UnderOs::UI::Input.new(value: 'boo hoo') input.value.should == 'boo hoo' end @@ -30,26 +35,33 @@ input = UnderOs::UI::Input.new(keyboard: 'email') input.keyboard.should == :email end end - # describe '#type' do - # it "should handle the 'password' type correctly" do - # @input.type = 'password' - # @input._.secureTextEntry.should == true - # end + describe '#type' do + # it "should handle the 'password' type correctly" do + # @input.type = 'password' + # @input._.secureTextEntry.should == true + # end - # it "should convert the input type back" do - # @input.type = 'password' - # @input.type.should == 'password' - # end + # it "should convert the input type back" do + # @input.type = 'password' + # @input.type.should == :password + # end - # it "should return 'text' by default" do - # @input.type.should == 'text' - # end - # end + it "should return 'text' by default" do + @input.type.should == :text + end + end + describe '#name' do + it "should assign the name to an input field" do + @input.name = 'newname' + @input.name.should == 'newname' + end + end + describe '#value' do it "should assign the value to the wrapped element" do @input.value = 'new value' @input._.text.should == 'new value' end @@ -69,9 +81,29 @@ end it "should convert the keybaord types back to symbolic name in the getter" do @input.keyboard = :email @input.keyboard.should == :email + end + end + + describe '#disabled' do + it "returns 'false' by default" do + @input.disabled.should == false + end + + it "reads the value right of the ios entity" do + @input._.enabled = false + @input.disabled.should == true + end + + it "allows to disable the inputs" do + @input.disabled = true + @input._.isEnabled.should == false + end + + it "has a ruby-style alias" do + @input.disabled?.should == false end end end