describe Hamlit::Engine do describe 'old attributes' do it 'renders attributes' do assert_render(<<-HAML, <<-HTML) %span{class: 'foo'} bar HAML bar HTML end it 'renders attributes' do assert_render(<<-HAML, <<-HTML) %span{ data: 2 } bar HAML bar HTML end it 'renders attributes' do assert_render(<<-'HAML', <<-HTML) %span{ :class => 'foo' } bar HAML bar HTML end it 'renders attributes' do assert_render(<<-'HAML', <<-HTML) %span{ :class => 'foo', id: 'bar' } bar HAML bar HTML end it 'renders attributes' do assert_render(<<-'HAML', <<-HTML) %span{ :'data-disable' => true } bar HAML bar HTML end it 'renders true attributes' do assert_render(<<-'HAML', <<-HTML) %span{ data: { disable: true } } bar HAML bar HTML end it 'renders nested hash whose value is variable' do assert_render(<<-'HAML', <<-HTML) - hash = { disable: true } %span{ data: hash } bar HAML bar HTML end it 'renders false or nil attributes' do assert_render(<<-'HAML', <<-HTML) - hash = { checked: false } %input{ hash } %input{ checked: false } %input{ checked: nil } HAML HTML end it 'accepts even illegal input for haml' do assert_render(<<-'HAML', <<-HTML) %span{ class: '}}}', id: '{}}' } }{ HAML }{ HTML end it 'accepts method call including comma' do assert_render(<<-'HAML', <<-HTML) %body{ class: "#{"ab".gsub(/a/, 'b')}", data: { confirm: 'really?', disable: true }, id: 'c'.gsub(/c/, 'a') } HAML HTML end it 'renders runtime hash attribute' do assert_render(<<-'HAML', <<-HTML) - hash = { foo: 'bar' } %span{ hash } HAML HTML end it 'renders runtime hash attribute escaping only value' do assert_render(<<-'HAML', <<-HTML) - hash = { "''" => '' } %span{ hash } HAML '='<bar>'> HTML end end end