padrino-helpers 0.12.0 → 0.12.1

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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/lib/padrino-helpers.rb +4 -1
  3. data/lib/padrino-helpers/asset_tag_helpers.rb +17 -14
  4. data/lib/padrino-helpers/breadcrumb_helpers.rb +6 -6
  5. data/lib/padrino-helpers/form_builder/abstract_form_builder.rb +119 -163
  6. data/lib/padrino-helpers/form_builder/deprecated_builder_methods.rb +92 -0
  7. data/lib/padrino-helpers/form_helpers.rb +66 -347
  8. data/lib/padrino-helpers/form_helpers/errors.rb +138 -0
  9. data/lib/padrino-helpers/form_helpers/options.rb +97 -0
  10. data/lib/padrino-helpers/form_helpers/security.rb +70 -0
  11. data/lib/padrino-helpers/output_helpers.rb +1 -1
  12. data/lib/padrino-helpers/output_helpers/abstract_handler.rb +1 -1
  13. data/lib/padrino-helpers/render_helpers.rb +10 -9
  14. data/lib/padrino-helpers/tag_helpers.rb +2 -1
  15. data/lib/padrino/rendering.rb +378 -0
  16. data/lib/padrino/rendering/extensions/erubis.rb +74 -0
  17. data/lib/padrino/rendering/extensions/haml.rb +29 -0
  18. data/lib/padrino/rendering/extensions/slim.rb +21 -0
  19. data/padrino-helpers.gemspec +2 -1
  20. data/test/fixtures/apps/.components +6 -0
  21. data/test/fixtures/apps/.gitignore +7 -0
  22. data/test/fixtures/apps/render.rb +25 -0
  23. data/test/fixtures/apps/views/article/comment/show.slim +1 -0
  24. data/test/fixtures/apps/views/blog/post.erb +1 -0
  25. data/test/fixtures/apps/views/layouts/specific.erb +1 -0
  26. data/test/fixtures/apps/views/test/post.erb +1 -0
  27. data/test/fixtures/layouts/layout.erb +1 -0
  28. data/test/fixtures/markup_app/app.rb +0 -1
  29. data/test/fixtures/render_app/app.rb +25 -1
  30. data/test/fixtures/render_app/views/_unsafe.html.builder +2 -0
  31. data/test/fixtures/render_app/views/_unsafe_object.html.builder +2 -0
  32. data/test/fixtures/render_app/views/ruby_block_capture_erb.erb +1 -0
  33. data/test/fixtures/render_app/views/ruby_block_capture_haml.haml +1 -0
  34. data/test/fixtures/render_app/views/ruby_block_capture_slim.slim +1 -0
  35. data/test/helper.rb +65 -1
  36. data/test/test_asset_tag_helpers.rb +83 -79
  37. data/test/test_breadcrumb_helpers.rb +20 -20
  38. data/test/test_form_builder.rb +196 -196
  39. data/test/test_form_helpers.rb +163 -163
  40. data/test/test_format_helpers.rb +65 -65
  41. data/test/test_locale.rb +1 -1
  42. data/test/test_number_helpers.rb +10 -11
  43. data/test/test_output_helpers.rb +28 -28
  44. data/test/test_render_helpers.rb +89 -35
  45. data/test/test_rendering.rb +683 -0
  46. data/test/test_rendering_extensions.rb +14 -0
  47. data/test/test_tag_helpers.rb +23 -23
  48. metadata +57 -5
@@ -0,0 +1,14 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ describe "Rendering Extensions" do
4
+ describe 'for haml' do
5
+ it 'should render haml_tag correctly' do
6
+ mock_app do
7
+ get('/') { render :haml, '-haml_tag :div'}
8
+ end
9
+
10
+ get '/'
11
+ assert_match '<div></div>', last_response.body
12
+ end
13
+ end
14
+ end
@@ -6,70 +6,70 @@ describe "TagHelpers" do
6
6
  MarkupDemo
7
7
  end
8
8
 
9
- context 'for #tag method' do
10
- should("support tags with no content no attributes") do
9
+ describe 'for #tag method' do
10
+ it 'should support tags with no content no attributes' do
11
11
  assert_has_tag(:br) { tag(:br) }
12
12
  end
13
13
 
14
- should("support tags with no content with attributes") do
14
+ it 'should support tags with no content with attributes' do
15
15
  actual_html = tag(:br, :style => 'clear:both', :class => 'yellow')
16
16
  assert_has_tag(:br, :class => 'yellow', :style=>'clear:both') { actual_html }
17
17
  end
18
18
 
19
- should "support selected attribute by using 'selected' if true" do
19
+ it 'should support selected attribute by using "selected" if true' do
20
20
  actual_html = tag(:option, :selected => true)
21
21
  assert_has_tag('option', :selected => 'selected') { actual_html }
22
22
  end
23
23
 
24
- should "support data attributes" do
24
+ it 'should support data attributes' do
25
25
  actual_html = tag(:a, :data => { :remote => true, :method => 'post'})
26
26
  assert_has_tag(:a, 'data-remote' => 'true', 'data-method' => 'post') { actual_html }
27
27
  end
28
28
 
29
- should "support nested attributes" do
29
+ it 'should support nested attributes' do
30
30
  actual_html = tag(:div, :data => {:dojo => {:type => 'dijit.form.TextBox', :props => 'readOnly: true'}})
31
31
  assert_has_tag(:div, 'data-dojo-type' => 'dijit.form.TextBox', 'data-dojo-props' => 'readOnly: true') { actual_html }
32
32
  end
33
33
 
34
- should "support open tags" do
34
+ it 'should support open tags' do
35
35
  actual_html = tag(:p, { :class => 'demo' }, true)
36
36
  assert_equal "<p class=\"demo\">", actual_html
37
37
  end
38
38
 
39
- should "escape html" do
39
+ it 'should escape html' do
40
40
  actual_html = tag(:br, :class => 'Example <foo> & "bar"')
41
41
  assert_equal "<br class=\"Example &lt;foo&gt; &amp; &quot;bar&quot;\" />", actual_html
42
42
  end
43
43
  end
44
44
 
45
- context 'for #content_tag method' do
46
- should "support tags with content as parameter" do
45
+ describe 'for #content_tag method' do
46
+ it 'should support tags with content as parameter' do
47
47
  actual_html = content_tag(:p, "Demo", :class => 'large', :id => 'thing')
48
48
  assert_has_tag('p.large#thing', :content => "Demo") { actual_html }
49
49
  end
50
50
 
51
- should "support tags with content as block" do
51
+ it 'should support tags with content as block' do
52
52
  actual_html = content_tag(:p, :class => 'large', :id => 'star') { "Demo" }
53
53
  assert_has_tag('p.large#star', :content => "Demo") { actual_html }
54
54
  end
55
55
 
56
- should "escape non-html-safe content" do
56
+ it 'should escape non-html-safe content' do
57
57
  actual_html = content_tag(:p, :class => 'large', :id => 'star') { "<>" }
58
58
  assert_has_tag('p.large#star') { actual_html }
59
59
  assert_match('&lt;&gt;', actual_html)
60
60
  end
61
61
 
62
- should "not escape html-safe content" do
62
+ it 'should not escape html-safe content' do
63
63
  actual_html = content_tag(:p, :class => 'large', :id => 'star') { "<>" }
64
64
  assert_has_tag('p.large#star', :content => "<>") { actual_html }
65
65
  end
66
66
 
67
- should "convert to a string if the content is not a string" do
67
+ it 'should convert to a string if the content is not a string' do
68
68
  actual_html = content_tag(:p, 97)
69
69
  assert_has_tag('p', :content => "97") { actual_html }
70
70
  end
71
71
 
72
- should "support tags with erb" do
72
+ it 'should support tags with erb' do
73
73
  visit '/erb/content_tag'
74
74
  assert_have_selector :p, :content => "Test 1", :class => 'test', :id => 'test1'
75
75
  assert_have_selector :p, :content => "Test 2"
@@ -80,7 +80,7 @@ describe "TagHelpers" do
80
80
  assert_have_no_selector :p, :content => "failed"
81
81
  end
82
82
 
83
- should "support tags with haml" do
83
+ it 'should support tags with haml' do
84
84
  visit '/haml/content_tag'
85
85
  assert_have_selector :p, :content => "Test 1", :class => 'test', :id => 'test1'
86
86
  assert_have_selector :p, :content => "Test 2"
@@ -91,7 +91,7 @@ describe "TagHelpers" do
91
91
  assert_have_no_selector :p, :content => "failed"
92
92
  end
93
93
 
94
- should "support tags with slim" do
94
+ it 'should support tags with slim' do
95
95
  visit '/slim/content_tag'
96
96
  assert_have_selector :p, :content => "Test 1", :class => 'test', :id => 'test1'
97
97
  assert_have_selector :p, :content => "Test 2"
@@ -103,27 +103,27 @@ describe "TagHelpers" do
103
103
  end
104
104
  end
105
105
 
106
- context 'for #input_tag method' do
107
- should "support field with type" do
106
+ describe 'for #input_tag method' do
107
+ it 'should support field with type' do
108
108
  assert_has_tag('input[type=text]') { input_tag(:text) }
109
109
  end
110
110
 
111
- should "support field with type and options" do
111
+ it 'should support field with type and options' do
112
112
  actual_html = input_tag(:text, :class => "first", :id => 'texter')
113
113
  assert_has_tag('input.first#texter[type=text]') { actual_html }
114
114
  end
115
115
 
116
- should "support checked attribute by using 'checked' if true" do
116
+ it 'should support checked attribute by using "checked" if true' do
117
117
  actual_html = input_tag(:checkbox, :checked => true)
118
118
  assert_has_tag('input[type=checkbox]', :checked => 'checked') { actual_html }
119
119
  end
120
120
 
121
- should "remove checked attribute if false" do
121
+ it 'should remove checked attribute if false' do
122
122
  actual_html = input_tag(:checkbox, :checked => false)
123
123
  assert_has_no_tag('input[type=checkbox][checked=false]') { actual_html }
124
124
  end
125
125
 
126
- should "support disabled attribute by using 'disabled' if true" do
126
+ it 'should support disabled attribute by using "disabled" if true' do
127
127
  actual_html = input_tag(:checkbox, :disabled => true)
128
128
  assert_has_tag('input[type=checkbox]', :disabled => 'disabled') { actual_html }
129
129
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Padrino Team
@@ -11,22 +11,36 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-02-09 00:00:00.000000000 Z
14
+ date: 2014-04-04 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
- name: padrino-core
17
+ name: padrino-support
18
18
  requirement: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: 0.12.0
22
+ version: 0.12.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 0.12.0
29
+ version: 0.12.1
30
+ - !ruby/object:Gem::Dependency
31
+ name: tilt
32
+ requirement: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ~>
35
+ - !ruby/object:Gem::Version
36
+ version: 1.4.1
37
+ type: :runtime
38
+ prerelease: false
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: 1.4.1
30
44
  - !ruby/object:Gem::Dependency
31
45
  name: i18n
32
46
  requirement: !ruby/object:Gem::Requirement
@@ -65,8 +79,12 @@ files:
65
79
  - lib/padrino-helpers/asset_tag_helpers.rb
66
80
  - lib/padrino-helpers/breadcrumb_helpers.rb
67
81
  - lib/padrino-helpers/form_builder/abstract_form_builder.rb
82
+ - lib/padrino-helpers/form_builder/deprecated_builder_methods.rb
68
83
  - lib/padrino-helpers/form_builder/standard_form_builder.rb
69
84
  - lib/padrino-helpers/form_helpers.rb
85
+ - lib/padrino-helpers/form_helpers/errors.rb
86
+ - lib/padrino-helpers/form_helpers/options.rb
87
+ - lib/padrino-helpers/form_helpers/security.rb
70
88
  - lib/padrino-helpers/format_helpers.rb
71
89
  - lib/padrino-helpers/locale/cs.yml
72
90
  - lib/padrino-helpers/locale/da.yml
@@ -98,7 +116,19 @@ files:
98
116
  - lib/padrino-helpers/render_helpers.rb
99
117
  - lib/padrino-helpers/tag_helpers.rb
100
118
  - lib/padrino-helpers/translation_helpers.rb
119
+ - lib/padrino/rendering.rb
120
+ - lib/padrino/rendering/extensions/erubis.rb
121
+ - lib/padrino/rendering/extensions/haml.rb
122
+ - lib/padrino/rendering/extensions/slim.rb
101
123
  - padrino-helpers.gemspec
124
+ - test/fixtures/apps/.components
125
+ - test/fixtures/apps/.gitignore
126
+ - test/fixtures/apps/render.rb
127
+ - test/fixtures/apps/views/article/comment/show.slim
128
+ - test/fixtures/apps/views/blog/post.erb
129
+ - test/fixtures/apps/views/layouts/specific.erb
130
+ - test/fixtures/apps/views/test/post.erb
131
+ - test/fixtures/layouts/layout.erb
102
132
  - test/fixtures/markup_app/app.rb
103
133
  - test/fixtures/markup_app/views/button_to.erb
104
134
  - test/fixtures/markup_app/views/button_to.haml
@@ -146,6 +176,8 @@ files:
146
176
  - test/fixtures/render_app/views/_partial_block_erb.erb
147
177
  - test/fixtures/render_app/views/_partial_block_haml.haml
148
178
  - test/fixtures/render_app/views/_partial_block_slim.slim
179
+ - test/fixtures/render_app/views/_unsafe.html.builder
180
+ - test/fixtures/render_app/views/_unsafe_object.html.builder
149
181
  - test/fixtures/render_app/views/current_engine.haml
150
182
  - test/fixtures/render_app/views/current_engines/_erb.erb
151
183
  - test/fixtures/render_app/views/current_engines/_haml.haml
@@ -159,6 +191,9 @@ files:
159
191
  - test/fixtures/render_app/views/render_block_erb.erb
160
192
  - test/fixtures/render_app/views/render_block_haml.haml
161
193
  - test/fixtures/render_app/views/render_block_slim.slim
194
+ - test/fixtures/render_app/views/ruby_block_capture_erb.erb
195
+ - test/fixtures/render_app/views/ruby_block_capture_haml.haml
196
+ - test/fixtures/render_app/views/ruby_block_capture_slim.slim
162
197
  - test/fixtures/render_app/views/template/_user.haml
163
198
  - test/fixtures/render_app/views/template/haml_template.haml
164
199
  - test/fixtures/render_app/views/template/some_template.haml
@@ -175,6 +210,8 @@ files:
175
210
  - test/test_number_helpers.rb
176
211
  - test/test_output_helpers.rb
177
212
  - test/test_render_helpers.rb
213
+ - test/test_rendering.rb
214
+ - test/test_rendering_extensions.rb
178
215
  - test/test_tag_helpers.rb
179
216
  homepage: http://www.padrinorb.com
180
217
  licenses:
@@ -202,6 +239,14 @@ signing_key:
202
239
  specification_version: 4
203
240
  summary: Helpers for padrino
204
241
  test_files:
242
+ - test/fixtures/apps/.components
243
+ - test/fixtures/apps/.gitignore
244
+ - test/fixtures/apps/render.rb
245
+ - test/fixtures/apps/views/article/comment/show.slim
246
+ - test/fixtures/apps/views/blog/post.erb
247
+ - test/fixtures/apps/views/layouts/specific.erb
248
+ - test/fixtures/apps/views/test/post.erb
249
+ - test/fixtures/layouts/layout.erb
205
250
  - test/fixtures/markup_app/app.rb
206
251
  - test/fixtures/markup_app/views/button_to.erb
207
252
  - test/fixtures/markup_app/views/button_to.haml
@@ -249,6 +294,8 @@ test_files:
249
294
  - test/fixtures/render_app/views/_partial_block_erb.erb
250
295
  - test/fixtures/render_app/views/_partial_block_haml.haml
251
296
  - test/fixtures/render_app/views/_partial_block_slim.slim
297
+ - test/fixtures/render_app/views/_unsafe.html.builder
298
+ - test/fixtures/render_app/views/_unsafe_object.html.builder
252
299
  - test/fixtures/render_app/views/current_engine.haml
253
300
  - test/fixtures/render_app/views/current_engines/_erb.erb
254
301
  - test/fixtures/render_app/views/current_engines/_haml.haml
@@ -262,6 +309,9 @@ test_files:
262
309
  - test/fixtures/render_app/views/render_block_erb.erb
263
310
  - test/fixtures/render_app/views/render_block_haml.haml
264
311
  - test/fixtures/render_app/views/render_block_slim.slim
312
+ - test/fixtures/render_app/views/ruby_block_capture_erb.erb
313
+ - test/fixtures/render_app/views/ruby_block_capture_haml.haml
314
+ - test/fixtures/render_app/views/ruby_block_capture_slim.slim
265
315
  - test/fixtures/render_app/views/template/_user.haml
266
316
  - test/fixtures/render_app/views/template/haml_template.haml
267
317
  - test/fixtures/render_app/views/template/some_template.haml
@@ -278,5 +328,7 @@ test_files:
278
328
  - test/test_number_helpers.rb
279
329
  - test/test_output_helpers.rb
280
330
  - test/test_render_helpers.rb
331
+ - test/test_rendering.rb
332
+ - test/test_rendering_extensions.rb
281
333
  - test/test_tag_helpers.rb
282
334
  has_rdoc: