formtastic-bootstrap 1.2.0 → 2.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.
Files changed (90) hide show
  1. data/Gemfile +5 -3
  2. data/Gemfile.lock +72 -60
  3. data/README.md +4 -1
  4. data/Rakefile +1 -1
  5. data/VERSION +1 -1
  6. data/formtastic-bootstrap.gemspec +49 -16
  7. data/lib/formtastic-bootstrap/actions/base.rb +22 -0
  8. data/lib/formtastic-bootstrap/actions/button_action.rb +13 -0
  9. data/lib/formtastic-bootstrap/actions/input_action.rb +13 -0
  10. data/lib/formtastic-bootstrap/actions/link_action.rb +12 -0
  11. data/lib/formtastic-bootstrap/actions.rb +10 -0
  12. data/lib/formtastic-bootstrap/form_builder.rb +4 -2
  13. data/lib/formtastic-bootstrap/helpers/action_helper.rb +12 -0
  14. data/lib/formtastic-bootstrap/helpers/actions_helper.rb +24 -0
  15. data/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb +2 -4
  16. data/lib/formtastic-bootstrap/helpers/inputs_helper.rb +0 -2
  17. data/lib/formtastic-bootstrap/helpers.rb +6 -8
  18. data/lib/formtastic-bootstrap/inputs/base/choices.rb +6 -35
  19. data/lib/formtastic-bootstrap/inputs/base/collections.rb +9 -0
  20. data/lib/formtastic-bootstrap/inputs/base/grouped_collections.rb +9 -0
  21. data/lib/formtastic-bootstrap/inputs/base/hints.rb +1 -1
  22. data/lib/formtastic-bootstrap/inputs/base/labelling.rb +14 -3
  23. data/lib/formtastic-bootstrap/inputs/base/numeric.rb +9 -0
  24. data/lib/formtastic-bootstrap/inputs/base/stringish.rb +4 -5
  25. data/lib/formtastic-bootstrap/inputs/base/timeish.rb +38 -18
  26. data/lib/formtastic-bootstrap/inputs/base/wrapping.rb +22 -34
  27. data/lib/formtastic-bootstrap/inputs/base.rb +29 -6
  28. data/lib/formtastic-bootstrap/inputs/boolean_input.rb +14 -18
  29. data/lib/formtastic-bootstrap/inputs/check_boxes_input.rb +16 -11
  30. data/lib/formtastic-bootstrap/inputs/date_input.rb +3 -9
  31. data/lib/formtastic-bootstrap/inputs/date_select_input.rb +8 -0
  32. data/lib/formtastic-bootstrap/inputs/datetime_input.rb +3 -12
  33. data/lib/formtastic-bootstrap/inputs/datetime_select_input.rb +8 -0
  34. data/lib/formtastic-bootstrap/inputs/email_input.rb +1 -1
  35. data/lib/formtastic-bootstrap/inputs/file_input.rb +1 -1
  36. data/lib/formtastic-bootstrap/inputs/hidden_input.rb +1 -1
  37. data/lib/formtastic-bootstrap/inputs/number_input.rb +3 -3
  38. data/lib/formtastic-bootstrap/inputs/password_input.rb +1 -1
  39. data/lib/formtastic-bootstrap/inputs/phone_input.rb +1 -1
  40. data/lib/formtastic-bootstrap/inputs/radio_input.rb +28 -14
  41. data/lib/formtastic-bootstrap/inputs/range_input.rb +1 -1
  42. data/lib/formtastic-bootstrap/inputs/search_input.rb +1 -1
  43. data/lib/formtastic-bootstrap/inputs/select_input.rb +3 -1
  44. data/lib/formtastic-bootstrap/inputs/string_input.rb +0 -7
  45. data/lib/formtastic-bootstrap/inputs/text_input.rb +1 -1
  46. data/lib/formtastic-bootstrap/inputs/time_input.rb +3 -9
  47. data/lib/formtastic-bootstrap/inputs/time_select_input.rb +8 -0
  48. data/lib/formtastic-bootstrap/inputs/time_zone_input.rb +1 -1
  49. data/lib/formtastic-bootstrap/inputs/url_input.rb +1 -1
  50. data/lib/formtastic-bootstrap/inputs.rb +30 -23
  51. data/lib/formtastic-bootstrap.rb +16 -1
  52. data/spec/actions/button_action_spec.rb +63 -0
  53. data/spec/actions/input_action_spec.rb +59 -0
  54. data/spec/actions/link_action_spec.rb +92 -0
  55. data/spec/helpers/action_helper_spec.rb +368 -0
  56. data/spec/helpers/actions_helper_spec.rb +147 -0
  57. data/spec/helpers/input_helper_spec.rb +238 -259
  58. data/spec/helpers/inputs_helper_spec.rb +84 -25
  59. data/spec/inputs/boolean_input_spec.rb +108 -75
  60. data/spec/inputs/check_boxes_input_spec.rb +106 -91
  61. data/spec/inputs/date_select_input_spec.rb +164 -0
  62. data/spec/inputs/datetime_select_input_spec.rb +112 -0
  63. data/spec/inputs/deprecated_time_date_datetime_inputs_spec.rb +48 -0
  64. data/spec/inputs/email_input_spec.rb +30 -3
  65. data/spec/inputs/file_input_spec.rb +31 -4
  66. data/spec/inputs/hidden_input_spec.rb +63 -32
  67. data/spec/inputs/number_input_spec.rb +37 -8
  68. data/spec/inputs/password_input_spec.rb +30 -3
  69. data/spec/inputs/phone_input_spec.rb +30 -3
  70. data/spec/inputs/radio_input_spec.rb +87 -60
  71. data/spec/inputs/range_input_spec.rb +32 -5
  72. data/spec/inputs/search_input_spec.rb +29 -3
  73. data/spec/inputs/select_input_spec.rb +164 -107
  74. data/spec/inputs/string_input_spec.rb +33 -22
  75. data/spec/inputs/text_input_spec.rb +39 -14
  76. data/spec/inputs/time_select_input_spec.rb +191 -0
  77. data/spec/inputs/time_zone_input_spec.rb +17 -19
  78. data/spec/inputs/url_input_spec.rb +30 -3
  79. data/spec/spec_helper.rb +21 -15
  80. data/spec/support/custom_macros.rb +61 -228
  81. data/spec/support/fb_custom_macros.rb +23 -0
  82. metadata +109 -28
  83. data/lib/formtastic-bootstrap/helpers/buttons_helper.rb +0 -52
  84. data/spec/builder/errors_spec.rb +0 -214
  85. data/spec/helpers/buttons_helper_spec.rb +0 -149
  86. data/spec/inputs/date_input_spec.rb +0 -147
  87. data/spec/inputs/datetime_input_spec.rb +0 -101
  88. data/spec/inputs/time_input_spec.rb +0 -206
  89. data/spec/support/depracation.rb +0 -6
  90. data/spec/support/formtastic_spec_helper.rb +0 -382
@@ -1,147 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe 'date input' do
5
-
6
- include FormtasticSpecHelper
7
-
8
- before do
9
- @output_buffer = ''
10
- mock_everything
11
- Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
12
- end
13
-
14
- describe "general" do
15
-
16
- before do
17
- output_buffer.replace ''
18
- concat(semantic_form_for(@new_post) do |builder|
19
- concat(builder.input(:publish_at, :as => :date, :order => [:year, :month, :day]))
20
- end)
21
- end
22
-
23
- it_should_have_input_wrapper_with_class("date")
24
- it_should_have_input_wrapper_with_class(:clearfix)
25
- it_should_have_input_wrapper_with_class(:stringish)
26
- it_should_have_input_class_in_the_right_place
27
- it_should_have_input_wrapper_with_id("post_publish_at_input")
28
- it_should_have_a_nested_div
29
- # it_should_have_a_nested_fieldset_with_class('fragments')
30
- # it_should_have_a_nested_ordered_list_with_class('fragments-group')
31
- it_should_apply_error_logic_for_input_type(:date)
32
-
33
- it 'should have a legend and label with the label text inside the fieldset' do
34
- output_buffer.should have_tag('form div.clearfix.date label', /Publish at/)
35
- end
36
-
37
- # it 'should associate the legend label with the first select' do
38
- # output_buffer.should have_tag('form li.date fieldset legend.label')
39
- # output_buffer.should have_tag('form li.date fieldset legend.label label')
40
- # output_buffer.should have_tag('form li.date fieldset legend.label label[@for]')
41
- # output_buffer.should have_tag('form li.date fieldset legend.label label[@for="post_publish_at_1i"]')
42
- # end
43
-
44
- it 'should (sort of) associate the label with the input' do
45
- output_buffer.should have_tag('form div.clearfix.date label[@for="post_publish_at"]')
46
- output_buffer.should have_tag('form div.clearfix.date div.input input[@id="post_publish_at[date]"]')
47
- end
48
-
49
- # it 'should have an ordered list of three items inside the fieldset' do
50
- # output_buffer.should have_tag('form li.date fieldset ol.fragments-group')
51
- # output_buffer.should have_tag('form li.date fieldset ol li.fragment', :count => 3)
52
- # end
53
-
54
- # it 'should have three labels for year, month and day' do
55
- # output_buffer.should have_tag('form li.date fieldset ol li label', :count => 3)
56
- # output_buffer.should have_tag('form li.date fieldset ol li label', /year/i)
57
- # output_buffer.should have_tag('form li.date fieldset ol li label', /month/i)
58
- # output_buffer.should have_tag('form li.date fieldset ol li label', /day/i)
59
- # end
60
- it 'should have an text input inside the div' do
61
- output_buffer.should have_tag('form div.clearfix.date div.input input[@type="text"]')
62
- end
63
-
64
- # it 'should have three selects for year, month and day' do
65
- # output_buffer.should have_tag('form li.date fieldset ol li select', :count => 3)
66
- # end
67
- end
68
-
69
- describe "when namespace is provided" do
70
-
71
- before do
72
- output_buffer.replace ''
73
- concat(semantic_form_for(@new_post, :namespace => "context2") do |builder|
74
- concat(builder.input(:publish_at, :as => :date, :order => [:year, :month, :day]))
75
- end)
76
- end
77
-
78
- it_should_have_input_wrapper_with_id("context2_post_publish_at_input")
79
- it_should_have_input_with_id("context2_post_publish_at[date]")
80
- # it_should_have_select_with_id("context2_post_publish_at_2i")
81
- # it_should_have_select_with_id("context2_post_publish_at_3i")
82
-
83
- end
84
-
85
- # We only use a single label for the entire entity.
86
-
87
- # describe ':labels option' do
88
- # fields = [:year, :month, :day]
89
- # fields.each do |field|
90
- # it "should replace the #{field} label with the specified text if :labels[:#{field}] is set" do
91
- # output_buffer.replace ''
92
- # concat(semantic_form_for(@new_post) do |builder|
93
- # concat(builder.input(:created_at, :as => :date, :labels => { field => "another #{field} label" }))
94
- # end)
95
- # output_buffer.should have_tag('form li.date fieldset ol li label', :count => fields.length)
96
- # fields.each do |f|
97
- # output_buffer.should have_tag('form li.date fieldset ol li label', f == field ? /another #{f} label/i : /#{f}/i)
98
- # end
99
- # end
100
- #
101
- # it "should not display the label for the #{field} field when :labels[:#{field}] is blank" do
102
- # output_buffer.replace ''
103
- # concat(semantic_form_for(@new_post) do |builder|
104
- # concat(builder.input(:created_at, :as => :date, :labels => { field => "" }))
105
- # end)
106
- # output_buffer.should have_tag('form li.date fieldset ol li label', :count => fields.length-1)
107
- # fields.each do |f|
108
- # output_buffer.should have_tag('form li.date fieldset ol li label', /#{f}/i) unless field == f
109
- # end
110
- # end
111
- #
112
- # it "should not display the label for the #{field} field when :labels[:#{field}] is false" do
113
- # output_buffer.replace ''
114
- # concat(semantic_form_for(@new_post) do |builder|
115
- # concat(builder.input(:created_at, :as => :date, :labels => { field => false }))
116
- # end)
117
- # output_buffer.should have_tag('form li.date fieldset ol li label', :count => fields.length-1)
118
- # fields.each do |f|
119
- # output_buffer.should have_tag('form li.date fieldset ol li label', /#{f}/i) unless field == f
120
- # end
121
- # end
122
- #
123
- # it "should not render unsafe HTML when :labels[:#{field}] is false" do
124
- # output_buffer.replace ''
125
- # concat(semantic_form_for(@new_post) do |builder|
126
- # concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => false }))
127
- # end)
128
- # output_buffer.should_not include(">")
129
- # end
130
- #
131
- # end
132
- # end
133
-
134
- describe "when required" do
135
- it "should add the required attribute to the input's html options" do
136
- with_config :use_required_attribute, true do
137
- concat(semantic_form_for(@new_post) do |builder|
138
- concat(builder.input(:title, :as => :date, :required => true))
139
- end)
140
- # output_buffer.should have_tag("select[@required]", :count => 3)
141
- # We only have one text field.
142
- output_buffer.should have_tag("input[@required]", :count => 1)
143
- end
144
- end
145
- end
146
-
147
- end
@@ -1,101 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe 'datetime input' do
5
-
6
- include FormtasticSpecHelper
7
-
8
- before do
9
- @output_buffer = ''
10
- mock_everything
11
- Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
12
- end
13
-
14
- describe "general" do
15
-
16
- before do
17
- ::I18n.backend.store_translations :en, {}
18
- output_buffer.replace ''
19
- concat(semantic_form_for(@new_post) do |builder|
20
- concat(builder.input(:publish_at, :as => :datetime))
21
- end)
22
- end
23
-
24
- it_should_have_input_wrapper_with_class("datetime")
25
- it_should_have_input_wrapper_with_class(:clearfix)
26
- it_should_have_input_wrapper_with_class(:stringish) # Decide about this.
27
- it_should_have_input_class_in_the_right_place
28
- it_should_have_input_wrapper_with_id("post_publish_at_input")
29
- it_should_have_a_nested_div
30
- # it_should_have_a_nested_fieldset_with_class('fragments')
31
- # it_should_have_a_nested_ordered_list_with_class('fragments-group')
32
- it_should_apply_error_logic_for_input_type(:datetime)
33
-
34
- it 'should have a legend and label with the label text inside the fieldset' do
35
- output_buffer.should have_tag('form div.clearfix.datetime label', /Publish at/)
36
- end
37
-
38
- # it 'should associate the legend label with the first select' do
39
- # output_buffer.should have_tag('form li.datetime fieldset legend.label')
40
- # output_buffer.should have_tag('form li.datetime fieldset legend.label label')
41
- # output_buffer.should have_tag('form li.datetime fieldset legend.label label[@for]')
42
- # output_buffer.should have_tag('form li.datetime fieldset legend.label label[@for="post_publish_at_1i"]')
43
- # end
44
-
45
- # it 'should have an ordered list of five items inside the fieldset' do
46
- # output_buffer.should have_tag('form li.datetime fieldset ol.fragments-group')
47
- # output_buffer.should have_tag('form li.datetime fieldset ol li.fragment', :count => 5)
48
- # end
49
-
50
- # it 'should have five labels for year, month and day' do
51
- # output_buffer.should have_tag('form li.datetime fieldset ol li label', :count => 5)
52
- # output_buffer.should have_tag('form li.datetime fieldset ol li label', /year/i)
53
- # output_buffer.should have_tag('form li.datetime fieldset ol li label', /month/i)
54
- # output_buffer.should have_tag('form li.datetime fieldset ol li label', /day/i)
55
- # output_buffer.should have_tag('form li.datetime fieldset ol li label', /hour/i)
56
- # output_buffer.should have_tag('form li.datetime fieldset ol li label', /min/i)
57
- # end
58
-
59
- # it 'should have five selects' do
60
- # output_buffer.should have_tag('form li.datetime fieldset ol li select', :count => 5)
61
- # end
62
-
63
- it 'should have two inputs' do
64
- output_buffer.should have_tag('form div.clearfix.datetime div.input input', :count => 2)
65
- end
66
-
67
- end
68
-
69
- describe "when namespace is provided" do
70
-
71
- before do
72
- output_buffer.replace ''
73
- concat(semantic_form_for(@new_post, :namespace => "context2") do |builder|
74
- concat(builder.input(:publish_at, :as => :datetime))
75
- end)
76
- end
77
-
78
- it_should_have_input_wrapper_with_id("context2_post_publish_at_input")
79
- it_should_have_input_with_id("context2_post_publish_at[date]")
80
- it_should_have_input_with_id("context2_post_publish_at[time]")
81
- # it_should_have_input_with_id("context2_post_publish_at_1i")
82
- # it_should_have_select_with_id("context2_post_publish_at_2i")
83
- # it_should_have_select_with_id("context2_post_publish_at_3i")
84
- # it_should_have_select_with_id("context2_post_publish_at_4i")
85
- # it_should_have_select_with_id("context2_post_publish_at_5i")
86
-
87
- end
88
-
89
- describe "when required" do
90
- it "should add the required attribute to the input's html options" do
91
- with_config :use_required_attribute, true do
92
- concat(semantic_form_for(@new_post) do |builder|
93
- concat(builder.input(:title, :as => :datetime, :required => true))
94
- end)
95
- # output_buffer.should have_tag("select[@required]", :count => 5)
96
- output_buffer.should have_tag("input[@required]", :count => 2)
97
- end
98
- end
99
- end
100
-
101
- end
@@ -1,206 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
-
4
- describe 'time input' do
5
-
6
- include FormtasticSpecHelper
7
-
8
- before do
9
- @output_buffer = ''
10
- mock_everything
11
- Formtastic::Helpers::FormHelper.builder = FormtasticBootstrap::FormBuilder
12
- end
13
-
14
- describe "general" do
15
- before do
16
- ::I18n.backend.reload!
17
- output_buffer.replace ''
18
- end
19
-
20
- # describe "with :ignore_date => true" do
21
- # before do
22
- # concat(semantic_form_for(@new_post) do |builder|
23
- # concat(builder.input(:publish_at, :as => :time, :ignore_date => true))
24
- # end)
25
- # end
26
- #
27
- # it 'should not have hidden inputs for day, month and year' do
28
- # output_buffer.should_not have_tag('input#post_publish_at_1i')
29
- # output_buffer.should_not have_tag('input#post_publish_at_2i')
30
- # output_buffer.should_not have_tag('input#post_publish_at_3i')
31
- # end
32
- #
33
- # it 'should have an input for hour and minute' do
34
- # output_buffer.should have_tag('select#post_publish_at_4i')
35
- # output_buffer.should have_tag('select#post_publish_at_5i')
36
- # end
37
- #
38
- # end
39
- #
40
- # describe "with :ignore_date => false" do
41
- # before do
42
- # @new_post.stub(:publish_at).and_return(Time.parse('2010-11-07'))
43
- # concat(semantic_form_for(@new_post) do |builder|
44
- # concat(builder.input(:publish_at, :as => :time, :ignore_date => false))
45
- # end)
46
- # end
47
- #
48
- # it 'should have a hidden input for day, month and year' do
49
- # output_buffer.should have_tag('input#post_publish_at_1i')
50
- # output_buffer.should have_tag('input#post_publish_at_2i')
51
- # output_buffer.should have_tag('input#post_publish_at_3i')
52
- # output_buffer.should have_tag('input#post_publish_at_1i[@value="2010"]')
53
- # output_buffer.should have_tag('input#post_publish_at_2i[@value="11"]')
54
- # output_buffer.should have_tag('input#post_publish_at_3i[@value="7"]')
55
- # end
56
- #
57
- # it 'should have an select for hour and minute' do
58
- # output_buffer.should have_tag('select#post_publish_at_4i')
59
- # output_buffer.should have_tag('select#post_publish_at_5i')
60
- # end
61
- #
62
- # end
63
-
64
- describe "without seconds" do
65
- before do
66
- concat(semantic_form_for(@new_post) do |builder|
67
- concat(builder.input(:publish_at, :as => :time))
68
- end)
69
- end
70
-
71
- it_should_have_input_wrapper_with_class("time")
72
- it_should_have_input_wrapper_with_class(:clearfix)
73
- it_should_have_input_wrapper_with_class(:stringish)
74
- it_should_have_input_class_in_the_right_place
75
- it_should_have_input_wrapper_with_id("post_publish_at_input")
76
- it_should_have_a_nested_div
77
- it_should_apply_error_logic_for_input_type(:time)
78
-
79
- it 'should have a legend and label with the label text inside the fieldset' do
80
- output_buffer.should have_tag('form div.clearfix.time label', /Publish at/)
81
- end
82
-
83
- # TODO Is this right?
84
- it 'should (sort of) associate the label with the input' do
85
- output_buffer.should have_tag('form div.clearfix.time label[@for="post_publish_at"]')
86
- output_buffer.should have_tag('form div.clearfix.time div.input input[@id="post_publish_at[time]"]')
87
- end
88
-
89
- it 'should have an text input inside the div' do
90
- output_buffer.should have_tag('form div.clearfix.time div.input input[@type="text"]')
91
- end
92
-
93
- # it 'should have five labels for hour and minute' do
94
- # output_buffer.should have_tag('form li.time fieldset ol li label', :count => 2)
95
- # output_buffer.should have_tag('form li.time fieldset ol li label', /hour/i)
96
- # output_buffer.should have_tag('form li.time fieldset ol li label', /minute/i)
97
- # end
98
- #
99
- # it 'should have two selects for hour and minute' do
100
- # output_buffer.should have_tag('form li.time fieldset ol li', :count => 2)
101
- # end
102
- end
103
-
104
- describe "with seconds" do
105
- before do
106
- concat(semantic_form_for(@new_post) do |builder|
107
- concat(builder.input(:publish_at, :as => :time, :include_seconds => true))
108
- end)
109
- end
110
-
111
- # it 'should have five labels for hour and minute' do
112
- # output_buffer.should have_tag('form li.time fieldset ol li label', :count => 3)
113
- # output_buffer.should have_tag('form li.time fieldset ol li label', /hour/i)
114
- # output_buffer.should have_tag('form li.time fieldset ol li label', /minute/i)
115
- # output_buffer.should have_tag('form li.time fieldset ol li label', /second/i)
116
- # end
117
-
118
- it 'should not have three selects for hour, minute and seconds' do
119
- output_buffer.should_not have_tag('form li.time fieldset ol li', :count => 3)
120
- end
121
-
122
- # it 'should generate a sanitized label and matching ids for attribute' do
123
- # 4.upto(6) do |i|
124
- # output_buffer.should have_tag("form li fieldset ol li label[@for='post_publish_at_#{i}i']")
125
- # output_buffer.should have_tag("form li fieldset ol li #post_publish_at_#{i}i")
126
- # end
127
- # end
128
- end
129
- end
130
-
131
- # Ignore these since we only create the main label.
132
-
133
- # describe ':labels option' do
134
- # fields = [:hour, :minute, :second]
135
- # fields.each do |field|
136
- # it "should replace the #{field} label with the specified text if :labels[:#{field}] is set" do
137
- # output_buffer.replace ''
138
- # concat(semantic_form_for(@new_post) do |builder|
139
- # concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => "another #{field} label" }))
140
- # end)
141
- # output_buffer.should have_tag('form li.time fieldset ol li label', :count => fields.length)
142
- # fields.each do |f|
143
- # output_buffer.should have_tag('form li.time fieldset ol li label', f == field ? /another #{f} label/i : /#{f}/i)
144
- # end
145
- # end
146
- #
147
- # it "should not display the label for the #{field} field when :labels[:#{field}] is blank" do
148
- # output_buffer.replace ''
149
- # concat(semantic_form_for(@new_post) do |builder|
150
- # concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => "" }))
151
- # end)
152
- # output_buffer.should have_tag('form li.time fieldset ol li label', :count => fields.length-1)
153
- # fields.each do |f|
154
- # output_buffer.should have_tag('form li.time fieldset ol li label', /#{f}/i) unless field == f
155
- # end
156
- # end
157
- #
158
- # it "should not render the label when :labels[:#{field}] is false" do
159
- # output_buffer.replace ''
160
- # concat(semantic_form_for(@new_post) do |builder|
161
- # concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => false }))
162
- # end)
163
- # output_buffer.should have_tag('form li.time fieldset ol li label', :count => fields.length-1)
164
- # fields.each do |f|
165
- # output_buffer.should have_tag('form li.time fieldset ol li label', /#{f}/i) unless field == f
166
- # end
167
- # end
168
- #
169
- # it "should not render unsafe HTML when :labels[:#{field}] is false" do
170
- # output_buffer.replace ''
171
- # concat(semantic_form_for(@new_post) do |builder|
172
- # concat(builder.input(:created_at, :as => :time, :include_seconds => true, :labels => { field => false }))
173
- # end)
174
- # output_buffer.should_not include(">")
175
- # end
176
- #
177
- # end
178
- # end
179
-
180
- describe ':namespace option' do
181
- before do
182
- concat(semantic_form_for(@new_post, :namespace => 'form2') do |builder|
183
- concat(builder.input(:publish_at, :as => :time))
184
- end)
185
- end
186
-
187
- it 'should have a tag matching the namespace' do
188
- output_buffer.should have_tag('#form2_post_publish_at_input')
189
- output_buffer.should have_tag('input[@id="form2_post_publish_at[time]"]')
190
- end
191
- end
192
-
193
- describe "when required" do
194
- it "should add the required attribute to the input's html options" do
195
- with_config :use_required_attribute, true do
196
- concat(semantic_form_for(@new_post) do |builder|
197
- concat(builder.input(:title, :as => :time, :required => true))
198
- end)
199
- # output_buffer.should have_tag("select[@required]", :count => 2)
200
- # We only have one field.
201
- output_buffer.should have_tag("input[@required]", :count => 1)
202
- end
203
- end
204
- end
205
-
206
- end
@@ -1,6 +0,0 @@
1
- def with_deprecation_silenced(&block)
2
- ::ActiveSupport::Deprecation.silence do
3
- yield
4
- end
5
- end
6
-