padrino-helpers 0.13.3.2 → 0.13.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.rdoc +8 -8
- data/test/helper.rb +2 -15
- data/test/test_asset_tag_helpers.rb +89 -94
- data/test/test_form_builder.rb +506 -503
- data/test/test_form_helpers.rb +516 -516
- data/test/test_output_helpers.rb +72 -72
- data/test/test_render_helpers.rb +94 -94
- data/test/test_rendering.rb +2 -2
- data/test/test_tag_helpers.rb +39 -39
- metadata +5 -5
data/test/test_rendering.rb
CHANGED
@@ -755,8 +755,8 @@ describe "Rendering" do
|
|
755
755
|
%W{erb haml slim}.each do |engine|
|
756
756
|
it "should work with #{engine}" do
|
757
757
|
@app = RenderDemo
|
758
|
-
|
759
|
-
|
758
|
+
get "/double_dive_#{engine}"
|
759
|
+
assert_response_has_tag '.outer .wrapper form .inner .core'
|
760
760
|
end
|
761
761
|
end
|
762
762
|
end
|
data/test/test_tag_helpers.rb
CHANGED
@@ -8,29 +8,29 @@ describe "TagHelpers" do
|
|
8
8
|
|
9
9
|
describe 'for #tag method' do
|
10
10
|
it 'should support tags with no content no attributes' do
|
11
|
-
|
11
|
+
assert_html_has_tag(tag(:br), :br)
|
12
12
|
end
|
13
13
|
|
14
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_html_has_tag(actual_html, :br, :class => 'yellow', :style=>'clear:both')
|
17
17
|
end
|
18
18
|
|
19
19
|
it 'should support selected attribute by using "selected" if true' do
|
20
20
|
actual_html = tag(:option, :selected => true)
|
21
21
|
# fix nokogiri 1.6.8 on jRuby
|
22
22
|
actual_html = content_tag(:select, actual_html)
|
23
|
-
|
23
|
+
assert_html_has_tag(actual_html, 'option', :selected => 'selected')
|
24
24
|
end
|
25
25
|
|
26
26
|
it 'should support data attributes' do
|
27
27
|
actual_html = tag(:a, :data => { :remote => true, :method => 'post'})
|
28
|
-
|
28
|
+
assert_html_has_tag(actual_html, :a, 'data-remote' => 'true', 'data-method' => 'post')
|
29
29
|
end
|
30
30
|
|
31
31
|
it 'should support nested attributes' do
|
32
32
|
actual_html = tag(:div, :data => {:dojo => {:type => 'dijit.form.TextBox', :props => 'readOnly: true'}})
|
33
|
-
|
33
|
+
assert_html_has_tag(actual_html, :div, 'data-dojo-type' => 'dijit.form.TextBox', 'data-dojo-props' => 'readOnly: true')
|
34
34
|
end
|
35
35
|
|
36
36
|
it 'should support open tags' do
|
@@ -47,87 +47,87 @@ describe "TagHelpers" do
|
|
47
47
|
describe 'for #content_tag method' do
|
48
48
|
it 'should support tags with content as parameter' do
|
49
49
|
actual_html = content_tag(:p, "Demo", :class => 'large', :id => 'thing')
|
50
|
-
|
50
|
+
assert_html_has_tag(actual_html, 'p.large#thing', :content => "Demo")
|
51
51
|
end
|
52
52
|
|
53
53
|
it 'should support tags with content as block' do
|
54
54
|
actual_html = content_tag(:p, :class => 'large', :id => 'star') { "Demo" }
|
55
|
-
|
55
|
+
assert_html_has_tag(actual_html, 'p.large#star', :content => "Demo")
|
56
56
|
end
|
57
57
|
|
58
58
|
it 'should escape non-html-safe content' do
|
59
59
|
actual_html = content_tag(:p, :class => 'large', :id => 'star') { "<>" }
|
60
|
-
|
60
|
+
assert_html_has_tag(actual_html, 'p.large#star')
|
61
61
|
assert_match('<>', actual_html)
|
62
62
|
end
|
63
63
|
|
64
64
|
it 'should not escape html-safe content' do
|
65
65
|
actual_html = content_tag(:p, :class => 'large', :id => 'star') { "<>" }
|
66
|
-
|
66
|
+
assert_html_has_tag(actual_html, 'p.large#star', :content => "<>")
|
67
67
|
end
|
68
68
|
|
69
69
|
it 'should convert to a string if the content is not a string' do
|
70
70
|
actual_html = content_tag(:p, 97)
|
71
|
-
|
71
|
+
assert_html_has_tag(actual_html, 'p', :content => "97")
|
72
72
|
end
|
73
73
|
|
74
74
|
it 'should support tags with erb' do
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
75
|
+
get "/erb/content_tag"
|
76
|
+
assert_response_has_tag :p, :content => "Test 1", :class => 'test', :id => 'test1'
|
77
|
+
assert_response_has_tag :p, :content => "Test 2"
|
78
|
+
assert_response_has_tag :p, :content => "Test 3"
|
79
|
+
assert_response_has_tag :p, :content => "Test 4"
|
80
|
+
assert_response_has_tag :p, :content => "one"
|
81
|
+
assert_response_has_tag :p, :content => "two"
|
82
|
+
assert_response_has_no_tag :p, :content => "failed"
|
83
83
|
end
|
84
84
|
|
85
85
|
it 'should support tags with haml' do
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
86
|
+
get "/haml/content_tag"
|
87
|
+
assert_response_has_tag :p, :content => "Test 1", :class => 'test', :id => 'test1'
|
88
|
+
assert_response_has_tag :p, :content => "Test 2"
|
89
|
+
assert_response_has_tag :p, :content => "Test 3", :class => 'test', :id => 'test3'
|
90
|
+
assert_response_has_tag :p, :content => "Test 4"
|
91
|
+
assert_response_has_tag :p, :content => "one"
|
92
|
+
assert_response_has_tag :p, :content => "two"
|
93
|
+
assert_response_has_no_tag :p, :content => "failed"
|
94
94
|
end
|
95
95
|
|
96
96
|
it 'should support tags with slim' do
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
97
|
+
get "/slim/content_tag"
|
98
|
+
assert_response_has_tag :p, :content => "Test 1", :class => 'test', :id => 'test1'
|
99
|
+
assert_response_has_tag :p, :content => "Test 2"
|
100
|
+
assert_response_has_tag :p, :content => "Test 3", :class => 'test', :id => 'test3'
|
101
|
+
assert_response_has_tag :p, :content => "Test 4"
|
102
|
+
assert_response_has_tag :p, :content => "one"
|
103
|
+
assert_response_has_tag :p, :content => "two"
|
104
|
+
assert_response_has_no_tag :p, :content => "failed"
|
105
105
|
end
|
106
106
|
end
|
107
107
|
|
108
108
|
describe 'for #input_tag method' do
|
109
109
|
it 'should support field with type' do
|
110
|
-
|
110
|
+
assert_html_has_tag(input_tag(:text), 'input[type=text]')
|
111
111
|
end
|
112
112
|
|
113
113
|
it 'should support field with type and options' do
|
114
114
|
actual_html = input_tag(:text, :class => "first", :id => 'texter')
|
115
|
-
|
115
|
+
assert_html_has_tag(actual_html, 'input.first#texter[type=text]')
|
116
116
|
end
|
117
117
|
|
118
118
|
it 'should support checked attribute by using "checked" if true' do
|
119
119
|
actual_html = input_tag(:checkbox, :checked => true)
|
120
|
-
|
120
|
+
assert_html_has_tag(actual_html, 'input[type=checkbox]', :checked => 'checked')
|
121
121
|
end
|
122
122
|
|
123
123
|
it 'should remove checked attribute if false' do
|
124
124
|
actual_html = input_tag(:checkbox, :checked => false)
|
125
|
-
|
125
|
+
assert_html_has_no_tag(actual_html, 'input[type=checkbox][checked=false]')
|
126
126
|
end
|
127
127
|
|
128
128
|
it 'should support disabled attribute by using "disabled" if true' do
|
129
129
|
actual_html = input_tag(:checkbox, :disabled => true)
|
130
|
-
|
130
|
+
assert_html_has_tag(actual_html, 'input[type=checkbox]', :disabled => 'disabled')
|
131
131
|
end
|
132
132
|
end
|
133
133
|
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.13.3.
|
4
|
+
version: 0.13.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Padrino Team
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2016-
|
14
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: padrino-support
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - '='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.13.3.
|
22
|
+
version: 0.13.3.3
|
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.13.3.
|
29
|
+
version: 0.13.3.3
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: tilt
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
247
247
|
version: 1.3.6
|
248
248
|
requirements: []
|
249
249
|
rubyforge_project: padrino-helpers
|
250
|
-
rubygems_version: 2.
|
250
|
+
rubygems_version: 2.6.6
|
251
251
|
signing_key:
|
252
252
|
specification_version: 4
|
253
253
|
summary: Helpers for padrino
|