describe Hamlit::Engine do describe 'new attributes' do it 'renders attributes' do assert_render(<<-HAML, <<-HTML) %p(class='foo') bar HAML

bar

HTML end it 'renders multiple attributes' do assert_render(<<-HAML, <<-HTML) %p(a=1 b=2) bar HAML

bar

HTML end describe 'html escape' do it 'escapes attribute values on static attributes' do assert_render(<<-'HAML', <<-HTML) %a(title="'") %a(title = "'\"") %a(href='/search?foo=bar&hoge=') HAML HTML end it 'escapes attribute values on dynamic attributes' do assert_render(<<-'HAML', <<-HTML) - title = "'\"" - href = '/search?foo=bar&hoge=' %a(title=title) %a(href=href) HAML HTML end end describe 'element class with attribute class' do it 'does not generate double classes' do assert_render(<<-HAML, <<-HTML) .item(class='first') HAML
HTML end it 'does not generate double classes for a variable' do assert_render(<<-HAML, <<-HTML) - val = 'val' .element(class=val) HAML
HTML end end describe 'element id with attribute id' do it 'concatenates ids with underscore' do assert_render(<<-HAML, <<-HTML) #item(id='first') HAML
HTML end it 'concatenates ids with underscore for a variable' do assert_render(<<-HAML, <<-HTML) - val = 'first' #item(id=val) HAML
HTML end end end end