Sha256: 5074507031544a71bd96f9c79038ffd8ac61e39937c33ee99b5c2061c67534a8

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

describe "UnderOs::UI::Button" do
  before do
    @button = UnderOs::UI::Button.new(text: "Hello")
  end

  describe "constructor" do
    it "builds an instance of the UnderOs::UI::Button" do
      @button.class.should == UnderOs::UI::Button
    end

    it "wraps an UIButton instance" do
      @button._.class.should == UIButton
    end

    it "assigns the BUTTON tag after it" do
      @button.tagName.should == "BUTTON"
    end
  end

  describe "#text" do
    it "returns the button's label text" do
      @button.text.should == "Hello"
    end

    it "allows to set a new value" do
      @button.text = "New Label"
      @button._.currentTitle.should == "New Label"
    end
  end

  describe '#disabled' do
    it "returns 'false' by default" do
      @button.disabled.should == false
    end

    it "reads the value right of the ios entity" do
      @button._.enabled = false
      @button.disabled.should == true
    end

    it "allows to disable the inputs" do
      @button.disabled = true
      @button._.isEnabled.should == false
    end

    it "has a ruby-style alias" do
      @button.disabled?.should == false
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
under-os-ui-1.4.0 spec/under_os/ui/button_spec.rb
under-os-1.3.0 spec/lib/under_os/ui/button_spec.rb
under-os-1.2.1 spec/lib/under_os/ui/button_spec.rb
under-os-1.2.0 spec/lib/under_os/ui/button_spec.rb