spec/compiler_newline_spec.rb in faml-0.2.8 vs spec/compiler_newline_spec.rb in faml-0.2.9
- old
+ new
@@ -156,7 +156,47 @@
%span= raise LineVerifier
HAML
end
end
+
+ context 'with multiline' do
+ it 'keeps newlines in static attributes' do
+ expect { render_string(<<HAML) }.to raise_error(LineVerifier, raised_at(3))
+%span{a: 1,
+ b: 2}
+= raise LineVerifier
+HAML
+ end
+
+ it 'keeps newlines in dynamic attributes' do
+ expect { render_string(<<HAML) }.to raise_error(LineVerifier, raised_at(2))
+%span{a: 1,
+ b: raise(LineVerifier)}
+hello
+HAML
+ expect { render_string(<<HAML) }.to raise_error(LineVerifier, raised_at(3))
+%span{a: 1,
+ b: 2 + 3}
+= raise LineVerifier
+HAML
+ end
+
+ it 'keeps newlines in ruby attributes' do
+ expect { render_string(<<HAML) }.to raise_error(LineVerifier, raised_at(2))
+%span{[1,
+ raise(LineVerifier)]}
+hello
+HAML
+ end
+
+ it 'keeps newlines in haml multiline' do
+ expect(render_string(<<HAML)).to eq("foo bar 1\n4\n")
+= 'foo ' + |
+ 'bar ' + |
+ __LINE__.to_s |
+= __LINE__
+HAML
+ end
+ end
end
end