hamlit 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hamlit/concerns/attribute_builder.rb +1 -0
- data/lib/hamlit/version.rb +1 -1
- data/spec/hamlit/engine/old_attributes_spec.rb +55 -17
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4ddd725e168d26ee17fdcfeeff3988fc46d1a3f2
|
4
|
+
data.tar.gz: 7007913e4c3109c688529e9cecf93ae5a5ac1a72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c540899eece79a297d71d6d369d4aa65db1e9f145872ec1767778ae8ba55368d129cbed4f1a639163bd9904717dc36662ba368ad57f56c97af52edb02345dcac
|
7
|
+
data.tar.gz: 688cba8235f8978e30d98f731f711c1da70f554389ee1ec2dffab6f999d521c335229878bc37a40957558685fa637d5f0b5fd13cc78c5f65ed9242cf78f9a2b0
|
data/lib/hamlit/version.rb
CHANGED
@@ -40,23 +40,6 @@ describe Hamlit::Engine do
|
|
40
40
|
HTML
|
41
41
|
end
|
42
42
|
|
43
|
-
it 'renders true attributes' do
|
44
|
-
assert_render(<<-'HAML', <<-HTML)
|
45
|
-
%span{ data: { disable: true } } bar
|
46
|
-
HAML
|
47
|
-
<span data-disable>bar</span>
|
48
|
-
HTML
|
49
|
-
end
|
50
|
-
|
51
|
-
it 'renders nested hash whose value is variable' do
|
52
|
-
assert_render(<<-'HAML', <<-HTML)
|
53
|
-
- hash = { disable: true }
|
54
|
-
%span{ data: hash } bar
|
55
|
-
HAML
|
56
|
-
<span data-disable>bar</span>
|
57
|
-
HTML
|
58
|
-
end
|
59
|
-
|
60
43
|
it 'renders false or nil attributes' do
|
61
44
|
assert_render(<<-'HAML', <<-HTML)
|
62
45
|
- hash = { checked: false }
|
@@ -103,5 +86,60 @@ describe Hamlit::Engine do
|
|
103
86
|
<span '<foo>'='<bar>'></span>
|
104
87
|
HTML
|
105
88
|
end
|
89
|
+
|
90
|
+
describe 'nested attributes' do
|
91
|
+
it 'renders true attributes' do
|
92
|
+
assert_render(<<-'HAML', <<-HTML)
|
93
|
+
%span{ data: { disable: true } } bar
|
94
|
+
HAML
|
95
|
+
<span data-disable>bar</span>
|
96
|
+
HTML
|
97
|
+
end
|
98
|
+
|
99
|
+
it 'renders nested hash whose value is variable' do
|
100
|
+
assert_render(<<-'HAML', <<-HTML)
|
101
|
+
- hash = { disable: true }
|
102
|
+
%span{ data: hash } bar
|
103
|
+
HAML
|
104
|
+
<span data-disable>bar</span>
|
105
|
+
HTML
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'changes an underscore in a nested key to a hyphen' do
|
109
|
+
assert_render(<<-'HAML', <<-HTML)
|
110
|
+
%div{ data: { raw_src: 'foo' } }
|
111
|
+
HAML
|
112
|
+
<div data-raw-src='foo'></div>
|
113
|
+
HTML
|
114
|
+
end
|
115
|
+
|
116
|
+
it 'changes an underscore in a nested dynamic attribute' do
|
117
|
+
assert_render(<<-'HAML', <<-HTML)
|
118
|
+
- hash = { raw_src: 'foo' }
|
119
|
+
%div{ data: hash }
|
120
|
+
HAML
|
121
|
+
<div data-raw-src='foo'></div>
|
122
|
+
HTML
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe 'element class with attributes class' do
|
127
|
+
it 'does not generate double classes' do
|
128
|
+
assert_render(<<-HAML, <<-HTML)
|
129
|
+
.item{ class: 'first' }
|
130
|
+
HAML
|
131
|
+
<div class='first item'></div>
|
132
|
+
HTML
|
133
|
+
end
|
134
|
+
|
135
|
+
it 'does not generate double classes for a variable' do
|
136
|
+
assert_render(<<-HAML, <<-HTML)
|
137
|
+
- val = 'val'
|
138
|
+
.element{ class: val }
|
139
|
+
HAML
|
140
|
+
<div class='element val'></div>
|
141
|
+
HTML
|
142
|
+
end
|
143
|
+
end
|
106
144
|
end
|
107
145
|
end
|