ui_datepicker-rails3 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/MIT-LICENSE +20 -0
- data/README.mdown +200 -0
- data/Rakefile +18 -0
- data/init.rb +2 -0
- data/lib/active_admin/inputs/ui_date_picker_input.rb +11 -0
- data/lib/active_admin/inputs/ui_date_time_picker_input.rb +13 -0
- data/lib/active_admin/inputs_ext.rb +2 -0
- data/lib/date_util/localize.rb +18 -0
- data/lib/formtastic/inputs/ui_date_picker_input.rb +33 -0
- data/lib/formtastic/inputs/ui_date_time_picker_input.rb +12 -0
- data/lib/formtastic/inputs_ext.rb +2 -0
- data/lib/simple_form/inputs/ui_date_picker_input.rb +25 -0
- data/lib/simple_form/inputs/ui_date_time_picker_input.rb +11 -0
- data/lib/simple_form/inputs_ext.rb +2 -0
- data/lib/ui_datepicker-rails3.rb +41 -0
- data/spec/base_helper.rb +26 -0
- data/spec/configure_spec.rb +36 -0
- data/spec/spec_helper.rb +316 -0
- data/spec/support/custom_macros.rb +520 -0
- data/spec/support/output_buffer.rb +6 -0
- data/spec/ui_datepicker-rails3_spec.rb +78 -0
- data/spec/use_in_rails_spec.rb +6 -0
- metadata +76 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "FormtasticDatepickerInputs" do
|
4
|
+
include FormtasticDatepickerInputsSpecHelper
|
5
|
+
|
6
|
+
before do
|
7
|
+
@output_buffer = ''
|
8
|
+
mock_everything
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "date_picker_input" do
|
12
|
+
before do
|
13
|
+
@new_post.stub!(:publish_at).and_return(DateTime.parse('2000-01-02'))
|
14
|
+
output_buffer.replace ''
|
15
|
+
@form = semantic_form_for(@new_post) do |builder|
|
16
|
+
concat(builder.input(:publish_at, :as => :date_picker))
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
it_should_have_input_wrapper_with_class(:date_picker)
|
21
|
+
it_should_have_input_wrapper_with_id("post_publish_at_input")
|
22
|
+
it_should_have_label_with_text(/Publish at/)
|
23
|
+
it_should_have_label_for("post_publish_at")
|
24
|
+
it_should_have_input_with_id("post_publish_at")
|
25
|
+
it_should_have_input_with_type(:text)
|
26
|
+
it_should_have_input_with_name("post[publish_at]")
|
27
|
+
it_should_have_input_with_class("ui-date-picker")
|
28
|
+
|
29
|
+
it "should format date correctly" do
|
30
|
+
output_buffer.concat(@form)
|
31
|
+
output_buffer.should have_tag("form li input#post_publish_at[@value='02 Jan 2000']")
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it "should use custom date format correctly" do
|
36
|
+
@new_post.stub!(:publish_at).and_return(DateTime.parse('2000-01-02'))
|
37
|
+
output_buffer.replace ''
|
38
|
+
@form = semantic_form_for(@new_post) do |builder|
|
39
|
+
concat(builder.input(:publish_at, :as => :date_picker, :format => '%A, %B %d %Y'))
|
40
|
+
end
|
41
|
+
output_buffer.concat(@form)
|
42
|
+
output_buffer.should have_tag("form li input#post_publish_at[@value='Sunday, January 02 2000']")
|
43
|
+
end
|
44
|
+
|
45
|
+
describe "date_time_picker_input" do
|
46
|
+
before do
|
47
|
+
@new_post.stub!(:publish_at).and_return(DateTime.parse('2000-01-02 03:04'))
|
48
|
+
output_buffer.replace ''
|
49
|
+
@form = semantic_form_for(@new_post) do |builder|
|
50
|
+
concat(builder.input(:publish_at, :as => :date_time_picker))
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
it_should_have_input_wrapper_with_class(:date_time_picker)
|
55
|
+
it_should_have_input_wrapper_with_id("post_publish_at_input")
|
56
|
+
it_should_have_label_with_text(/Publish at/)
|
57
|
+
it_should_have_label_for("post_publish_at")
|
58
|
+
it_should_have_input_with_id("post_publish_at")
|
59
|
+
it_should_have_input_with_type(:text)
|
60
|
+
it_should_have_input_with_name("post[publish_at]")
|
61
|
+
it_should_have_input_with_class("ui-datetime-picker")
|
62
|
+
|
63
|
+
it "should format date correctly" do
|
64
|
+
output_buffer.concat(@form)
|
65
|
+
output_buffer.should have_tag("form li input#post_publish_at[@value='02 Jan 2000 03:04']")
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should use custom date/time format correctly" do
|
70
|
+
@new_post.stub!(:publish_at).and_return(DateTime.parse('2000-01-02 03:04'))
|
71
|
+
output_buffer.replace ''
|
72
|
+
@form = semantic_form_for(@new_post) do |builder|
|
73
|
+
concat(builder.input(:publish_at, :as => :date_picker, :format => '%A, %B %d %Y %H:%M'))
|
74
|
+
end
|
75
|
+
output_buffer.concat(@form)
|
76
|
+
output_buffer.should have_tag("form li input#post_publish_at[@value='Sunday, January 02 2000 03:04']")
|
77
|
+
end
|
78
|
+
end
|
metadata
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ui_datepicker-rails3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Kristian Mandrup
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-11-25 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: jQuery UI datepicker integration for Formtastic, Simple Form and Active
|
15
|
+
Admin
|
16
|
+
email: kmandrup@gmail.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files:
|
20
|
+
- README.mdown
|
21
|
+
files:
|
22
|
+
- lib/active_admin/inputs/ui_date_picker_input.rb
|
23
|
+
- lib/active_admin/inputs/ui_date_time_picker_input.rb
|
24
|
+
- lib/active_admin/inputs_ext.rb
|
25
|
+
- lib/date_util/localize.rb
|
26
|
+
- lib/formtastic/inputs/ui_date_picker_input.rb
|
27
|
+
- lib/formtastic/inputs/ui_date_time_picker_input.rb
|
28
|
+
- lib/formtastic/inputs_ext.rb
|
29
|
+
- lib/simple_form/inputs/ui_date_picker_input.rb
|
30
|
+
- lib/simple_form/inputs/ui_date_time_picker_input.rb
|
31
|
+
- lib/simple_form/inputs_ext.rb
|
32
|
+
- lib/ui_datepicker-rails3.rb
|
33
|
+
- MIT-LICENSE
|
34
|
+
- README.mdown
|
35
|
+
- Rakefile
|
36
|
+
- init.rb
|
37
|
+
- spec/base_helper.rb
|
38
|
+
- spec/configure_spec.rb
|
39
|
+
- spec/spec_helper.rb
|
40
|
+
- spec/support/custom_macros.rb
|
41
|
+
- spec/support/output_buffer.rb
|
42
|
+
- spec/ui_datepicker-rails3_spec.rb
|
43
|
+
- spec/use_in_rails_spec.rb
|
44
|
+
homepage: http://github.com/kristianmandrup/ui_datepicker-rails3x
|
45
|
+
licenses:
|
46
|
+
- MIT
|
47
|
+
post_install_message:
|
48
|
+
rdoc_options: []
|
49
|
+
require_paths:
|
50
|
+
- lib
|
51
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
|
+
none: false
|
53
|
+
requirements:
|
54
|
+
- - ! '>='
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
requirements: []
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.8.6
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Use jQuery UI's date picker with formtastic easily
|
69
|
+
test_files:
|
70
|
+
- spec/base_helper.rb
|
71
|
+
- spec/configure_spec.rb
|
72
|
+
- spec/spec_helper.rb
|
73
|
+
- spec/support/custom_macros.rb
|
74
|
+
- spec/support/output_buffer.rb
|
75
|
+
- spec/ui_datepicker-rails3_spec.rb
|
76
|
+
- spec/use_in_rails_spec.rb
|