1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00

Show html again to read specs

This commit is contained in:
Takashi Kokubun 2015-03-28 10:53:56 +09:00
parent 56138d662a
commit 5ce029a61b
2 changed files with 146 additions and 1 deletions

View file

@ -8,6 +8,7 @@ def generate_spec(test, locals, options)
<<-SPEC <<-SPEC
specify \"#{test[:name]}\" do specify \"#{test[:name]}\" do
haml = %q{#{test[:haml]}} haml = %q{#{test[:haml]}}
html = %q{#{test[:html]}}
locals = #{locals} locals = #{locals}
options = #{options} options = #{options}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)

View file

@ -14,6 +14,7 @@ describe "haml" do
context "headers" do context "headers" do
specify "an XHTML XML prolog" do specify "an XHTML XML prolog" do
haml = %q{!!! XML} haml = %q{!!! XML}
html = %q{<?xml version='1.0' encoding='utf-8' ?>}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -21,6 +22,7 @@ describe "haml" do
specify "an XHTML default (transitional) doctype" do specify "an XHTML default (transitional) doctype" do
haml = %q{!!!} haml = %q{!!!}
html = %q{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -28,6 +30,7 @@ describe "haml" do
specify "an XHTML 1.1 doctype" do specify "an XHTML 1.1 doctype" do
haml = %q{!!! 1.1} haml = %q{!!! 1.1}
html = %q{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -35,6 +38,7 @@ describe "haml" do
specify "an XHTML 1.2 mobile doctype" do specify "an XHTML 1.2 mobile doctype" do
haml = %q{!!! mobile} haml = %q{!!! mobile}
html = %q{<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN" "http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -42,6 +46,7 @@ describe "haml" do
specify "an XHTML 1.1 basic doctype" do specify "an XHTML 1.1 basic doctype" do
haml = %q{!!! basic} haml = %q{!!! basic}
html = %q{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd">}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -49,6 +54,7 @@ describe "haml" do
specify "an XHTML 1.0 frameset doctype" do specify "an XHTML 1.0 frameset doctype" do
haml = %q{!!! frameset} haml = %q{!!! frameset}
html = %q{<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -56,6 +62,7 @@ describe "haml" do
specify "an HTML 5 doctype with XHTML syntax" do specify "an HTML 5 doctype with XHTML syntax" do
haml = %q{!!! 5} haml = %q{!!! 5}
html = %q{<!DOCTYPE html>}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -63,6 +70,7 @@ describe "haml" do
specify "an HTML 5 XML prolog (silent)" do specify "an HTML 5 XML prolog (silent)" do
haml = %q{!!! XML} haml = %q{!!! XML}
html = %q{}
locals = {} locals = {}
options = {:format=>:html5} options = {:format=>:html5}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -70,6 +78,7 @@ describe "haml" do
specify "an HTML 5 doctype" do specify "an HTML 5 doctype" do
haml = %q{!!!} haml = %q{!!!}
html = %q{<!DOCTYPE html>}
locals = {} locals = {}
options = {:format=>:html5} options = {:format=>:html5}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -77,6 +86,7 @@ describe "haml" do
specify "an HTML 4 XML prolog (silent)" do specify "an HTML 4 XML prolog (silent)" do
haml = %q{!!! XML} haml = %q{!!! XML}
html = %q{}
locals = {} locals = {}
options = {:format=>:html4} options = {:format=>:html4}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -84,6 +94,7 @@ describe "haml" do
specify "an HTML 4 default (transitional) doctype" do specify "an HTML 4 default (transitional) doctype" do
haml = %q{!!!} haml = %q{!!!}
html = %q{<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">}
locals = {} locals = {}
options = {:format=>:html4} options = {:format=>:html4}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -91,6 +102,7 @@ describe "haml" do
specify "an HTML 4 frameset doctype" do specify "an HTML 4 frameset doctype" do
haml = %q{!!! frameset} haml = %q{!!! frameset}
html = %q{<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">}
locals = {} locals = {}
options = {:format=>:html4} options = {:format=>:html4}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -98,6 +110,7 @@ describe "haml" do
specify "an HTML 4 strict doctype" do specify "an HTML 4 strict doctype" do
haml = %q{!!! strict} haml = %q{!!! strict}
html = %q{<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">}
locals = {} locals = {}
options = {:format=>:html4} options = {:format=>:html4}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -107,6 +120,7 @@ describe "haml" do
context "basic Haml tags and CSS" do context "basic Haml tags and CSS" do
specify "a simple Haml tag" do specify "a simple Haml tag" do
haml = %q{%p} haml = %q{%p}
html = %q{<p></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -114,6 +128,7 @@ describe "haml" do
specify "a self-closing tag (XHTML)" do specify "a self-closing tag (XHTML)" do
haml = %q{%meta} haml = %q{%meta}
html = %q{<meta />}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -121,6 +136,7 @@ describe "haml" do
specify "a self-closing tag (HTML4)" do specify "a self-closing tag (HTML4)" do
haml = %q{%meta} haml = %q{%meta}
html = %q{<meta>}
locals = {} locals = {}
options = {:format=>:html4} options = {:format=>:html4}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -128,6 +144,7 @@ describe "haml" do
specify "a self-closing tag (HTML5)" do specify "a self-closing tag (HTML5)" do
haml = %q{%meta} haml = %q{%meta}
html = %q{<meta>}
locals = {} locals = {}
options = {:format=>:html5} options = {:format=>:html5}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -135,6 +152,7 @@ describe "haml" do
specify "a self-closing tag ('/' modifier + XHTML)" do specify "a self-closing tag ('/' modifier + XHTML)" do
haml = %q{%zzz/} haml = %q{%zzz/}
html = %q{<zzz />}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -142,6 +160,7 @@ describe "haml" do
specify "a self-closing tag ('/' modifier + HTML5)" do specify "a self-closing tag ('/' modifier + HTML5)" do
haml = %q{%zzz/} haml = %q{%zzz/}
html = %q{<zzz>}
locals = {} locals = {}
options = {:format=>:html5} options = {:format=>:html5}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -149,6 +168,7 @@ describe "haml" do
specify "a tag with a CSS class" do specify "a tag with a CSS class" do
haml = %q{%p.class1} haml = %q{%p.class1}
html = %q{<p class='class1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -156,6 +176,7 @@ describe "haml" do
specify "a tag with multiple CSS classes" do specify "a tag with multiple CSS classes" do
haml = %q{%p.class1.class2} haml = %q{%p.class1.class2}
html = %q{<p class='class1 class2'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -163,6 +184,7 @@ describe "haml" do
specify "a tag with a CSS id" do specify "a tag with a CSS id" do
haml = %q{%p#id1} haml = %q{%p#id1}
html = %q{<p id='id1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -170,6 +192,7 @@ describe "haml" do
specify "a tag with multiple CSS id's" do specify "a tag with multiple CSS id's" do
haml = %q{%p#id1#id2} haml = %q{%p#id1#id2}
html = %q{<p id='id2'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -177,6 +200,7 @@ describe "haml" do
specify "a tag with a class followed by an id" do specify "a tag with a class followed by an id" do
haml = %q{%p.class1#id1} haml = %q{%p.class1#id1}
html = %q{<p class='class1' id='id1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -184,6 +208,7 @@ describe "haml" do
specify "a tag with an id followed by a class" do specify "a tag with an id followed by a class" do
haml = %q{%p#id1.class1} haml = %q{%p#id1.class1}
html = %q{<p class='class1' id='id1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -191,6 +216,7 @@ describe "haml" do
specify "an implicit div with a CSS id" do specify "an implicit div with a CSS id" do
haml = %q{#id1} haml = %q{#id1}
html = %q{<div id='id1'></div>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -198,6 +224,7 @@ describe "haml" do
specify "an implicit div with a CSS class" do specify "an implicit div with a CSS class" do
haml = %q{.class1} haml = %q{.class1}
html = %q{<div class='class1'></div>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -207,6 +234,11 @@ describe "haml" do
haml = %q{%div haml = %q{%div
%div %div
%p} %p}
html = %q{<div>
<div>
<p></p>
</div>
</div>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -216,6 +248,7 @@ describe "haml" do
context "tags with unusual HTML characters" do context "tags with unusual HTML characters" do
specify "a tag with colons" do specify "a tag with colons" do
haml = %q{%ns:tag} haml = %q{%ns:tag}
html = %q{<ns:tag></ns:tag>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -223,6 +256,7 @@ describe "haml" do
specify "a tag with underscores" do specify "a tag with underscores" do
haml = %q{%snake_case} haml = %q{%snake_case}
html = %q{<snake_case></snake_case>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -230,6 +264,7 @@ describe "haml" do
specify "a tag with dashes" do specify "a tag with dashes" do
haml = %q{%dashed-tag} haml = %q{%dashed-tag}
html = %q{<dashed-tag></dashed-tag>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -237,6 +272,7 @@ describe "haml" do
specify "a tag with camelCase" do specify "a tag with camelCase" do
haml = %q{%camelCase} haml = %q{%camelCase}
html = %q{<camelCase></camelCase>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -244,6 +280,7 @@ describe "haml" do
specify "a tag with PascalCase" do specify "a tag with PascalCase" do
haml = %q{%PascalCase} haml = %q{%PascalCase}
html = %q{<PascalCase></PascalCase>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -253,6 +290,7 @@ describe "haml" do
context "tags with unusual CSS identifiers" do context "tags with unusual CSS identifiers" do
specify "an all-numeric class" do specify "an all-numeric class" do
haml = %q{.123} haml = %q{.123}
html = %q{<div class='123'></div>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -260,6 +298,7 @@ describe "haml" do
specify "a class with underscores" do specify "a class with underscores" do
haml = %q{.__} haml = %q{.__}
html = %q{<div class='__'></div>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -267,6 +306,7 @@ describe "haml" do
specify "a class with dashes" do specify "a class with dashes" do
haml = %q{.--} haml = %q{.--}
html = %q{<div class='--'></div>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -276,6 +316,7 @@ describe "haml" do
context "tags with inline content" do context "tags with inline content" do
specify "Inline content simple tag" do specify "Inline content simple tag" do
haml = %q{%p hello} haml = %q{%p hello}
html = %q{<p>hello</p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -283,6 +324,7 @@ describe "haml" do
specify "Inline content tag with CSS" do specify "Inline content tag with CSS" do
haml = %q{%p.class1 hello} haml = %q{%p.class1 hello}
html = %q{<p class='class1'>hello</p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -292,6 +334,11 @@ describe "haml" do
haml = %q{%div haml = %q{%div
%div %div
%p text} %p text}
html = %q{<div>
<div>
<p>text</p>
</div>
</div>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -302,6 +349,9 @@ describe "haml" do
specify "Nested content simple tag" do specify "Nested content simple tag" do
haml = %q{%p haml = %q{%p
hello} hello}
html = %q{<p>
hello
</p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -310,6 +360,9 @@ describe "haml" do
specify "Nested content tag with CSS" do specify "Nested content tag with CSS" do
haml = %q{%p.class1 haml = %q{%p.class1
hello} hello}
html = %q{<p class='class1'>
hello
</p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -320,6 +373,13 @@ describe "haml" do
%div %div
%p %p
text} text}
html = %q{<div>
<div>
<p>
text
</p>
</div>
</div>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -329,6 +389,7 @@ describe "haml" do
context "tags with HTML-style attributes" do context "tags with HTML-style attributes" do
specify "HTML-style one attribute" do specify "HTML-style one attribute" do
haml = %q{%p(a='b')} haml = %q{%p(a='b')}
html = %q{<p a='b'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -336,6 +397,7 @@ describe "haml" do
specify "HTML-style multiple attributes" do specify "HTML-style multiple attributes" do
haml = %q{%p(a='b' c='d')} haml = %q{%p(a='b' c='d')}
html = %q{<p a='b' c='d'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -345,6 +407,7 @@ describe "haml" do
pending "HTML-style attributes separated with newlines" do pending "HTML-style attributes separated with newlines" do
haml = %q{%p(a='b' haml = %q{%p(a='b'
c='d')} c='d')}
html = %q{<p a='b' c='d'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -352,6 +415,7 @@ describe "haml" do
specify "HTML-style interpolated attribute" do specify "HTML-style interpolated attribute" do
haml = %q{%p(a="#{var}")} haml = %q{%p(a="#{var}")}
html = %q{<p a='value'></p>}
locals = {:var=>"value"} locals = {:var=>"value"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -359,6 +423,7 @@ describe "haml" do
specify "HTML-style 'class' as an attribute" do specify "HTML-style 'class' as an attribute" do
haml = %q{%p(class='class1')} haml = %q{%p(class='class1')}
html = %q{<p class='class1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -366,6 +431,7 @@ describe "haml" do
specify "HTML-style tag with a CSS class and 'class' as an attribute" do specify "HTML-style tag with a CSS class and 'class' as an attribute" do
haml = %q{%p.class2(class='class1')} haml = %q{%p.class2(class='class1')}
html = %q{<p class='class1 class2'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -373,6 +439,7 @@ describe "haml" do
specify "HTML-style tag with 'id' as an attribute" do specify "HTML-style tag with 'id' as an attribute" do
haml = %q{%p(id='1')} haml = %q{%p(id='1')}
html = %q{<p id='1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -380,6 +447,7 @@ describe "haml" do
specify "HTML-style tag with a CSS id and 'id' as an attribute" do specify "HTML-style tag with a CSS id and 'id' as an attribute" do
haml = %q{%p#id(id='1')} haml = %q{%p#id(id='1')}
html = %q{<p id='id_1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -387,6 +455,7 @@ describe "haml" do
specify "HTML-style tag with a variable attribute" do specify "HTML-style tag with a variable attribute" do
haml = %q{%p(class=var)} haml = %q{%p(class=var)}
html = %q{<p class='hello'></p>}
locals = {:var=>"hello"} locals = {:var=>"hello"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -394,6 +463,7 @@ describe "haml" do
specify "HTML-style tag with a CSS class and 'class' as a variable attribute" do specify "HTML-style tag with a CSS class and 'class' as a variable attribute" do
haml = %q{.hello(class=var)} haml = %q{.hello(class=var)}
html = %q{<div class='hello world'></div>}
locals = {:var=>"world"} locals = {:var=>"world"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -401,6 +471,7 @@ describe "haml" do
specify "HTML-style tag multiple CSS classes (sorted correctly)" do specify "HTML-style tag multiple CSS classes (sorted correctly)" do
haml = %q{.z(class=var)} haml = %q{.z(class=var)}
html = %q{<div class='a z'></div>}
locals = {:var=>"a"} locals = {:var=>"a"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -409,6 +480,7 @@ describe "haml" do
# FIXME: currently this is not considered # FIXME: currently this is not considered
pending "HTML-style tag with an atomic attribute" do pending "HTML-style tag with an atomic attribute" do
haml = %q{%a(flag)} haml = %q{%a(flag)}
html = %q{<a flag></a>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -418,6 +490,7 @@ describe "haml" do
context "tags with Ruby-style attributes" do context "tags with Ruby-style attributes" do
specify "Ruby-style one attribute" do specify "Ruby-style one attribute" do
haml = %q{%p{:a => 'b'}} haml = %q{%p{:a => 'b'}}
html = %q{<p a='b'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -425,6 +498,7 @@ describe "haml" do
specify "Ruby-style attributes hash with whitespace" do specify "Ruby-style attributes hash with whitespace" do
haml = %q{%p{ :a => 'b' }} haml = %q{%p{ :a => 'b' }}
html = %q{<p a='b'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -432,6 +506,7 @@ describe "haml" do
specify "Ruby-style interpolated attribute" do specify "Ruby-style interpolated attribute" do
haml = %q{%p{:a =>"#{var}"}} haml = %q{%p{:a =>"#{var}"}}
html = %q{<p a='value'></p>}
locals = {:var=>"value"} locals = {:var=>"value"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -439,6 +514,7 @@ describe "haml" do
specify "Ruby-style multiple attributes" do specify "Ruby-style multiple attributes" do
haml = %q{%p{ :a => 'b', 'c' => 'd' }} haml = %q{%p{ :a => 'b', 'c' => 'd' }}
html = %q{<p a='b' c='d'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -448,6 +524,7 @@ describe "haml" do
pending "Ruby-style attributes separated with newlines" do pending "Ruby-style attributes separated with newlines" do
haml = %q{%p{ :a => 'b', haml = %q{%p{ :a => 'b',
'c' => 'd' }} 'c' => 'd' }}
html = %q{<p a='b' c='d'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -455,6 +532,7 @@ describe "haml" do
specify "Ruby-style 'class' as an attribute" do specify "Ruby-style 'class' as an attribute" do
haml = %q{%p{:class => 'class1'}} haml = %q{%p{:class => 'class1'}}
html = %q{<p class='class1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -462,6 +540,7 @@ describe "haml" do
specify "Ruby-style tag with a CSS class and 'class' as an attribute" do specify "Ruby-style tag with a CSS class and 'class' as an attribute" do
haml = %q{%p.class2{:class => 'class1'}} haml = %q{%p.class2{:class => 'class1'}}
html = %q{<p class='class1 class2'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -469,6 +548,7 @@ describe "haml" do
specify "Ruby-style tag with 'id' as an attribute" do specify "Ruby-style tag with 'id' as an attribute" do
haml = %q{%p{:id => '1'}} haml = %q{%p{:id => '1'}}
html = %q{<p id='1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -476,6 +556,7 @@ describe "haml" do
specify "Ruby-style tag with a CSS id and 'id' as an attribute" do specify "Ruby-style tag with a CSS id and 'id' as an attribute" do
haml = %q{%p#id{:id => '1'}} haml = %q{%p#id{:id => '1'}}
html = %q{<p id='id_1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -483,6 +564,7 @@ describe "haml" do
specify "Ruby-style tag with a CSS id and a numeric 'id' as an attribute" do specify "Ruby-style tag with a CSS id and a numeric 'id' as an attribute" do
haml = %q{%p#id{:id => 1}} haml = %q{%p#id{:id => 1}}
html = %q{<p id='id_1'></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -490,6 +572,7 @@ describe "haml" do
specify "Ruby-style tag with a variable attribute" do specify "Ruby-style tag with a variable attribute" do
haml = %q{%p{:class => var}} haml = %q{%p{:class => var}}
html = %q{<p class='hello'></p>}
locals = {:var=>"hello"} locals = {:var=>"hello"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -497,6 +580,7 @@ describe "haml" do
specify "Ruby-style tag with a CSS class and 'class' as a variable attribute" do specify "Ruby-style tag with a CSS class and 'class' as a variable attribute" do
haml = %q{.hello{:class => var}} haml = %q{.hello{:class => var}}
html = %q{<div class='hello world'></div>}
locals = {:var=>"world"} locals = {:var=>"world"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -504,6 +588,7 @@ describe "haml" do
specify "Ruby-style tag multiple CSS classes (sorted correctly)" do specify "Ruby-style tag multiple CSS classes (sorted correctly)" do
haml = %q{.z{:class => var}} haml = %q{.z{:class => var}}
html = %q{<div class='a z'></div>}
locals = {:var=>"a"} locals = {:var=>"a"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -513,6 +598,7 @@ describe "haml" do
context "silent comments" do context "silent comments" do
specify "an inline silent comment" do specify "an inline silent comment" do
haml = %q{-# hello} haml = %q{-# hello}
html = %q{}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -521,6 +607,7 @@ describe "haml" do
specify "a nested silent comment" do specify "a nested silent comment" do
haml = %q{-# haml = %q{-#
hello} hello}
html = %q{}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -530,6 +617,7 @@ describe "haml" do
haml = %q{-# haml = %q{-#
%div %div
foo} foo}
html = %q{}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -539,6 +627,7 @@ describe "haml" do
haml = %q{-# haml = %q{-#
%div %div
foo} foo}
html = %q{}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -548,6 +637,7 @@ describe "haml" do
context "markup comments" do context "markup comments" do
specify "an inline markup comment" do specify "an inline markup comment" do
haml = %q{/ comment} haml = %q{/ comment}
html = %q{<!-- comment -->}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -557,6 +647,10 @@ describe "haml" do
haml = %q{/ haml = %q{/
comment comment
comment2} comment2}
html = %q{<!--
comment
comment2
-->}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -564,9 +658,13 @@ describe "haml" do
end end
context "conditional comments" do context "conditional comments" do
specify "a conditional comment" do # FIXME: I'll implement later
pending "a conditional comment" do
haml = %q{/[if IE] haml = %q{/[if IE]
%p a} %p a}
html = %q{<!--[if IE]>
<p>a</p>
<![endif]-->}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -577,6 +675,7 @@ describe "haml" do
specify "content in an 'escaped' filter" do specify "content in an 'escaped' filter" do
haml = %q{:escaped haml = %q{:escaped
<&">} <&">}
html = %q{&lt;&amp;&quot;&gt;}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -587,6 +686,8 @@ describe "haml" do
hello hello
%p} %p}
html = %q{hello&#x000A;
<p></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -597,6 +698,8 @@ describe "haml" do
hello hello
%p} %p}
html = %q{hello
<p></p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -607,6 +710,12 @@ describe "haml" do
hello hello
%p} %p}
html = %q{<style type='text/css'>
/*<![CDATA[*/
hello
/*]]>*/
</style>
<p></p>}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -616,6 +725,12 @@ describe "haml" do
haml = %q{:javascript haml = %q{:javascript
a(); a();
%p} %p}
html = %q{<script type='text/javascript'>
//<![CDATA[
a();
//]]>
</script>
<p></p>}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -626,6 +741,10 @@ describe "haml" do
hello hello
%p} %p}
html = %q{<style>
hello
</style>
<p></p>}
locals = {} locals = {}
options = {:format=>:html5} options = {:format=>:html5}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -635,6 +754,10 @@ describe "haml" do
haml = %q{:javascript haml = %q{:javascript
a(); a();
%p} %p}
html = %q{<script>
a();
</script>
<p></p>}
locals = {} locals = {}
options = {:format=>:html5} options = {:format=>:html5}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -644,6 +767,7 @@ describe "haml" do
context "Ruby-style interpolation" do context "Ruby-style interpolation" do
specify "interpolation inside inline content" do specify "interpolation inside inline content" do
haml = %q{%p #{var}} haml = %q{%p #{var}}
html = %q{<p>value</p>}
locals = {:var=>"value"} locals = {:var=>"value"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -651,6 +775,7 @@ describe "haml" do
specify "no interpolation when escaped" do specify "no interpolation when escaped" do
haml = %q{%p \#{var}} haml = %q{%p \#{var}}
html = %q{<p>#{var}</p>}
locals = {:var=>"value"} locals = {:var=>"value"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -658,6 +783,7 @@ describe "haml" do
specify "interpolation when the escape character is escaped" do specify "interpolation when the escape character is escaped" do
haml = %q{%p \\#{var}} haml = %q{%p \\#{var}}
html = %q{<p>\value</p>}
locals = {:var=>"value"} locals = {:var=>"value"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -666,6 +792,7 @@ describe "haml" do
specify "interpolation inside filtered content" do specify "interpolation inside filtered content" do
haml = %q{:plain haml = %q{:plain
#{var} interpolated: #{var}} #{var} interpolated: #{var}}
html = %q{value interpolated: value}
locals = {:var=>"value"} locals = {:var=>"value"}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -675,6 +802,7 @@ describe "haml" do
context "HTML escaping" do context "HTML escaping" do
specify "code following '&='" do specify "code following '&='" do
haml = %q{&= '<"&>'} haml = %q{&= '<"&>'}
html = %q{&lt;&quot;&amp;&gt;}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -682,6 +810,7 @@ describe "haml" do
specify "code following '=' when escape_haml is set to true" do specify "code following '=' when escape_haml is set to true" do
haml = %q{= '<"&>'} haml = %q{= '<"&>'}
html = %q{&lt;&quot;&amp;&gt;}
locals = {} locals = {}
options = {:escape_html=>"true"} options = {:escape_html=>"true"}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -689,6 +818,7 @@ describe "haml" do
specify "code following '!=' when escape_haml is set to true" do specify "code following '!=' when escape_haml is set to true" do
haml = %q{!= '<"&>'} haml = %q{!= '<"&>'}
html = %q{<"&>}
locals = {} locals = {}
options = {:escape_html=>"true"} options = {:escape_html=>"true"}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -698,6 +828,7 @@ describe "haml" do
context "boolean attributes" do context "boolean attributes" do
specify "boolean attribute with XHTML" do specify "boolean attribute with XHTML" do
haml = %q{%input(checked=true)} haml = %q{%input(checked=true)}
html = %q{<input checked='checked' />}
locals = {} locals = {}
options = {:format=>:xhtml} options = {:format=>:xhtml}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -705,6 +836,7 @@ describe "haml" do
specify "boolean attribute with HTML" do specify "boolean attribute with HTML" do
haml = %q{%input(checked=true)} haml = %q{%input(checked=true)}
html = %q{<input checked>}
locals = {} locals = {}
options = {:format=>:html5} options = {:format=>:html5}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -714,6 +846,8 @@ describe "haml" do
context "whitespace preservation" do context "whitespace preservation" do
specify "following the '~' operator" do specify "following the '~' operator" do
haml = %q{~ "Foo\n<pre>Bar\nBaz</pre>"} haml = %q{~ "Foo\n<pre>Bar\nBaz</pre>"}
html = %q{Foo
<pre>Bar&#x000A;Baz</pre>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -723,6 +857,8 @@ describe "haml" do
haml = %q{%textarea haml = %q{%textarea
hello hello
hello} hello}
html = %q{<textarea>hello
hello</textarea>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -732,6 +868,8 @@ describe "haml" do
haml = %q{%pre haml = %q{%pre
hello hello
hello} hello}
html = %q{<pre>hello
hello</pre>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -743,6 +881,7 @@ describe "haml" do
haml = %q{%li hello haml = %q{%li hello
%li> world %li> world
%li again} %li again}
html = %q{<li>hello</li><li>world</li><li>again</li>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -753,6 +892,9 @@ describe "haml" do
%li> %li>
world world
%li again} %li again}
html = %q{<li>hello</li><li>
world
</li><li>again</li>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)
@ -762,6 +904,8 @@ describe "haml" do
haml = %q{%p< haml = %q{%p<
hello hello
world} world}
html = %q{<p>hello
world</p>}
locals = {} locals = {}
options = {} options = {}
assert_ugly(haml, locals, options) assert_ugly(haml, locals, options)