test/parser_test.rb in trac-wiki-0.2.20 vs test/parser_test.rb in trac-wiki-0.2.21
- old
+ new
@@ -31,12 +31,10 @@
"WEST"
when 'deep'
"{{deep}}"
when 'wide'
"0123456789{{wide}}" * 10
- when 'fortest'
- "{{$y.data.a}},({{!for i|y.data|AHOJ({{$i}})\n{{$y.data.$i}};\n}}),{{$y.data.a}}"
else
nil
#"UNK_TEMPL(#{tname})"
end
end
@@ -183,11 +181,12 @@
it 'should parse headings' do
# Only three differed sized levels of heading are required.
tc "<h1>Heading 1</h1>", "= Heading 1 ="
tc "<h2>Heading 2</h2>", "== Heading 2 =="
tc "<h3>Heading 3</h3>", "=== Heading 3 ==="
- tc "<h3>Heading 3\u00a0B</h3>", "=== Heading 3~B ==="
+ #tc "<h3>Heading 3\u00a0B</h3>", "=== Heading 3~B ==="
+ tc "<h3>Heading 3 B</h3>", "=== Heading 3~B ==="
tc "<h3 id=\"HE3\">Heading 3</h3>", "=== Heading 3 === #HE3"
tc "<h3 id=\"Heading-3\">Heading 3</h3>", "=== Heading 3 === #Heading-3"
tc "<h3 id=\"Heading/3\">Heading 3</h3>", "=== Heading 3 === #Heading/3"
tc "<h3 id=\"Heading/3\">Heading 3</h3>", "=== Heading 3 === #Heading/3 "
tc "<h3 id=\"Heading/3\">Heading 3</h3><h3 id=\"Heading/3.2\">Heading 3</h3>",
@@ -549,11 +548,12 @@
it 'should support character escape' do
tc "<p>** Not Bold **</p>\n", "!** Not Bold !**"
tc "<p>// Not Italic //</p>\n", "!// Not Italic !//"
tc "<p>* Not Bullet</p>\n", "!* Not Bullet"
# Following char is not a blank (space or line feed)
- tc "<p>Hello \u00a0 world</p>\n", "Hello ~ world\n"
+ #tc "<p>Hello \u00a0 world</p>\n", "Hello ~ world\n"
+ tc "<p>Hello world</p>\n", "Hello ~ world\n"
tc "<p>Hello ! world</p>\n", "Hello ! world\n"
tc "<p>Hello ! world</p>\n", "Hello ! world\n"
tc "<p>Hello ! world</p>\n", "Hello !\nworld\n"
# Not escaping inside URLs
tc "<p><a href=\"http://example.org/~user/\">http://example.org/~user/</a></p>\n", "http://example.org/~user/"
@@ -937,20 +937,18 @@
end
it 'should support options' do
tc "<h3>h1<a class=\"editheading\" href=\"?edit=1\">edit</a></h3>", "=== h1 ==", edit_heading: true
end
it 'should not html' do
- #tc "<p>{{{! <a></a> }}}</p>\n", "{{{!\n<a></a>\n}}}\n"
- tc '<a></a>', "{{{!\n<a></a>\n}}}\n", raw_html: true
- tc '<a></a>', "{{{!\n<a></a>\n}}}\n", raw_html: true
- tc "<form meth=\"POST\" action=\"http://www.example.com\"><input type=\"hidden\" value=\"VAL\"></form>",
- "{{{!\n<form meth=\"POST\" action=\"http://www.example.com\"><input type=\"hidden\" value=\"VAL\"/></form>\n}}}\n", raw_html: true
- tc 'alert(444);', "{{{!\n<script>alert(444);</script>\n}}}\n", raw_html: true
+ tc "<p><b></b></p>\n", "<b></b>\n"
+ tc "<p><div><script>alert(666)</script></div></p>\n", "<div><script>alert(666)</script></div>\n"
end
it 'should entity' do
- tc "<p>\u00a0</p>\n", " "
- tc "<p>„text“</p>\n", "„text“"
+ #tc "<p>\u00a0</p>\n", " "
+ #tc "<p>„text“</p>\n", "„text“"
+ tc "<p> </p>\n", " "
+ tc "<p>„text“</p>\n", "„text“"
end
it 'should plugin' do
tc "<p>AHOJTE!</p>\n", "{{!print AHOJTE}}"
tc "<p>test:AHOJTE! AHOJTE! </p>\n", "test:{{!print AHOJTE}}{{!print AHOJTE}}"
tc "<p>FALSE</p>\n", "{{ifeqtest JEDNA|DVE}}"
@@ -977,32 +975,31 @@
tc "<p>,FALSE</p>\n", "{{!yset data|[1,2]}},{{!ifdef data.55|TRUE|FALSE}}"
tc "<p>,TRUE</p>\n", "{{!yset data|[1,2]}},{{!ifdef data.1|TRUE|FALSE}}"
tc "<p>,TRUE</p>\n", "{{!yset data|{a: 1, b: 2} }},{{!ifdef data.a|TRUE|FALSE}}"
tc "<p>,FALSE</p>\n", "{{!yset data|{a: 1, b: 2} }},{{!ifdef data.q|TRUE|FALSE}}"
- tc "<p>,1,(1;2;),1</p>\n", "{{!yset data|{a: 1, b: 2} }},{{$data.a}},({{!for i|data|{{$data.$i}};}}),{{$data.a}}"
- tc "<p>1,(AHOJ(a) 1; AHOJ(b) 2; ),1</p>\n", "{{fortest data:\n a: 1\n b: 2 }}"
end
- it 'should {{!sub}}' do
- tc "<p>ahoj_you_one</p>\n", "{{!sub ahoj you one| |_}}"
- tc "<p>-h-j --- -n-</p>\n", "{{!sub ahoj you one|/[aeiouy]/|-}}"
- tc "<p>ahoj MATCH(you) one</p>\n", "{{!sub ahoj you one|/(y.u)/|MATCH(\\1)}}"
- end
+ it 'should parse html' do
+ tc "<p>alert(666)</p>\n", "<script>alert(666)</script>", raw_html: true
+ tc "<p><b>T</b>E</p>\n", "<p><b>T</b>E</p>", raw_html: true
+ tc "<p><span>Span</span></p>\n", "<span>Span</span>\n", raw_html: true
+ tc "<p><strong><span>Span</span></strong></p>\n", "**<span>Span</span>**\n", raw_html: true
+ tc "<div class=\"ahoj\">Div</div>\n", "<div class=\"ahoj\">Div</div>\n", raw_html: true
+ tc "<p><strong>ahoj</strong></p>\n<div class=\"ahoj\">Div</div>\n", "**ahoj<div class=\"ahoj\">Div</div>\n", raw_html: true
+ tc "<p><span>Span</span><span>Span</span></p>\n", "<span>Span</span><span>Span</span>\n", raw_html: true
+ tc "<p><em><b>boldoitali</b></em>cE</p>\n", "<p>''<b>boldoitali''c</b>E</p>", raw_html: true
+ tc "<p><b>blabla</b></p>\n<p>endE</p>\n", "<p><b>bla</html>bla</p>end</b>E</p>", raw_html: true
+ tc "<p>baf</p>\n", "\n\n\nbaf\n\n\n", raw_html: true
+ tc "<div class=\"ahoj\">Div</div>\n<p>baf</p>\n", "<div class=\"ahoj\">Div</div>\nbaf\n", raw_html: true
- it 'should {{!html}}' do
- tc "alert(666)", "{{!html <script>alert(666)</script>}}", raw_html: true
- tc "<p><b>T</b>E</p>", "{{!html <p><b>T</b>E</p>}}\n", raw_html: true
- tc "<span>Span</span>", "{{!html <span>Span</span>}}\n", raw_html: true
- #tc "<span>Span</span>", "**{{!html <span>Span</span>}}**\n", raw_html: true
- tc "<div class=\"ahoj\">Div</div>", "{{!html <div class=\"ahoj\">Div</div>}}\n", raw_html: true
- tc "<span>Span</span><span>Span</span>", "{{!html <span>Span</span>}}{{!html <span>Span</span>}}\n", raw_html: true
- tc "<p>ahoj <span class=\"spanclass\">span</span> bhoj dhoj choj</p>\n", "ahoj {{{!<span class=\"spanclass\">span</span> bhoj}}} dhoj \nchoj\n", raw_html: true
- tc "<p>ahoj Q<span class=\"spanclass\">span</span> bhojQ dhoj choj</p>\n", "ahoj Q{{{!<span class=\"spanclass\">span</span> bhoj}}}Q dhoj \nchoj\n", raw_html: true
+ tc "<p><b>BOLD</b></p>\n", "<b>BOLD</b>\n", raw_html: true
+ tc "<p><br/></p>\n", "<br/>\n", raw_html: true
+ tc "<p><br/></p>\n", "<br></br>\n", raw_html: true
+ tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b class=\"bclass\">BOLD</b>\n", raw_html: true
+ tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b bad=\"bad\" class=\"bclass\">BOLD</b>\n", raw_html: true
+ tc "<p><b class=\"bclass\">BOLD</b></p>\n", "<b bad=\"bad\" class=\"bclass\">BOLD</b>\n", raw_html: true
end
-# it 'last test' do
-# #tc "<p>1,(AHOJ(a) 1; AHOJ(b) 2; ),1</p>\n", "{{fortest data:\n a: 1\n b: 2 }}"
-#
-# end
+
end
end
# vim: tw=0