campo 0.9.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ad1704182be3effc8d533bbe5017d6d7082da7ba
4
+ data.tar.gz: 29e3d38af3651aac6edea7f97bdd680c0eb0520a
5
+ SHA512:
6
+ metadata.gz: bf5879d45f7e15ee8009733ad3bfc84fbb9ebfd0334ee301976d827a5a63ddaec09e80e4a61315f158622537050af01eb9529278eb19d4e82a6e42e622c4a7cb
7
+ data.tar.gz: 297ad597fd258f8c4087730325281e7f7fbe6ef8ff2ba793c68c6e3337d96970edd802a0dd26233b1e7c96f8bc1f6e6c24f12efaf733bd1cf9364d96ac2cf138
@@ -2,6 +2,6 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.2
4
4
  - 1.9.3
5
- - ruby-head
5
+ - 2.0.0
6
6
  bundler_args: --binstubs --path vendor
7
7
  script: bundle exec rspec spec
@@ -1,3 +1,27 @@
1
+ # CH CH CH CHANGES! #
2
+
3
+ ## v0.11.0 Thursday the 19th of December 2013 ##
4
+
5
+ * Run specs on Travis against Ruby 2.
6
+ * Use the latest Haml.
7
+
8
+ ---
9
+
10
+
11
+ ## v0.10.1 Thursday the 19th of December 2013 ##
12
+
13
+ * A couple of the specs weren't written correctly to check for failure. For some reason they pass on my machine but fail on Travis CI, so I've updated them and now they should be good!
14
+
15
+ ----
16
+
17
+
18
+ ## v0.10.0 Thursday the 19th of December 2013 ##
19
+
20
+ * The `name` attribute can now be overridden if needs be.
21
+
22
+ ----
23
+
24
+
1
25
  ## v0.9.1 16th of December 2012 ##
2
26
 
3
27
  * `labelled` can now take an attributes hash, so: `.labelled("Favourite tea:", class: "list")` will output `%label{ class: "list", for: "teas", }`
@@ -15,7 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.required_ruby_version = ">= 1.9.2"
16
16
  s.authors = ["Iain Barnett"]
17
17
  s.files = `git ls-files`.split("\n")
18
- s.add_development_dependency("haml", "~> 3.1.1")
18
+ s.add_development_dependency("haml", "~> 4.0.0")
19
19
  s.add_development_dependency("yard")
20
20
  s.add_development_dependency("rake")
21
21
  s.homepage = "https://github.com/yb66/Campo"
@@ -155,7 +155,7 @@ module Campo
155
155
 
156
156
  # @param (see #text)
157
157
  # @param [:symbol] type The type html attribute.
158
- def input( name, type, label=nil, attributes={} )
158
+ def input( name, type, label=nil, attributes={} )
159
159
  if label.kind_of? Hash
160
160
  attributes = label
161
161
  label = nil
@@ -248,9 +248,13 @@ module Campo
248
248
  # @param [Hash,optional] attributes Any attributes for the element. Defaults to a generated tabindex (dependent on the order of form elements).
249
249
  # @yield Any fields defined in the passed block become children of this element.
250
250
  def initialize( name, attributes={}, &block )
251
- @attributes = DEFAULT.merge( {id: name}.merge(attributes.merge({name: name})) ).reject{|k,v| v.nil? }
251
+ @attributes = DEFAULT.merge(
252
+ {id: name}.merge(
253
+ {name: name}.merge(attributes)
254
+ )
255
+ ).reject{|k,v| v.nil? }
252
256
  @fields = []
253
-
257
+
254
258
  instance_eval( &block ) if block
255
259
  end
256
260
 
@@ -1,3 +1,3 @@
1
1
  module Campo
2
- VERSION = "0.9.1"
2
+ VERSION = "0.11.0"
3
3
  end
@@ -27,17 +27,17 @@ describe "Aria" do
27
27
  - inners = {} if inners.nil?
28
28
  - inners.default = "" if inners.default.nil?
29
29
  - @campo_tabindex ||= 0 # for tabindex
30
- %form{ atts[:example], id: "example", method: "POST", name: "example", role: "form", }
30
+ %form{ atts[:example], id: "example", name: "example", method: "POST", role: "form", }
31
31
  %label{ for: "a", }
32
32
  A
33
33
  %span{id: "a_description", }
34
34
  mm/yy
35
- %input{ atts[:a], tabindex: "#{@campo_tabindex += 1}", id: "a", type: "text", name: "a", :"aria-describedby" => "a_description", }
35
+ %input{ atts[:a], tabindex: "#{@campo_tabindex += 1}", id: "a", name: "a", type: "text", :"aria-describedby" => "a_description", }
36
36
  %label{ for: "b", }
37
37
  B
38
38
  %span{id: "b_description", class: "description", }
39
39
  All in caps
40
- %input{ atts[:b], tabindex: "#{@campo_tabindex += 1}", id: "b", type: "text", name: "b", :"aria-describedby" => "b_description", }
40
+ %input{ atts[:b], tabindex: "#{@campo_tabindex += 1}", id: "b", name: "b", type: "text", :"aria-describedby" => "b_description", }
41
41
  %label{ for: "c", }
42
42
  C
43
43
  %span{id: "c_description", class: "description", }
@@ -46,7 +46,7 @@ describe "Aria" do
46
46
  Must be 8 characters at least.
47
47
  %li{ id: "password_not_email_address", class: "password validate", }
48
48
  It's better to add some numbers/punctuation.
49
- %input{ atts[:c], tabindex: "#{@campo_tabindex += 1}", id: "c", type: "text", name: "c", :"aria-describedby" => "c_description", }
49
+ %input{ atts[:c], tabindex: "#{@campo_tabindex += 1}", id: "c", name: "c", type: "text", :"aria-describedby" => "c_description", }
50
50
  %label{ for: "d", }
51
51
  D
52
52
  %span{id: "d_description", }
@@ -57,7 +57,7 @@ describe "Aria" do
57
57
  Me
58
58
  %li
59
59
  Them
60
- %input{ atts[:d], tabindex: "#{@campo_tabindex += 1}", id: "d", type: "text", name: "d", :"aria-describedby" => "d_description", }
60
+ %input{ atts[:d], tabindex: "#{@campo_tabindex += 1}", id: "d", name: "d", type: "text", :"aria-describedby" => "d_description", }
61
61
  STR
62
62
  }
63
63
 
@@ -29,7 +29,7 @@ STR
29
29
  describe :output do
30
30
  context "Given a form with no fields" do
31
31
  let(:expected) {
32
- expected = top_bit + %q!%form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }!.strip + "\n"
32
+ expected = top_bit + %q!%form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }!.strip + "\n"
33
33
  }
34
34
 
35
35
  subject{ Campo.output Campo::Form.new( "myform" ) }
@@ -43,10 +43,10 @@ STR
43
43
  %label{ class: "list", for: "teas", }
44
44
  Favourite tea:
45
45
  %select{ atts[:teas], tabindex: "#{@campo_tabindex += 1}", id: "teas", name: "teas", }
46
- %option{ atts[:teas_default], id: "teas_default", value: "", disabled: "disabled", name: "teas", }Choose one:
47
- %option{ atts[:teas_ceylon], id: "teas_ceylon", value: "ceylon", name: "teas", }Ceylon
48
- %option{ atts[:teas_breakfast], id: "teas_breakfast", value: "breakfast", name: "teas", }Breakfast
49
- %option{ atts[:teas_earl_grey], id: "teas_earl_grey", value: "earl grey", name: "teas", }Earl grey
46
+ %option{ atts[:teas_default], id: "teas_default", name: "teas", value: "", disabled: "disabled", }Choose one:
47
+ %option{ atts[:teas_ceylon], id: "teas_ceylon", name: "teas", value: "ceylon", }Ceylon
48
+ %option{ atts[:teas_breakfast], id: "teas_breakfast", name: "teas", value: "breakfast", }Breakfast
49
+ %option{ atts[:teas_earl_grey], id: "teas_earl_grey", name: "teas", value: "earl grey", }Earl grey
50
50
  !.strip + "\n"
51
51
  }
52
52
  let(:tag) {
@@ -64,7 +64,7 @@ STR
64
64
  describe "A realish form" do
65
65
  context "Given a form" do
66
66
  let(:expected) {
67
- top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "POST", action: uri("/my/personal_details/update/"), name: "personal_details", role: "form", }\n %fieldset{ }\n %legend{ }Your details\n %label{ for: "full_name", }\n Full name: \n %input{ atts[:full_name], tabindex: "\#{@campo_tabindex += 1}", id: "full_name", type: "text", size: "60", name: "full_name", }\n %label{ for: "dob", }\n Date of birth: \n %input{ atts[:dob], tabindex: "\#{@campo_tabindex += 1}", id: "dob", type: "text", size: "10", name: "dob", }\n %fieldset{ }\n %legend{ }Gender: \n %label{ for: "gender_1", }\n Male\n %input{ atts[:gender_1], tabindex: "\#{@campo_tabindex += 1}", id: "gender_1", type: "radio", value: "1", name: "gender", }\n %label{ for: "gender_2", }\n Female\n %input{ atts[:gender_2], tabindex: "\#{@campo_tabindex += 1}", id: "gender_2", type: "radio", value: "2", name: "gender", }\n %label{ for: "ethnicorigin_id", }\n Ethnic-origin: \n %select{ atts[:ethnicorigin_id], tabindex: "\#{@campo_tabindex += 1}", id: "ethnicorigin_id", name: "ethnicorigin_id", }\n %option{ atts[:ethnicorigin_id_default], id: "ethnicorigin_id_default", value: "", disabled: "disabled", name: "ethnicorigin_id", }Choose one:\n %option{ atts[:ethnicorigin_id_1], id: "ethnicorigin_id_1", value: "1", name: "ethnicorigin_id", }White\n %option{ atts[:ethnicorigin_id_2], id: "ethnicorigin_id_2", value: "2", name: "ethnicorigin_id", }Asian\n %option{ atts[:ethnicorigin_id_3], id: "ethnicorigin_id_3", value: "3", name: "ethnicorigin_id", }Black\n %option{ atts[:ethnicorigin_id_4], id: "ethnicorigin_id_4", value: "4", name: "ethnicorigin_id", }Chinese and Other\n %option{ atts[:ethnicorigin_id_5], id: "ethnicorigin_id_5", value: "5", name: "ethnicorigin_id", }Mixed\n %label{ for: "occupation", }\n Occupation: \n %input{ atts[:occupation], tabindex: "\#{@campo_tabindex += 1}", id: "occupation", type: "text", size: "60", name: "occupation", }\n %label{ for: "phone_landline", }\n Phone (landline): \n %input{ atts[:phone_landline], tabindex: "\#{@campo_tabindex += 1}", id: "phone_landline", type: "text", size: "20", name: "phone_landline", }\n %label{ for: "phone_mobile", }\n Phone (mobile): \n %input{ atts[:phone_mobile], tabindex: "\#{@campo_tabindex += 1}", id: "phone_mobile", type: "text", size: "20", name: "phone_mobile", }\n %fieldset{ }\n %legend{ }May we contact you...\n %label{ for: "contactable_day", }\n In the day?\n %input{ atts[:contactable_day], tabindex: "\#{@campo_tabindex += 1}", id: "contactable_day", type: "checkbox", value: "day", name: "contactable", }\n %label{ for: "contactable_evening", }\n In the evening?\n %input{ atts[:contactable_evening], tabindex: "\#{@campo_tabindex += 1}", id: "contactable_evening", type: "checkbox", value: "evening", name: "contactable", }\n %input{ atts[:method], id: "method", type: "hidden", value: "put", name: "method", }\n %input{ atts[:Save], tabindex: "\#{@campo_tabindex += 1}", id: "Save", type: "submit", value: "Save", }\n!
67
+ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", name: "personal_details", method: "POST", action: uri("/my/personal_details/update/"), role: "form", }\n %fieldset{ }\n %legend{ }Your details\n %label{ for: "full_name", }\n Full name: \n %input{ atts[:full_name], tabindex: "\#{@campo_tabindex += 1}", id: "full_name", name: "full_name", type: "text", size: "60", }\n %label{ for: "dob", }\n Date of birth: \n %input{ atts[:dob], tabindex: "\#{@campo_tabindex += 1}", id: "dob", name: "date_of_birth", type: "text", size: "10", }\n %fieldset{ }\n %legend{ }Gender: \n %label{ for: "gender_1", }\n Male\n %input{ atts[:gender_1], tabindex: "\#{@campo_tabindex += 1}", id: "gender_1", name: "gender", type: "radio", value: "1", }\n %label{ for: "gender_2", }\n Female\n %input{ atts[:gender_2], tabindex: "\#{@campo_tabindex += 1}", id: "gender_2", name: "gender", type: "radio", value: "2", }\n %label{ for: "ethnicorigin_id", }\n Ethnic-origin: \n %select{ atts[:ethnicorigin_id], tabindex: "\#{@campo_tabindex += 1}", id: "ethnicorigin_id", name: "ethnicorigin_id", }\n %option{ atts[:ethnicorigin_id_default], id: "ethnicorigin_id_default", name: "ethnicorigin_id", value: "", disabled: "disabled", }Choose one:\n %option{ atts[:ethnicorigin_id_1], id: "ethnicorigin_id_1", name: "ethnicorigin_id", value: "1", }White\n %option{ atts[:ethnicorigin_id_2], id: "ethnicorigin_id_2", name: "ethnicorigin_id", value: "2", }Asian\n %option{ atts[:ethnicorigin_id_3], id: "ethnicorigin_id_3", name: "ethnicorigin_id", value: "3", }Black\n %option{ atts[:ethnicorigin_id_4], id: "ethnicorigin_id_4", name: "ethnicorigin_id", value: "4", }Chinese and Other\n %option{ atts[:ethnicorigin_id_5], id: "ethnicorigin_id_5", name: "ethnicorigin_id", value: "5", }Mixed\n %label{ for: "occupation", }\n Occupation: \n %input{ atts[:occupation], tabindex: "\#{@campo_tabindex += 1}", id: "occupation", name: "occupation", type: "text", size: "60", }\n %label{ for: "phone_landline", }\n Phone (landline): \n %input{ atts[:phone_landline], tabindex: "\#{@campo_tabindex += 1}", id: "phone_landline", name: "phone_landline", type: "text", size: "20", }\n %label{ for: "phone_mobile", }\n Phone (mobile): \n %input{ atts[:phone_mobile], tabindex: "\#{@campo_tabindex += 1}", id: "phone_mobile", name: "phone_mobile", type: "text", size: "20", }\n %fieldset{ }\n %legend{ }May we contact you...\n %label{ for: "contactable_day", }\n In the day?\n %input{ atts[:contactable_day], tabindex: "\#{@campo_tabindex += 1}", id: "contactable_day", name: "contactable", type: "checkbox", value: "day", }\n %label{ for: "contactable_evening", }\n In the evening?\n %input{ atts[:contactable_evening], tabindex: "\#{@campo_tabindex += 1}", id: "contactable_evening", name: "contactable", type: "checkbox", value: "evening", }\n %input{ atts[:method], id: "method", name: "method", type: "hidden", value: "put", }\n %input{ atts[:Save], tabindex: "\#{@campo_tabindex += 1}", id: "Save", type: "submit", value: "Save", }\n!
68
68
  } # let expected
69
69
  context "block with var style" do
70
70
  let(:form) do
@@ -73,7 +73,7 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
73
73
  form.fieldset("Your details") do |f|
74
74
 
75
75
  f.text( "full_name", "Full name: ", size: 60 )
76
- f.text( "dob", "Date of birth: ", size: 10 ) #TODO change this
76
+ f.text( "dob", "Date of birth: ", name: "date_of_birth", size: 10 )
77
77
  f.fieldset( "Gender: " ) do |genders|
78
78
  genders.radio( "gender", "Male", value: 1 )
79
79
  genders.radio( "gender", "Female", value: 2 )
@@ -102,50 +102,50 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
102
102
  }
103
103
  let(:expected) {
104
104
  top_bit + %Q!.centred.form
105
- %form{ atts[:personal_details], id: "personal_details", method: "POST", action: uri("/my/personal_details/update/"), name: "personal_details", role: "form", }
105
+ %form{ atts[:personal_details], id: "personal_details", name: "personal_details", method: "POST", action: uri("/my/personal_details/update/"), role: "form", }
106
106
  %fieldset{ }
107
107
  %legend{ }Your details
108
108
  %label{ for: "full_name", }
109
109
  Full name:
110
- %input{ atts[:full_name], tabindex: "\#{@campo_tabindex += 1}", id: "full_name", type: "text", size: "60", name: "full_name", }
110
+ %input{ atts[:full_name], tabindex: "\#{@campo_tabindex += 1}", id: "full_name", name: "full_name", type: "text", size: "60", }
111
111
  %label{ for: "dob", }
112
112
  Date of birth:
113
- %input{ atts[:dob], tabindex: "\#{@campo_tabindex += 1}", id: "dob", type: "text", size: "10", name: "dob", }
113
+ %input{ atts[:dob], tabindex: "\#{@campo_tabindex += 1}", id: "dob", name: "date_of_birth", type: "text", size: "10", }
114
114
  %fieldset{ }
115
115
  %legend{ }Gender:
116
116
  %label{ for: "gender_1", }
117
117
  Male
118
- %input{ atts[:gender_1], tabindex: "\#{@campo_tabindex += 1}", id: "gender_1", type: "radio", value: "1", name: "gender", }
118
+ %input{ atts[:gender_1], tabindex: "\#{@campo_tabindex += 1}", id: "gender_1", name: "gender", type: "radio", value: "1", }
119
119
  %label{ for: "gender_2", }
120
120
  Female
121
- %input{ atts[:gender_2], tabindex: "\#{@campo_tabindex += 1}", id: "gender_2", type: "radio", value: "2", name: "gender", }
121
+ %input{ atts[:gender_2], tabindex: "\#{@campo_tabindex += 1}", id: "gender_2", name: "gender", type: "radio", value: "2", }
122
122
  %label{ for: "ethnicorigin_id", }
123
123
  Ethnic-origin:
124
124
  %select{ atts[:ethnicorigin_id], tabindex: "\#{@campo_tabindex += 1}", id: "ethnicorigin_id", name: "ethnicorigin_id", }
125
- %option{ atts[:ethnicorigin_id_default], id: "ethnicorigin_id_default", value: "", disabled: "disabled", name: "ethnicorigin_id", }Choose one:
126
- %option{ atts[:ethnicorigin_id_1], id: "ethnicorigin_id_1", value: "1", name: "ethnicorigin_id", }White
127
- %option{ atts[:ethnicorigin_id_2], id: "ethnicorigin_id_2", value: "2", name: "ethnicorigin_id", }Asian
128
- %option{ atts[:ethnicorigin_id_3], id: "ethnicorigin_id_3", value: "3", name: "ethnicorigin_id", }Black
129
- %option{ atts[:ethnicorigin_id_4], id: "ethnicorigin_id_4", value: "4", name: "ethnicorigin_id", }Chinese and Other
130
- %option{ atts[:ethnicorigin_id_5], id: "ethnicorigin_id_5", value: "5", name: "ethnicorigin_id", }Mixed
125
+ %option{ atts[:ethnicorigin_id_default], id: "ethnicorigin_id_default", name: "ethnicorigin_id", value: "", disabled: "disabled", }Choose one:
126
+ %option{ atts[:ethnicorigin_id_1], id: "ethnicorigin_id_1", name: "ethnicorigin_id", value: "1", }White
127
+ %option{ atts[:ethnicorigin_id_2], id: "ethnicorigin_id_2", name: "ethnicorigin_id", value: "2", }Asian
128
+ %option{ atts[:ethnicorigin_id_3], id: "ethnicorigin_id_3", name: "ethnicorigin_id", value: "3", }Black
129
+ %option{ atts[:ethnicorigin_id_4], id: "ethnicorigin_id_4", name: "ethnicorigin_id", value: "4", }Chinese and Other
130
+ %option{ atts[:ethnicorigin_id_5], id: "ethnicorigin_id_5", name: "ethnicorigin_id", value: "5", }Mixed
131
131
  %label{ for: "occupation", }
132
132
  Occupation:
133
- %input{ atts[:occupation], tabindex: "\#{@campo_tabindex += 1}", id: "occupation", type: "text", size: "60", name: "occupation", }
133
+ %input{ atts[:occupation], tabindex: "\#{@campo_tabindex += 1}", id: "occupation", name: "occupation", type: "text", size: "60", }
134
134
  %label{ for: "phone_landline", }
135
135
  Phone (landline):
136
- %input{ atts[:phone_landline], tabindex: "\#{@campo_tabindex += 1}", id: "phone_landline", type: "text", size: "20", name: "phone_landline", }
136
+ %input{ atts[:phone_landline], tabindex: "\#{@campo_tabindex += 1}", id: "phone_landline", name: "phone_landline", type: "text", size: "20", }
137
137
  %label{ for: "phone_mobile", }
138
138
  Phone (mobile):
139
- %input{ atts[:phone_mobile], tabindex: "\#{@campo_tabindex += 1}", id: "phone_mobile", type: "text", size: "20", name: "phone_mobile", }
139
+ %input{ atts[:phone_mobile], tabindex: "\#{@campo_tabindex += 1}", id: "phone_mobile", name: "phone_mobile", type: "text", size: "20", }
140
140
  %fieldset{ }
141
141
  %legend{ }May we contact you...
142
142
  %label{ for: "contactable_day", }
143
143
  In the day?
144
- %input{ atts[:contactable_day], tabindex: "\#{@campo_tabindex += 1}", id: "contactable_day", type: "checkbox", value: "day", name: "contactable", }
144
+ %input{ atts[:contactable_day], tabindex: "\#{@campo_tabindex += 1}", id: "contactable_day", name: "contactable", type: "checkbox", value: "day", }
145
145
  %label{ for: "contactable_evening", }
146
146
  In the evening?
147
- %input{ atts[:contactable_evening], tabindex: "\#{@campo_tabindex += 1}", id: "contactable_evening", type: "checkbox", value: "evening", name: "contactable", }
148
- %input{ atts[:method], id: "method", type: "hidden", value: "put", name: "method", }
147
+ %input{ atts[:contactable_evening], tabindex: "\#{@campo_tabindex += 1}", id: "contactable_evening", name: "contactable", type: "checkbox", value: "evening", }
148
+ %input{ atts[:method], id: "method", name: "method", type: "hidden", value: "put", }
149
149
  %input{ atts[:Save], tabindex: "\#{@campo_tabindex += 1}", id: "Save", type: "submit", value: "Save", }
150
150
  !
151
151
  } # let expected
@@ -159,7 +159,7 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
159
159
  form = Campo.form "personal_details", action: %Q!"uri("/my/personal_details/update/")! do
160
160
  fieldset("Your details") do
161
161
  text( "full_name", "Full name: ", size: 60 )
162
- text( "dob", "Date of birth: ", size: 10 ) #TODO change this
162
+ text( "dob", "Date of birth: ", name: "date_of_birth", size: 10 ) #TODO change this
163
163
  fieldset( "Gender: " ) do
164
164
  radio( "gender", "Male", value: 1 )
165
165
  radio( "gender", "Female", value: 2 )
@@ -182,7 +182,10 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
182
182
  end
183
183
  end
184
184
  end # describe a form
185
+
186
+
185
187
  end
188
+
186
189
 
187
190
  describe Convenience do
188
191
  let(:obj) {
@@ -199,10 +202,10 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
199
202
  context "of text" do
200
203
  context "with a label" do
201
204
  let(:expected) { top_bit + %q!
202
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
205
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
203
206
  %label{ for: "blah", }
204
207
  Blahd
205
- %input{ atts[:blah], tabindex: "#{@campo_tabindex += 1}", id: "blah", type: "text", value: "blahdeblah", name: "blah", }!.strip + "\n" }
208
+ %input{ atts[:blah], tabindex: "#{@campo_tabindex += 1}", id: "blah", name: "blah", type: "text", value: "blahdeblah", }!.strip + "\n" }
206
209
  subject {
207
210
  form.input( "blah", :text, "Blahd", value: "blahdeblah" )
208
211
  Campo.output form
@@ -220,10 +223,10 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
220
223
  end
221
224
  context "without a label" do
222
225
  let(:expected) { top_bit + %q!
223
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
226
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
224
227
  %label{ for: "blah", }
225
228
  Blah
226
- %input{ atts[:blah], tabindex: "#{@campo_tabindex += 1}", id: "blah", type: "text", value: "blahdeblah", name: "blah", }!.strip + "\n" }
229
+ %input{ atts[:blah], tabindex: "#{@campo_tabindex += 1}", id: "blah", name: "blah", type: "text", value: "blahdeblah", }!.strip + "\n" }
227
230
 
228
231
  subject {
229
232
  form.input( "blah", :text, value: "blahdeblah" )
@@ -244,10 +247,10 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
244
247
  end # text
245
248
  context "of checkbox" do
246
249
  let(:expected) { top_bit + %q!
247
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
250
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
248
251
  %label{ for: "blah_blahdeblah", }
249
252
  Blahd
250
- %input{ atts[:blah_blahdeblah], tabindex: "#{@campo_tabindex += 1}", id: "blah_blahdeblah", type: "checkbox", value: "blahdeblah", name: "blah", }!.strip + "\n" }
253
+ %input{ atts[:blah_blahdeblah], tabindex: "#{@campo_tabindex += 1}", id: "blah_blahdeblah", name: "blah", type: "checkbox", value: "blahdeblah", }!.strip + "\n" }
251
254
 
252
255
  subject {
253
256
  form.input( "blah", :checkbox, "Blahd", value: "blahdeblah" )
@@ -270,6 +273,7 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
270
273
 
271
274
  end # Convenience
272
275
 
276
+
273
277
  describe Helpers do
274
278
  describe "self.options_builder" do
275
279
  context "Given a name" do
@@ -439,7 +443,8 @@ top_bit + %Q!%form{ atts[:personal_details], id: "personal_details", method: "PO
439
443
  end
440
444
  end
441
445
  end
442
-
446
+
447
+
443
448
  describe Label do
444
449
  let(:tag) { Label.new( "abc", "A, B, or C?" ) }
445
450
  subject { tag }
@@ -458,13 +463,15 @@ s.chomp
458
463
  end
459
464
  end
460
465
 
466
+
461
467
  describe Form do
462
468
 
463
469
  describe "initialisation" do
464
470
  context "When given no args" do
465
471
  let(:form) { Campo::Form.new }
466
- it { should_not be_nil }
467
- it { should raise_error }
472
+ it "should fail" do
473
+ expect { form }.to raise_error
474
+ end
468
475
  end
469
476
  context "When given a name" do
470
477
  let(:form) { Campo::Form.new( "myform" ) }
@@ -481,7 +488,7 @@ s.chomp
481
488
 
482
489
 
483
490
  context "simple output" do
484
- let(:expected) { %q!%form{ atts[:myform], id: "myform", method: "POST", name: "myform", }! }
491
+ let(:expected) { %q!%form{ atts[:myform], id: "myform", name: "myform", method: "POST", }! }
485
492
  subject { form.output }
486
493
  it { should == expected }
487
494
  end
@@ -493,7 +500,7 @@ s.chomp
493
500
  it { should be_a_kind_of(Form) }
494
501
 
495
502
  context "simple output" do
496
- let(:expected) { %q!%form{ atts[:myform], id: "myform", method: "POST", action: "/", name: "myform", }! }
503
+ let(:expected) { %q!%form{ atts[:myform], id: "myform", name: "myform", method: "POST", action: "/", }! }
497
504
  subject { form.output }
498
505
  it { should == expected }
499
506
  end
@@ -506,7 +513,7 @@ s.chomp
506
513
  context "When given a form with only a name" do
507
514
  let(:form) { Campo::Form.new( "myform" ).fieldset("Do you like these colours? Tick for yes:") }
508
515
  let(:expected) { top_bit + %q!
509
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
516
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
510
517
  %fieldset{ }
511
518
  %legend{ }Do you like these colours? Tick for yes:
512
519
 
@@ -526,14 +533,14 @@ s.chomp
526
533
  let(:form) { Campo::Form.new( "myform" ) }
527
534
  context "Given one select tag" do
528
535
  let(:expected) { top_bit + %q!
529
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
536
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
530
537
  %label{ for: "teas", }
531
538
  Favourite tea:
532
539
  %select{ atts[:teas], tabindex: "#{@campo_tabindex += 1}", id: "teas", name: "teas", }
533
- %option{ atts[:teas_default], id: "teas_default", value: "", disabled: "disabled", name: "teas", }Choose one:
534
- %option{ atts[:teas_ceylon], id: "teas_ceylon", value: "ceylon", name: "teas", }Ceylon
535
- %option{ atts[:teas_breakfast], id: "teas_breakfast", value: "breakfast", name: "teas", }Breakfast
536
- %option{ atts[:teas_earl_grey], id: "teas_earl_grey", value: "earl grey", name: "teas", }Earl grey
540
+ %option{ atts[:teas_default], id: "teas_default", name: "teas", value: "", disabled: "disabled", }Choose one:
541
+ %option{ atts[:teas_ceylon], id: "teas_ceylon", name: "teas", value: "ceylon", }Ceylon
542
+ %option{ atts[:teas_breakfast], id: "teas_breakfast", name: "teas", value: "breakfast", }Breakfast
543
+ %option{ atts[:teas_earl_grey], id: "teas_earl_grey", name: "teas", value: "earl grey", }Earl grey
537
544
 
538
545
  !.strip + "\n"
539
546
  }
@@ -547,22 +554,22 @@ s.chomp
547
554
  end
548
555
  context "Given several select tags" do
549
556
  let(:expected) { top_bit + %q!
550
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
557
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
551
558
  %label{ for: "teas", }
552
559
  Favourite tea:
553
560
  %select{ atts[:teas], tabindex: "#{@campo_tabindex += 1}", id: "teas", name: "teas", }
554
- %option{ atts[:teas_default], id: "teas_default", value: "", disabled: "disabled", name: "teas", }Choose one:
555
- %option{ atts[:teas_ceylon], id: "teas_ceylon", value: "ceylon", name: "teas", }Ceylon
556
- %option{ atts[:teas_breakfast], id: "teas_breakfast", value: "breakfast", name: "teas", }Breakfast
557
- %option{ atts[:teas_earl_grey], id: "teas_earl_grey", value: "earl grey", name: "teas", }Earl grey
561
+ %option{ atts[:teas_default], id: "teas_default", name: "teas", value: "", disabled: "disabled", }Choose one:
562
+ %option{ atts[:teas_ceylon], id: "teas_ceylon", name: "teas", value: "ceylon", }Ceylon
563
+ %option{ atts[:teas_breakfast], id: "teas_breakfast", name: "teas", value: "breakfast", }Breakfast
564
+ %option{ atts[:teas_earl_grey], id: "teas_earl_grey", name: "teas", value: "earl grey", }Earl grey
558
565
  %label{ for: "coffees", }
559
566
  Favourite coffee:
560
567
  %select{ atts[:coffees], tabindex: "#{@campo_tabindex += 1}", id: "coffees", name: "coffees", }
561
- %option{ atts[:coffees_default], id: "coffees_default", value: "", disabled: "disabled", name: "coffees", }Choose one:
562
- %option{ atts[:coffees_blue_mountain], id: "coffees_blue_mountain", value: "blue mountain", name: "coffees", }Blue mountain
563
- %option{ atts[:coffees_kenyan_peaberry], id: "coffees_kenyan_peaberry", value: "kenyan peaberry", name: "coffees", }Kenyan peaberry
564
- %option{ atts[:coffees_colombian], id: "coffees_colombian", value: "colombian", name: "coffees", }Colombian
565
- %option{ atts[:coffees_java], id: "coffees_java", value: "java", name: "coffees", }Java
568
+ %option{ atts[:coffees_default], id: "coffees_default", name: "coffees", value: "", disabled: "disabled", }Choose one:
569
+ %option{ atts[:coffees_blue_mountain], id: "coffees_blue_mountain", name: "coffees", value: "blue mountain", }Blue mountain
570
+ %option{ atts[:coffees_kenyan_peaberry], id: "coffees_kenyan_peaberry", name: "coffees", value: "kenyan peaberry", }Kenyan peaberry
571
+ %option{ atts[:coffees_colombian], id: "coffees_colombian", name: "coffees", value: "colombian", }Colombian
572
+ %option{ atts[:coffees_java], id: "coffees_java", name: "coffees", value: "java", }Java
566
573
 
567
574
  !.strip + "\n" }
568
575
  before {
@@ -581,7 +588,7 @@ s.chomp
581
588
  context "Given a submit button" do
582
589
  context "With no arguments" do
583
590
  let(:expected) { top_bit + %q!
584
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
591
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
585
592
  %input{ atts[:Submit], tabindex: "#{@campo_tabindex += 1}", id: "Submit", type: "submit", value: "Submit", }
586
593
 
587
594
  !.strip + "\n" }
@@ -596,7 +603,7 @@ s.chomp
596
603
  end
597
604
  context "With a name" do
598
605
  let(:expected) { top_bit + %q!
599
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
606
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
600
607
  %input{ atts[:save], tabindex: "#{@campo_tabindex += 1}", id: "save", type: "submit", value: "Save", }
601
608
 
602
609
  !.strip + "\n" }
@@ -659,7 +666,7 @@ s.chomp
659
666
 
660
667
  describe "the full output" do
661
668
  let(:expected) { top_bit + %q$
662
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
669
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
663
670
  Hello, World!$.strip + "\n"}
664
671
  let(:form){
665
672
  form = Campo::Form.new( "myform" )
@@ -685,7 +692,7 @@ s.chomp
685
692
  end
686
693
  Campo.output form
687
694
  }
688
- let(:expected) { top_bit + %q$%form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
695
+ let(:expected) { top_bit + %q$%form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
689
696
  %p
690
697
  Whatever
691
698
  %br
@@ -730,7 +737,7 @@ $.strip + "\n" }
730
737
 
731
738
  describe "the full output" do
732
739
  let(:expected) { top_bit + %q!
733
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
740
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
734
741
  = 5 + 1!.strip + "\n"}
735
742
  let(:form){
736
743
  form = Campo::Form.new( "myform" )
@@ -755,7 +762,7 @@ $.strip + "\n" }
755
762
  end
756
763
  Campo.output form
757
764
  }
758
- let(:expected) { top_bit + %q$%form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
765
+ let(:expected) { top_bit + %q$%form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
759
766
  = 5 + 1
760
767
  ="%p"
761
768
  Whatever
@@ -813,7 +820,7 @@ $.strip + "\n" }
813
820
 
814
821
  context "Campo.output" do
815
822
  let(:expected) { %q!%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
816
- %option{ atts[:pqr_default], id: "pqr_default", value: "", disabled: "disabled", name: "pqr", }Choose one:!.strip + "\n" }
823
+ %option{ atts[:pqr_default], id: "pqr_default", name: "pqr", value: "", disabled: "disabled", }Choose one:!.strip + "\n" }
817
824
  subject { Campo.output tag.with_default, :partial=>true }
818
825
  it { should == expected }
819
826
  end
@@ -827,7 +834,7 @@ $.strip + "\n" }
827
834
 
828
835
  context "Campo.output" do
829
836
  let(:expected) { %q<%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
830
- %option{ atts[:pqr_default], id: "pqr_default", value: "", disabled: "disabled", name: "pqr", }Choose wisely!>.strip + "\n" }
837
+ %option{ atts[:pqr_default], id: "pqr_default", name: "pqr", value: "", disabled: "disabled", }Choose wisely!>.strip + "\n" }
831
838
  subject { Campo.output tag.with_default("Choose wisely!"), :partial=>true }
832
839
  it { should == expected }
833
840
  end
@@ -840,7 +847,7 @@ $.strip + "\n" }
840
847
 
841
848
  context "Campo.output" do
842
849
  let(:expected) { %q<%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
843
- %option{ atts[:pqr_default], id: "pqr_default", value: "", name: "pqr", }Choose wisely!>.strip + "\n" }
850
+ %option{ atts[:pqr_default], id: "pqr_default", name: "pqr", value: "", }Choose wisely!>.strip + "\n" }
844
851
  subject { Campo.output tag.with_default("Choose wisely!",{}), :partial=>true }
845
852
  it { should == expected }
846
853
  end
@@ -853,7 +860,7 @@ $.strip + "\n" }
853
860
 
854
861
  context "Campo.output" do
855
862
  let(:expected) { %q<%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
856
- %option{ atts[:pqr_default], id: "pqr_default", value: "", class: "default", name: "pqr", }Choose wisely!>.strip + "\n" }
863
+ %option{ atts[:pqr_default], id: "pqr_default", name: "pqr", value: "", class: "default", }Choose wisely!>.strip + "\n" }
857
864
  subject { Campo.output tag.with_default("Choose wisely!",{class: "default"}), :partial=>true }
858
865
  it { should == expected }
859
866
  end
@@ -880,9 +887,9 @@ $.strip + "\n" }
880
887
 
881
888
  context "Campo.output" do
882
889
  let(:expected) { %q!%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
883
- %option{ atts[:pqr_volvo], id: "pqr_volvo", value: "volvo", name: "pqr", }Volvo
884
- %option{ atts[:pqr_saab], id: "pqr_saab", value: "saab", name: "pqr", }Saab
885
- %option{ atts[:pqr_audi], id: "pqr_audi", value: "audi", name: "pqr", }Audi
890
+ %option{ atts[:pqr_volvo], id: "pqr_volvo", name: "pqr", value: "volvo", }Volvo
891
+ %option{ atts[:pqr_saab], id: "pqr_saab", name: "pqr", value: "saab", }Saab
892
+ %option{ atts[:pqr_audi], id: "pqr_audi", name: "pqr", value: "audi", }Audi
886
893
  !.strip + "\n" }
887
894
  subject { Campo.output tag, :partial=>true }
888
895
  it { should_not be_nil }
@@ -899,10 +906,10 @@ $.strip + "\n" }
899
906
 
900
907
  context "Campo.output" do
901
908
  let(:expected) { %q!%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
902
- %option{ atts[:pqr_default], id: "pqr_default", value: "", disabled: "disabled", name: "pqr", }Choose one:
903
- %option{ atts[:pqr_volvo], id: "pqr_volvo", value: "volvo", name: "pqr", }Volvo
904
- %option{ atts[:pqr_saab], id: "pqr_saab", value: "saab", name: "pqr", }Saab
905
- %option{ atts[:pqr_audi], id: "pqr_audi", value: "audi", name: "pqr", }Audi
909
+ %option{ atts[:pqr_default], id: "pqr_default", name: "pqr", value: "", disabled: "disabled", }Choose one:
910
+ %option{ atts[:pqr_volvo], id: "pqr_volvo", name: "pqr", value: "volvo", }Volvo
911
+ %option{ atts[:pqr_saab], id: "pqr_saab", name: "pqr", value: "saab", }Saab
912
+ %option{ atts[:pqr_audi], id: "pqr_audi", name: "pqr", value: "audi", }Audi
906
913
  !.strip + "\n" }
907
914
  subject { Campo.output tag.with_default, :partial=>true }
908
915
  it { should == expected }
@@ -923,9 +930,9 @@ $.strip + "\n" }
923
930
 
924
931
  context "Campo.output" do
925
932
  let(:expected) { %q!%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
926
- %option{ atts[:pqr_volvo], id: "pqr_volvo", value: "volvo", name: "pqr", }Volvo
927
- %option{ atts[:pqr_saab], id: "pqr_saab", value: "saab", name: "pqr", }Saab
928
- %option{ atts[:pqr_audi], id: "pqr_audi", value: "audi", name: "pqr", }Audi
933
+ %option{ atts[:pqr_volvo], id: "pqr_volvo", name: "pqr", value: "volvo", }Volvo
934
+ %option{ atts[:pqr_saab], id: "pqr_saab", name: "pqr", value: "saab", }Saab
935
+ %option{ atts[:pqr_audi], id: "pqr_audi", name: "pqr", value: "audi", }Audi
929
936
  = opts!.strip + "\n" }
930
937
  subject {
931
938
  Campo.output tag, :partial=>true
@@ -950,9 +957,9 @@ $.strip + "\n" }
950
957
  }
951
958
  let(:expected) {
952
959
  %q!%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
953
- %option{ atts[:pqr_ford], id: "pqr_ford", value: "ford", name: "pqr", }Ford
954
- %option{ atts[:pqr_bmw], id: "pqr_bmw", value: "bmw", name: "pqr", }Bmw
955
- %option{ atts[:pqr_ferrari], id: "pqr_ferrari", value: "ferrari", selected: "selected", name: "pqr", }Ferrari!.strip + "\n" }
960
+ %option{ atts[:pqr_ford], id: "pqr_ford", name: "pqr", value: "ford", }Ford
961
+ %option{ atts[:pqr_bmw], id: "pqr_bmw", name: "pqr", value: "bmw", }Bmw
962
+ %option{ atts[:pqr_ferrari], id: "pqr_ferrari", name: "pqr", value: "ferrari", selected: "selected", }Ferrari!.strip + "\n" }
956
963
  subject { Campo.output tag, :partial=>true }
957
964
  it { should_not be_nil }
958
965
  it { should == expected }
@@ -984,12 +991,12 @@ $.strip + "\n" }
984
991
 
985
992
  context "Campo.output" do
986
993
  let(:expected) { %q!%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
987
- %option{ atts[:pqr_volvo], id: "pqr_volvo", value: "volvo", name: "pqr", }Volvo
988
- %option{ atts[:pqr_saab], id: "pqr_saab", value: "saab", name: "pqr", }Saab
989
- %option{ atts[:pqr_audi], id: "pqr_audi", value: "audi", name: "pqr", }Audi
990
- %option{ atts[:pqr_ford], id: "pqr_ford", value: "ford", name: "pqr", }Ford
991
- %option{ atts[:pqr_bmw], id: "pqr_bmw", value: "bmw", name: "pqr", }BMW
992
- %option{ atts[:pqr_ferrari], id: "pqr_ferrari", value: "ferrari", selected: "selected", name: "pqr", }Ferrari!.strip + "\n" }
994
+ %option{ atts[:pqr_volvo], id: "pqr_volvo", name: "pqr", value: "volvo", }Volvo
995
+ %option{ atts[:pqr_saab], id: "pqr_saab", name: "pqr", value: "saab", }Saab
996
+ %option{ atts[:pqr_audi], id: "pqr_audi", name: "pqr", value: "audi", }Audi
997
+ %option{ atts[:pqr_ford], id: "pqr_ford", name: "pqr", value: "ford", }Ford
998
+ %option{ atts[:pqr_bmw], id: "pqr_bmw", name: "pqr", value: "bmw", }BMW
999
+ %option{ atts[:pqr_ferrari], id: "pqr_ferrari", name: "pqr", value: "ferrari", selected: "selected", }Ferrari!.strip + "\n" }
993
1000
  subject { Campo.output tag, :partial=>true }
994
1001
  it { should_not be_nil }
995
1002
  it { should == expected }
@@ -1004,12 +1011,12 @@ $.strip + "\n" }
1004
1011
  end
1005
1012
  }
1006
1013
  let(:expected) { %q!%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
1007
- %option{ atts[:pqr_volvo], id: "pqr_volvo", value: "volvo", name: "pqr", }Volvo
1008
- %option{ atts[:pqr_saab], id: "pqr_saab", value: "saab", name: "pqr", }Saab
1009
- %option{ atts[:pqr_audi], id: "pqr_audi", value: "audi", name: "pqr", }Audi
1010
- %option{ atts[:pqr_ford], id: "pqr_ford", value: "ford", class: "blue", name: "pqr", }Ford
1011
- %option{ atts[:pqr_bmw], id: "pqr_bmw", value: "bmw", name: "pqr", }BMW
1012
- %option{ atts[:pqr_ferrari], id: "pqr_ferrari", value: "ferrari", selected: "selected", class: "green", name: "pqr", }Ferrari!.strip + "\n" }
1014
+ %option{ atts[:pqr_volvo], id: "pqr_volvo", name: "pqr", value: "volvo", }Volvo
1015
+ %option{ atts[:pqr_saab], id: "pqr_saab", name: "pqr", value: "saab", }Saab
1016
+ %option{ atts[:pqr_audi], id: "pqr_audi", name: "pqr", value: "audi", }Audi
1017
+ %option{ atts[:pqr_ford], id: "pqr_ford", name: "pqr", value: "ford", class: "blue", }Ford
1018
+ %option{ atts[:pqr_bmw], id: "pqr_bmw", name: "pqr", value: "bmw", }BMW
1019
+ %option{ atts[:pqr_ferrari], id: "pqr_ferrari", name: "pqr", value: "ferrari", selected: "selected", class: "green", }Ferrari!.strip + "\n" }
1013
1020
  subject { Campo.output tag, :partial=>true }
1014
1021
  it { should_not be_nil }
1015
1022
  it { should == expected }
@@ -1025,13 +1032,13 @@ $.strip + "\n" }
1025
1032
 
1026
1033
  context "Campo.output" do
1027
1034
  let(:expected) { %q!%select{ atts[:pqr], tabindex: "#{@campo_tabindex += 1}", id: "pqr", name: "pqr", }
1028
- %option{ atts[:pqr_default], id: "pqr_default", value: "", disabled: "disabled", name: "pqr", }Choose one:
1029
- %option{ atts[:pqr_volvo], id: "pqr_volvo", value: "volvo", name: "pqr", }Volvo
1030
- %option{ atts[:pqr_saab], id: "pqr_saab", value: "saab", name: "pqr", }Saab
1031
- %option{ atts[:pqr_audi], id: "pqr_audi", value: "audi", name: "pqr", }Audi
1032
- %option{ atts[:pqr_ford], id: "pqr_ford", value: "ford", name: "pqr", }Ford
1033
- %option{ atts[:pqr_bmw], id: "pqr_bmw", value: "bmw", name: "pqr", }BMW
1034
- %option{ atts[:pqr_ferrari], id: "pqr_ferrari", value: "ferrari", selected: "selected", name: "pqr", }Ferrari!.strip + "\n" }
1035
+ %option{ atts[:pqr_default], id: "pqr_default", name: "pqr", value: "", disabled: "disabled", }Choose one:
1036
+ %option{ atts[:pqr_volvo], id: "pqr_volvo", name: "pqr", value: "volvo", }Volvo
1037
+ %option{ atts[:pqr_saab], id: "pqr_saab", name: "pqr", value: "saab", }Saab
1038
+ %option{ atts[:pqr_audi], id: "pqr_audi", name: "pqr", value: "audi", }Audi
1039
+ %option{ atts[:pqr_ford], id: "pqr_ford", name: "pqr", value: "ford", }Ford
1040
+ %option{ atts[:pqr_bmw], id: "pqr_bmw", name: "pqr", value: "bmw", }BMW
1041
+ %option{ atts[:pqr_ferrari], id: "pqr_ferrari", name: "pqr", value: "ferrari", selected: "selected", }Ferrari!.strip + "\n" }
1035
1042
  subject { Campo.output tag.with_default, :partial=>true }
1036
1043
  it { should == expected }
1037
1044
  end
@@ -1054,7 +1061,7 @@ $.strip + "\n" }
1054
1061
 
1055
1062
  it { should_not be_nil }
1056
1063
  it { should be_a_kind_of(Select) }
1057
- specify { Campo.output( subject, :partial=>true ).should == %Q!%select{ atts[:tea], tabindex: "\#{@campo_tabindex += 1}", id: "tea", name: "tea", }\n %option{ atts[:tea_ceylon], id: "tea_ceylon", value: "ceylon", name: "tea", }Ceylon\n %option{ atts[:tea_english_breakfast], id: "tea_english_breakfast", value: "english_breakfast", name: "tea", }English breakfast\n %option{ atts[:tea_earl_grey], id: "tea_earl_grey", value: "earl_grey", name: "tea", }Earl grey\n! }
1064
+ specify { Campo.output( subject, :partial=>true ).should == %Q!%select{ atts[:tea], tabindex: "\#{@campo_tabindex += 1}", id: "tea", name: "tea", }\n %option{ atts[:tea_ceylon], id: "tea_ceylon", name: "tea", value: "ceylon", }Ceylon\n %option{ atts[:tea_english_breakfast], id: "tea_english_breakfast", name: "tea", value: "english_breakfast", }English breakfast\n %option{ atts[:tea_earl_grey], id: "tea_earl_grey", name: "tea", value: "earl_grey", }Earl grey\n! }
1058
1065
  end
1059
1066
  context "and a single string value" do
1060
1067
  let(:opts) {
@@ -1071,7 +1078,7 @@ $.strip + "\n" }
1071
1078
 
1072
1079
  it { should_not be_nil }
1073
1080
  it { should be_a_kind_of(Select) }
1074
- specify { Campo.output( subject, :partial=>true ).should == %Q!%select{ atts[:tea], tabindex: "\#{@campo_tabindex += 1}", id: "tea", name: "tea", }\n %option{ atts[:tea_ceylon], id: "tea_ceylon", value: "ceylon", name: "tea", }Ceylon\n %option{ atts[:tea_english_breakfast], id: "tea_english_breakfast", value: "english_breakfast", name: "tea", }English Breakfast\n %option{ atts[:tea_earl_grey], id: "tea_earl_grey", value: "earl_grey", name: "tea", }Earl Grey\n! }
1081
+ specify { Campo.output( subject, :partial=>true ).should == %Q!%select{ atts[:tea], tabindex: "\#{@campo_tabindex += 1}", id: "tea", name: "tea", }\n %option{ atts[:tea_ceylon], id: "tea_ceylon", name: "tea", value: "ceylon", }Ceylon\n %option{ atts[:tea_english_breakfast], id: "tea_english_breakfast", name: "tea", value: "english_breakfast", }English Breakfast\n %option{ atts[:tea_earl_grey], id: "tea_earl_grey", name: "tea", value: "earl_grey", }Earl Grey\n! }
1075
1082
  end
1076
1083
  context "and an array value" do
1077
1084
  let(:opts) {
@@ -1088,7 +1095,7 @@ $.strip + "\n" }
1088
1095
 
1089
1096
  it { should_not be_nil }
1090
1097
  it { should be_a_kind_of(Select) }
1091
- specify { Campo.output( subject, :partial=>true ).should == %Q!%select{ atts[:tea], tabindex: "\#{@campo_tabindex += 1}", id: "tea", name: "tea", }\n %option{ atts[:tea_ceylon], id: "tea_ceylon", value: "ceylon", name: "tea", }Ceylon\n %option{ atts[:tea_english_breakfast], id: "tea_english_breakfast", value: "english_breakfast", selected: "selected", name: "tea", }English Breakfast\n %option{ atts[:tea_earl_grey], id: "tea_earl_grey", value: "earl_grey", name: "tea", }Earl Grey\n! }
1098
+ specify { Campo.output( subject, :partial=>true ).should == %Q!%select{ atts[:tea], tabindex: "\#{@campo_tabindex += 1}", id: "tea", name: "tea", }\n %option{ atts[:tea_ceylon], id: "tea_ceylon", name: "tea", value: "ceylon", }Ceylon\n %option{ atts[:tea_english_breakfast], id: "tea_english_breakfast", name: "tea", value: "english_breakfast", selected: "selected", }English Breakfast\n %option{ atts[:tea_earl_grey], id: "tea_earl_grey", name: "tea", value: "earl_grey", }Earl Grey\n! }
1092
1099
  end
1093
1100
  end
1094
1101
  end
@@ -1107,7 +1114,7 @@ $.strip + "\n" }
1107
1114
  context "Given a name" do
1108
1115
  context "and nothing else" do
1109
1116
  let(:tag) { Campo::Input.new( "abc" ) }
1110
- let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", type: "text", name: "abc", }! }
1117
+ let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", name: "abc", type: "text", }! }
1111
1118
  subject { tag }
1112
1119
  it { should_not be_nil }
1113
1120
  it { should be_a_kind_of(Input) }
@@ -1124,7 +1131,7 @@ $.strip + "\n" }
1124
1131
  context "and a type" do
1125
1132
  context "of text" do
1126
1133
  let(:tag) { Campo::Input.new( "abc", :text ) }
1127
- let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", type: "text", name: "abc", }! }
1134
+ let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", name: "abc", type: "text", }! }
1128
1135
  subject { tag }
1129
1136
  it { should_not be_nil }
1130
1137
  it { should be_a_kind_of(Input) }
@@ -1139,7 +1146,7 @@ $.strip + "\n" }
1139
1146
  end
1140
1147
  context "of password" do
1141
1148
  let(:tag) { Campo::Input.new( "abc", :password ) }
1142
- let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", type: "password", name: "abc", }! }
1149
+ let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", name: "abc", type: "password", }! }
1143
1150
  subject { tag }
1144
1151
  it { should_not be_nil }
1145
1152
  it { should be_a_kind_of(Input) }
@@ -1156,7 +1163,7 @@ $.strip + "\n" }
1156
1163
  end
1157
1164
  context "of checkbox" do
1158
1165
  let(:tag) { Campo::Input.new( "abc", :checkbox ) }
1159
- let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", type: "checkbox", name: "abc", }! }
1166
+ let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", name: "abc", type: "checkbox", }! }
1160
1167
  subject { tag }
1161
1168
  it { should_not be_nil }
1162
1169
  it { should be_a_kind_of(Input) }
@@ -1174,7 +1181,7 @@ $.strip + "\n" }
1174
1181
 
1175
1182
  context "Given an input with a [] to notify it's an array" do
1176
1183
  let(:tag) { Campo::Input.new( "abc[]", :checkbox, value: "many" ) }
1177
- let(:output) { %q!%input{ atts[:abc_many], tabindex: "#{@campo_tabindex += 1}", id: "abc_many", type: "checkbox", value: "many", name: "abc[]", }! }
1184
+ let(:output) { %q!%input{ atts[:abc_many], tabindex: "#{@campo_tabindex += 1}", id: "abc_many", name: "abc[]", type: "checkbox", value: "many", }! }
1178
1185
  subject { tag }
1179
1186
  it { should_not be_nil }
1180
1187
  it { should be_a_kind_of(Input) }
@@ -1193,29 +1200,29 @@ $.strip + "\n" }
1193
1200
  - inners = {} if inners.nil?
1194
1201
  - inners.default = "" if inners.default.nil?
1195
1202
  - @campo_tabindex ||= 0 # for tabindex
1196
- %form{ atts[:example], id: "example", method: "POST", name: "example", role: "form", }
1203
+ %form{ atts[:example], id: "example", name: "example", method: "POST", role: "form", }
1197
1204
  %label{ for: "a", }
1198
1205
  A
1199
- %input{ atts[:a], tabindex: "#{@campo_tabindex += 1}", id: "a", type: "text", name: "a", }
1206
+ %input{ atts[:a], tabindex: "#{@campo_tabindex += 1}", id: "a", name: "a", type: "text", }
1200
1207
  %label{ for: "b", }
1201
1208
  B
1202
- %input{ atts[:b], tabindex: "#{@campo_tabindex += 1}", id: "b", type: "text", name: "b", }
1209
+ %input{ atts[:b], tabindex: "#{@campo_tabindex += 1}", id: "b", name: "b", type: "text", }
1203
1210
  %fieldset{ }
1204
1211
  %legend{ }Which C?
1205
1212
  %label{ for: "c_grouped", }
1206
1213
  Grouped
1207
- %input{ atts[:c_grouped], tabindex: "#{@campo_tabindex += 1}", id: "c_grouped", type: "checkbox", value: "grouped", name: "c", }
1214
+ %input{ atts[:c_grouped], tabindex: "#{@campo_tabindex += 1}", id: "c_grouped", name: "c", type: "checkbox", value: "grouped", }
1208
1215
  %label{ for: "c", }
1209
1216
  Also grouped
1210
- %input{ atts[:c], tabindex: "#{@campo_tabindex += 1}", id: "c", type: "checkbox", valued: "also grouped", name: "c", }
1217
+ %input{ atts[:c], tabindex: "#{@campo_tabindex += 1}", id: "c", name: "c", type: "checkbox", valued: "also grouped", }
1211
1218
  %fieldset{ }
1212
1219
  %legend{ }Which D?
1213
1220
  %label{ for: "d_grouped", }
1214
1221
  Grouped
1215
- %input{ atts[:d_grouped], tabindex: "#{@campo_tabindex += 1}", id: "d_grouped", type: "checkbox", value: "grouped", name: "d[]", }
1222
+ %input{ atts[:d_grouped], tabindex: "#{@campo_tabindex += 1}", id: "d_grouped", name: "d[]", type: "checkbox", value: "grouped", }
1216
1223
  %label{ for: "d_also_grouped", }
1217
1224
  Also grouped
1218
- %input{ atts[:d_also_grouped], tabindex: "#{@campo_tabindex += 1}", id: "d_also_grouped", type: "checkbox", value: "also grouped", name: "d[]", }
1225
+ %input{ atts[:d_also_grouped], tabindex: "#{@campo_tabindex += 1}", id: "d_also_grouped", name: "d[]", type: "checkbox", value: "also grouped", }
1219
1226
  %input{ atts[:Submit], tabindex: "#{@campo_tabindex += 1}", id: "Submit", type: "submit", value: "Submit", }
1220
1227
  !
1221
1228
  }
@@ -1244,7 +1251,7 @@ $.strip + "\n" }
1244
1251
 
1245
1252
  context "of radio" do
1246
1253
  let(:tag) { Campo::Input.new( "abc", :radio ) }
1247
- let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", type: "radio", name: "abc", }! }
1254
+ let(:output) { %q!%input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", name: "abc", type: "radio", }! }
1248
1255
  subject { tag }
1249
1256
  it { should_not be_nil }
1250
1257
  it { should be_a_kind_of(Input) }
@@ -1265,16 +1272,16 @@ $.strip + "\n" }
1265
1272
  context "Labelling" do
1266
1273
  let(:expected) {
1267
1274
  top_bit + %q!
1268
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
1275
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
1269
1276
  %label{ for: "abc", }
1270
1277
  abc
1271
- %input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", type: "text", name: "abc", }
1278
+ %input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", name: "abc", type: "text", }
1272
1279
  %label{ for: "deff", }
1273
1280
  deff
1274
- %input{ atts[:deff], tabindex: "#{@campo_tabindex += 1}", id: "deff", type: "text", name: "deff", }
1281
+ %input{ atts[:deff], tabindex: "#{@campo_tabindex += 1}", id: "deff", name: "deff", type: "text", }
1275
1282
  %label{ for: "ghi", }
1276
1283
  ghi
1277
- %input{ atts[:ghi], tabindex: "#{@campo_tabindex += 1}", id: "ghi", type: "text", name: "ghi", }
1284
+ %input{ atts[:ghi], tabindex: "#{@campo_tabindex += 1}", id: "ghi", name: "ghi", type: "text", }
1278
1285
 
1279
1286
  !.strip + "\n"
1280
1287
  }
@@ -1292,18 +1299,18 @@ $.strip + "\n" }
1292
1299
  context "Within a fieldset" do
1293
1300
  let(:expected) {
1294
1301
  top_bit + %q!
1295
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
1302
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
1296
1303
  %fieldset{ }
1297
1304
  %legend{ }Alphabetty spaghetti
1298
1305
  %label{ for: "abc", }
1299
1306
  Abc
1300
- %input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", type: "text", name: "abc", }
1307
+ %input{ atts[:abc], tabindex: "#{@campo_tabindex += 1}", id: "abc", name: "abc", type: "text", }
1301
1308
  %label{ for: "def", }
1302
1309
  Def
1303
- %input{ atts[:def], tabindex: "#{@campo_tabindex += 1}", id: "def", type: "text", name: "def", }
1310
+ %input{ atts[:def], tabindex: "#{@campo_tabindex += 1}", id: "def", name: "def", type: "text", }
1304
1311
  %label{ for: "ghi", }
1305
1312
  Ghi
1306
- %input{ atts[:ghi], tabindex: "#{@campo_tabindex += 1}", id: "ghi", type: "text", name: "ghi", }
1313
+ %input{ atts[:ghi], tabindex: "#{@campo_tabindex += 1}", id: "ghi", name: "ghi", type: "text", }
1307
1314
 
1308
1315
  !.strip + "\n"
1309
1316
  }
@@ -1327,24 +1334,24 @@ $.strip + "\n" }
1327
1334
  describe "A form with a group of radio buttons" do
1328
1335
  let(:expected) {
1329
1336
  top_bit + %q!
1330
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
1337
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
1331
1338
  %fieldset{ }
1332
1339
  %legend{ }Select the colour you like most:
1333
1340
  %label{ for: "radio1_green", }
1334
1341
  green
1335
- %input{ atts[:radio1_green], tabindex: "#{@campo_tabindex += 1}", id: "radio1_green", type: "radio", value: "green", name: "radio1", }
1342
+ %input{ atts[:radio1_green], tabindex: "#{@campo_tabindex += 1}", id: "radio1_green", name: "radio1", type: "radio", value: "green", }
1336
1343
  %label{ for: "radio1_yellow", }
1337
1344
  yellow
1338
- %input{ atts[:radio1_yellow], tabindex: "#{@campo_tabindex += 1}", id: "radio1_yellow", type: "radio", value: "yellow", name: "radio1", }
1345
+ %input{ atts[:radio1_yellow], tabindex: "#{@campo_tabindex += 1}", id: "radio1_yellow", name: "radio1", type: "radio", value: "yellow", }
1339
1346
  %label{ for: "radio1_red", }
1340
1347
  red
1341
- %input{ atts[:radio1_red], tabindex: "#{@campo_tabindex += 1}", id: "radio1_red", type: "radio", value: "red", name: "radio1", }
1348
+ %input{ atts[:radio1_red], tabindex: "#{@campo_tabindex += 1}", id: "radio1_red", name: "radio1", type: "radio", value: "red", }
1342
1349
  %label{ for: "radio1_blue", }
1343
1350
  blue
1344
- %input{ atts[:radio1_blue], tabindex: "#{@campo_tabindex += 1}", id: "radio1_blue", type: "radio", value: "blue", name: "radio1", }
1351
+ %input{ atts[:radio1_blue], tabindex: "#{@campo_tabindex += 1}", id: "radio1_blue", name: "radio1", type: "radio", value: "blue", }
1345
1352
  %label{ for: "radio1_purple", }
1346
1353
  purple
1347
- %input{ atts[:radio1_purple], tabindex: "#{@campo_tabindex += 1}", id: "radio1_purple", type: "radio", value: "purple", name: "radio1", }
1354
+ %input{ atts[:radio1_purple], tabindex: "#{@campo_tabindex += 1}", id: "radio1_purple", name: "radio1", type: "radio", value: "purple", }
1348
1355
 
1349
1356
  !.strip + "\n"
1350
1357
  }
@@ -1368,8 +1375,10 @@ $.strip + "\n" }
1368
1375
 
1369
1376
  describe Textarea do
1370
1377
  context "Given no arguments" do
1371
- it { should_not be_nil }
1372
- it { should raise_error }
1378
+ subject { Textarea.new }
1379
+ it "should fail" do
1380
+ expect { subject }.should raise_error
1381
+ end
1373
1382
  end
1374
1383
  context "Given a name" do
1375
1384
  subject { Textarea.new( "textie" ) }
@@ -1386,10 +1395,10 @@ $.strip + "\n" }
1386
1395
 
1387
1396
  describe "the full output" do
1388
1397
  let(:expected) { top_bit + %q!
1389
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
1398
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
1390
1399
  %label{ for: "textie", }
1391
1400
  Textie
1392
- %textarea{ atts[:textie], tabindex: "#{@campo_tabindex += 1}", id: "textie", cols: "40", rows: "10", name: "textie", }= inners[:textie] !.strip + " \n"}
1401
+ %textarea{ atts[:textie], tabindex: "#{@campo_tabindex += 1}", id: "textie", name: "textie", cols: "40", rows: "10", }= inners[:textie] !.strip + " \n"}
1393
1402
  let(:form){
1394
1403
  form = Campo::Form.new( "myform" )
1395
1404
  form.textarea( "textie" )
@@ -1407,10 +1416,10 @@ $.strip + "\n" }
1407
1416
 
1408
1417
  describe "the full output" do
1409
1418
  let(:expected) { top_bit + %q!
1410
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
1419
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
1411
1420
  %label{ for: "textie", }
1412
1421
  Textie labelled
1413
- %textarea{ atts[:textie], tabindex: "#{@campo_tabindex += 1}", id: "textie", cols: "40", rows: "10", name: "textie", }= inners[:textie] !.strip + " \n"}
1422
+ %textarea{ atts[:textie], tabindex: "#{@campo_tabindex += 1}", id: "textie", name: "textie", cols: "40", rows: "10", }= inners[:textie] !.strip + " \n"}
1414
1423
  let(:form){
1415
1424
  form = Campo::Form.new( "myform" )
1416
1425
  form.textarea( "textie", labelled: "Textie labelled")
@@ -1436,10 +1445,10 @@ $.strip + "\n" }
1436
1445
 
1437
1446
  describe "the full output" do
1438
1447
  let(:expected) { top_bit + %q!
1439
- %form{ atts[:myform], id: "myform", method: "POST", name: "myform", role: "form", }
1448
+ %form{ atts[:myform], id: "myform", name: "myform", method: "POST", role: "form", }
1440
1449
  %label{ for: "textie", }
1441
1450
  Textie
1442
- %textarea{ atts[:textie], tabindex: "#{@campo_tabindex += 1}", id: "textie", cols: "60", rows: "10", name: "textie", }= inners[:textie]
1451
+ %textarea{ atts[:textie], tabindex: "#{@campo_tabindex += 1}", id: "textie", name: "textie", cols: "60", rows: "10", }= inners[:textie]
1443
1452
  !.strip + " \n"}
1444
1453
  let(:form){
1445
1454
  form = Campo::Form.new( "myform" )
@@ -83,13 +83,13 @@ let(:expected) {
83
83
  .form
84
84
  %label{ for: "a", class: "required", }
85
85
  A
86
- %input{ atts[:a], tabindex: "#{@campo_tabindex += 1}", id: "a", type: "text", name: "a", class: "required", }
86
+ %input{ atts[:a], tabindex: "#{@campo_tabindex += 1}", id: "a", name: "a", type: "text", class: "required", }
87
87
  %label{ for: "c", }
88
88
  C
89
- %input{ atts[:c], tabindex: "#{@campo_tabindex += 1}", id: "c", type: "text", name: "c", }
89
+ %input{ atts[:c], tabindex: "#{@campo_tabindex += 1}", id: "c", name: "c", type: "text", }
90
90
  %label{ for: "g", class: "required", }
91
91
  G
92
- %input{ atts[:g], tabindex: "#{@campo_tabindex += 1}", id: "g", type: "text", size: "3", name: "g", class: "required", }
92
+ %input{ atts[:g], tabindex: "#{@campo_tabindex += 1}", id: "g", name: "g", type: "text", size: "3", class: "required", }
93
93
  STR
94
94
  }
95
95
 
@@ -139,28 +139,28 @@ STR
139
139
  - inners = {} if inners.nil?
140
140
  - inners.default = "" if inners.default.nil?
141
141
  - @campo_tabindex ||= 0 # for tabindex
142
- %form{ atts[:exampleform], id: "exampleForm", method: "POST", name: "exampleForm", role: "form", }
142
+ %form{ atts[:exampleform], id: "exampleForm", name: "exampleForm", method: "POST", role: "form", }
143
143
  %label{ for: "a", class: "required", }
144
144
  A
145
- %input{ atts[:a], tabindex: "#{@campo_tabindex += 1}", id: "a", type: "text", name: "a", class: "required", }
145
+ %input{ atts[:a], tabindex: "#{@campo_tabindex += 1}", id: "a", name: "a", type: "text", class: "required", }
146
146
  %label{ for: "b", class: "required", }
147
147
  B
148
- %input{ atts[:b], tabindex: "#{@campo_tabindex += 1}", id: "b", type: "text", name: "b", class: "required", }
148
+ %input{ atts[:b], tabindex: "#{@campo_tabindex += 1}", id: "b", name: "b", type: "text", class: "required", }
149
149
  %label{ for: "c", }
150
150
  C
151
- %input{ atts[:c], tabindex: "#{@campo_tabindex += 1}", id: "c", type: "text", name: "c", }
151
+ %input{ atts[:c], tabindex: "#{@campo_tabindex += 1}", id: "c", name: "c", type: "text", }
152
152
  %label{ for: "d", }
153
153
  D
154
- %input{ atts[:d], tabindex: "#{@campo_tabindex += 1}", id: "d", type: "text", size: "2", name: "d", }
154
+ %input{ atts[:d], tabindex: "#{@campo_tabindex += 1}", id: "d", name: "d", type: "text", size: "2", }
155
155
  %label{ for: "e", class: "required", }
156
156
  E
157
- %input{ atts[:e], tabindex: "#{@campo_tabindex += 1}", id: "e", type: "text", size: "5", name: "e", class: "required", }
157
+ %input{ atts[:e], tabindex: "#{@campo_tabindex += 1}", id: "e", name: "e", type: "text", size: "5", class: "required", }
158
158
  %label{ for: "f", }
159
159
  F
160
- %input{ atts[:f], tabindex: "#{@campo_tabindex += 1}", id: "f", type: "text", name: "f", }
160
+ %input{ atts[:f], tabindex: "#{@campo_tabindex += 1}", id: "f", name: "f", type: "text", }
161
161
  %label{ for: "g", class: "required", }
162
162
  G
163
- %input{ atts[:g], tabindex: "#{@campo_tabindex += 1}", id: "g", type: "text", size: "3", name: "g", class: "required", }
163
+ %input{ atts[:g], tabindex: "#{@campo_tabindex += 1}", id: "g", name: "g", type: "text", size: "3", class: "required", }
164
164
  STR
165
165
  }
166
166
  subject { Campo.output(form) }
@@ -16,19 +16,19 @@ describe :"Campo::Plugins::Partial" do
16
16
  it { should_not be_nil }
17
17
  it { should be_a_kind_of Campo::Plugins::Partial::Klass }
18
18
  end
19
-
19
+
20
20
  context "After initialisation" do
21
21
  subject { Campo::Plugins::Partial::Klass.new }
22
22
  it { should respond_to(:befores, :afters, :before_output, :after_output, :on_plugin, :extras, :plugged_in) }
23
23
  end
24
24
  end
25
-
25
+
26
26
  describe :"Campo::Plugins::Partial.new" do
27
27
  subject { Campo::Plugins::Partial.new }
28
28
  it { should_not be_nil }
29
29
  it { should be_a_kind_of Campo::Plugins::Partial::Klass }
30
30
  end
31
-
31
+
32
32
  context "Plugging in the Partial plugin" do
33
33
  before(:each) { Campo.plugin :partial }
34
34
  after(:each) { Campo.plugins.clear }
@@ -43,12 +43,12 @@ describe :"Campo::Plugins::Partial" do
43
43
  subject { Campo::Outputter.new.partial }
44
44
  it { should be_nil }
45
45
  end
46
- describe :declarations do
46
+ describe :declarations do
47
47
  subject { Campo::Outputter.new.declarations }
48
48
  it { should_not be_nil }
49
49
  it { should be_a_kind_of String }
50
- it { should include("- atts = {} if atts.nil?") }
51
- it { should include("# for tabindex\n").should be_true }
50
+ it { should include("- atts = {} if atts.nil?") }
51
+ it { should include("# for tabindex\n") }
52
52
  end
53
53
  describe :options do
54
54
  subject { Campo::Outputter.new.options }
metadata CHANGED
@@ -1,67 +1,59 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: campo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.1
5
- prerelease:
4
+ version: 0.11.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Iain Barnett
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-16 00:00:00.000000000 Z
11
+ date: 2013-12-19 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: haml
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
- version: 3.1.1
19
+ version: 4.0.0
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
29
- version: 3.1.1
26
+ version: 4.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: yard
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
- description: ! ' Form builder for Haml
63
-
64
- '
55
+ description: |2
56
+ Form builder for Haml
65
57
  email: iainspeed @nospam@ gmail.com
66
58
  executables: []
67
59
  extensions: []
@@ -70,7 +62,7 @@ files:
70
62
  - .gitignore
71
63
  - .rspec
72
64
  - .travis.yml
73
- - CHANGES.markdown
65
+ - CHANGES.md
74
66
  - Gemfile
75
67
  - README.markdown
76
68
  - Rakefile
@@ -91,27 +83,26 @@ files:
91
83
  - spec/support/matchers/items.rb
92
84
  homepage: https://github.com/yb66/Campo
93
85
  licenses: []
86
+ metadata: {}
94
87
  post_install_message:
95
88
  rdoc_options: []
96
89
  require_paths:
97
90
  - lib
98
91
  required_ruby_version: !ruby/object:Gem::Requirement
99
- none: false
100
92
  requirements:
101
- - - ! '>='
93
+ - - '>='
102
94
  - !ruby/object:Gem::Version
103
95
  version: 1.9.2
104
96
  required_rubygems_version: !ruby/object:Gem::Requirement
105
- none: false
106
97
  requirements:
107
- - - ! '>='
98
+ - - '>='
108
99
  - !ruby/object:Gem::Version
109
100
  version: '0'
110
101
  requirements: []
111
102
  rubyforge_project:
112
- rubygems_version: 1.8.24
103
+ rubygems_version: 2.1.5
113
104
  signing_key:
114
- specification_version: 3
105
+ specification_version: 4
115
106
  summary: Form builder for Haml
116
107
  test_files:
117
108
  - spec/aria_spec.rb
@@ -121,4 +112,3 @@ test_files:
121
112
  - spec/plugins_spec.rb
122
113
  - spec/spec_helper.rb
123
114
  - spec/support/matchers/items.rb
124
- has_rdoc: