Sha256: 020e3fa829283a5a73b893cc4869eb10a8ab50cd3d8795a70f58480a54c0349d
Contents?: true
Size: 1.62 KB
Versions: 2
Compression:
Stored size: 1.62 KB
Contents
MILLENIUM = 946684672 TIME_ZONE = NSTimeZone.timeZoneWithName "Europe/Paris" describe "Date Row" do before do row_settings = { title: "Date", key: :date, type: :date, } @row = Formotion::Row.new(row_settings) @row.reuse_identifier = 'test' @row.object.formatter.timeZone = TIME_ZONE @row.object.picker.timeZone = TIME_ZONE end it "should initialize with correct settings" do @row.object.class.should == Formotion::RowType::DateRow end # Value it "should have no value by default" do cell = @row.make_cell @row.text_field.text.should == nil end it "should use custom value" do @row.value = MILLENIUM cell = @row.make_cell @row.text_field.text.should == '1/1/00' end # Picker it "should build date picker" do @row.object.picker.class.should == UIDatePicker end it "should update value when date is picked" do cell = @row.make_cell @row.object.picker.date = NSDate.dateWithTimeIntervalSince1970(MILLENIUM) @row.object.picker.trigger UIControlEventValueChanged @row.value.should == MILLENIUM @row.text_field.text.should == '1/1/00' end # Formats { :short => '1/1/00', :medium => 'Jan 1, 2000', :long => 'January 1, 2000', :full => 'Saturday, January 1, 2000' }.each do |format, expected_output| it "should display date in full format" do @row.value = MILLENIUM @row.format = format @row.object.instance_variable_set("@formatter", nil) @row.object.formatter.timeZone = TIME_ZONE cell = @row.make_cell @row.text_field.text.should == expected_output end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
formotion-0.5.1 | spec/row_type/date_spec.rb |
formotion-0.5 | spec/row_type/date_spec.rb |