mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Support xhtml format for boolean attributes
This commit is contained in:
parent
e482f59b3d
commit
13bc49f618
3 changed files with 6 additions and 7 deletions
|
@ -109,7 +109,7 @@ module Hamlit
|
|||
code = [
|
||||
%Q|case #{value}|,
|
||||
%Q|when true|,
|
||||
%Q|_buf << ' #{key}'.freeze|,
|
||||
%Q|_buf << #{ (@format == :xhtml ? " #{key}=#{@quote}#{key}#{@quote}" : " #{key}").inspect }.freeze|,
|
||||
%Q|when false, nil|,
|
||||
%Q|else|,
|
||||
%Q|_buf << " #{key}='".freeze|,
|
||||
|
|
|
@ -125,6 +125,9 @@ describe Hamlit::Engine do
|
|||
%input(disabled='false'){ disabled: nil }
|
||||
%input(disabled=''){ disabled: nil }
|
||||
HAML
|
||||
|
||||
assert_inline(%q|%input(checked=true)|)
|
||||
assert_inline(%q|%input(checked=true)|, format: :xhtml)
|
||||
end
|
||||
|
||||
specify 'common attributes' do
|
||||
|
|
|
@ -36,12 +36,8 @@ module RenderAssertion
|
|||
assert_equal html, render(haml, options)
|
||||
end
|
||||
|
||||
def assert_inline(haml)
|
||||
options = {
|
||||
escape_html: true,
|
||||
escape_attrs: true,
|
||||
ugly: true,
|
||||
}
|
||||
def assert_inline(haml, options = {})
|
||||
options = { escape_html: true, escape_attrs: true, ugly: true }.merge(options)
|
||||
html = Haml::Engine.new(haml, options).to_html
|
||||
assert_equal html, render(haml, options)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue