Sha256: 75561c318a93aaa2953a65c948801268f9c09e1e6523247d57fb449555cae107

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

describe "Picker Row" do
  tests_row title: "Picker", key: :picker, type: :picker,
            items: ["Ruby", "Motion"], value: "Motion"

  it "should initialize with correct settings" do
    @row.object.class.should == Formotion::RowType::PickerRow
  end

  it "should build cell with picker as input view of text_field" do
    cell = @row.make_cell

    @row.text_field.inputView.class.should == UIPickerView
  end

  it "should start ui picker at custom value" do
    cell = @row.make_cell

    @row.text_field.inputView.selectedRowInComponent(0).should == 1
  end

  it "should have text field the custom value" do
    cell = @row.make_cell

    @row.text_field.text.should == "Motion"
  end

  it "should work with name-value items" do
    @row = Formotion::Row.new(title: "Picker", key: :picker, type: :picker,
            items: [["Ruby", 1], ["Motion", 2]], value: 1)
    @row.reuse_identifier = 'test'
    cell = @row.make_cell

    @row.text_field.text.should == "Ruby"

    @row.value = 2
    @row.text_field.text.should == "Motion"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
formotion-1.8 spec/row_type/picker_spec.rb
formotion-1.7 spec/row_type/picker_spec.rb
formotion-1.6 spec/row_type/picker_spec.rb
formotion-1.5.1 spec/row_type/picker_spec.rb
formotion-1.5.0 spec/row_type/picker_spec.rb
formotion-1.4.0 spec/row_type/picker_spec.rb
formotion-1.3.1 spec/row_type/picker_spec.rb
formotion-1.3 spec/row_type/picker_spec.rb
formotion-1.2 spec/row_type/picker_spec.rb
formotion-1.1.5 spec/row_type/picker_spec.rb