\n\nhello\n\n\n")
%span
%b
hello
HAML
end
it 'parses classes' do
expect(render_string('%span.foo.bar hello')).to eq(%Q{hello\n})
end
it 'parses id' do
expect(render_string('%span#foo-bar hello')).to eq(%Q{hello\n})
end
it 'parses classes and id' do
expect(render_string('%span.foo#foo-bar.bar hello')).to eq(%Q{hello\n})
end
it 'parses #' do
expect(render_string('#main')).to eq(%Q{\n})
end
it 'parses .' do
expect(render_string('.wrapper.main')).to eq(%Q{\n})
end
it 'parses string interpolation' do
expect(render_string(%q|%span hello #{''} |)).to eq("hello </span> \n")
expect(render_string(<<'HAML')).to eq("\nhello </span> \n\n")
%span
hello #{{text: ''}[:text]}
HAML
expect(render_string(<<'HAML')).to eq("\nhello </span> \n\n")
- @var = ''
%span
hello #@var
HAML
end
it 'parses string interpolation with multibyte characters' do
expect(render_string(%q|#{'日本語'} にほんご|)).to eq("日本語 にほんご\n")
end
it 'recognized escaped string interpolation' do
expect(render_string(%q|%p hello \#{1 + 2}|)).to eq("hello \#{1 + 2}
\n")
end
it 'parses self-closing tag' do
expect(render_string('%p/')).to eq("\n")
end
it 'renders some attributes as self-closing by default' do
expect(render_string('%meta{"http-equiv" => "Content-Type", :content => "text/html"}')).to eq("\n")
end
end