spec/render/hash_attribute_spec.rb in faml-0.6.4 vs spec/render/hash_attribute_spec.rb in faml-0.6.5
- old
+ new
@@ -56,9 +56,17 @@
it 'skips falsey data attributes' do
expect(render_string('%span{data: { foo: nil }}')).to eq("<span></span>\n")
expect(render_string("- v = nil\n%span{data: { foo: v }}")).to eq("<span></span>\n")
end
+ it 'skips falsey data attributes after merging attributes' do
+ expect(render_string(<<HAML)).to eq("<a></a>\n")
+- h1 = { new: true }
+- h2 = { data: { old: true } }
+%a(data=h1){ h2 , data: { new: nil, old: false } }
+HAML
+ end
+
it 'renders true data attributes' do
expect(render_string('%span{data: { foo: true }}')).to eq("<span data-foo></span>\n")
expect(render_string("- v = true\n%span{data: { foo: v }}")).to eq("<span data-foo></span>\n")
end
end