Sha256: 377b3d7092522024599edb7c18950080f7a2ca3807ee61eb2f710d1420e9cd1b
Contents?: true
Size: 1.49 KB
Versions: 10
Compression:
Stored size: 1.49 KB
Contents
describe "Options Row" do tests_row title: "Options", key: :options, type: :options, items: ["First", "Second"] it "should initialize with correct settings" do @row.object.class.should == Formotion::RowType::OptionsRow end it "should build cell with segmented control" do cell = @row.make_cell cell.accessoryView.class.should == UISegmentedControl end # Value it "should select default value" do cell = @row.make_cell cell.accessoryView.selectedSegmentIndex.should == -1 @row.value.should == nil end it "should select custom value" do @row.value = 'Second' cell = @row.make_cell cell.accessoryView.selectedSegmentIndex.should == 1 @row.value.should == 'Second' end it "should bind value to control" do @row.value = 'Second' cell = @row.make_cell @row.value = "First" cell.accessoryView.selectedSegmentIndex.should == 0 end it "should bind nil to no selected segment" do @row.value = 'Second' cell = @row.make_cell @row.value = nil cell.accessoryView.selectedSegmentIndex.should == UISegmentedControlNoSegment end it "should work with name-value items" do @row = Formotion::Row.new(title: "Options", key: :options, type: :options, items: [["First", 1], ["Second", 2]], value: 1) @row.reuse_identifier = 'test' cell = @row.make_cell cell.accessoryView.selectedSegmentIndex.should == 0 @row.value = 2 cell.accessoryView.selectedSegmentIndex.should == 1 end end
Version data entries
10 entries across 10 versions & 1 rubygems