Many Minor Fixes

Fixed a whole bunch of minor stuff.
Had a go at getting some of the plethora of broken tests to pass.
This commit is contained in:
Jacques Distler 2007-06-12 17:37:55 -05:00
parent 0ddd422059
commit 2da672ec5b
13 changed files with 108 additions and 84 deletions

View file

@ -46,7 +46,7 @@ class PageRendererTest < Test::Unit::TestCase
'would be <a class="existingWikiWord" href="../show/MyWay">My Way</a> in kinda ' +
'<a class="existingWikiWord" href="../show/ThatWay">That Way</a> in ' +
'<span class="newWikiWord">His Way<a href="../show/HisWay">?</a></span> ' +
'though <a class="existingWikiWord" href="../show/MyWay">My Way</a> OverThere&#8212;see ' +
"though <a class=\"existingWikiWord\" href=\"../show/MyWay\">My Way</a> OverThere\u8212see " +
'<a class="existingWikiWord" href="../show/SmartEngine">Smart Engine</a> in that ' +
'<span class="newWikiWord">Smart Engine GUI' +
'<a href="../show/SmartEngineGUI">?</a></span></p>',
@ -159,14 +159,14 @@ class PageRendererTest < Test::Unit::TestCase
# wikiwords are invalid as styles, must be in "name: value" form
def test_content_with_wikiword_in_style_tag
assert_markup_parsed_as(
'<p>That is some <em style="">Stylish Emphasis</em></p>',
"<p>That is some <em style=''>Stylish Emphasis</em></p>",
'That is some <em style="WikiWord">Stylish Emphasis</em>')
end
# validates format of style..
def test_content_with_valid_style_in_style_tag
assert_markup_parsed_as(
'<p>That is some <em style="text-align: right;">Stylish Emphasis</em></p>',
"<p>That is some <em style='text-align: right;'>Stylish Emphasis</em></p>",
'That is some <em style="text-align: right">Stylish Emphasis</em>')
end
@ -177,37 +177,37 @@ class PageRendererTest < Test::Unit::TestCase
def test_content_with_pre_blocks
assert_markup_parsed_as(
'<p>A <code>class SmartEngine end</code> would not mark up <pre>CodeBlocks</pre></p>',
'<p>A <code>class SmartEngine end</code> would not mark up </p><pre>CodeBlocks</pre>',
'A <code>class SmartEngine end</code> would not mark up <pre>CodeBlocks</pre>')
end
def test_content_with_autolink_in_parentheses
assert_markup_parsed_as(
'<p>The <span class="caps">W3C</span> body (<a href="http://www.w3c.org">' +
'<p>The <span class=\'caps\'>W3C</span> body (<a href="http://www.w3c.org">' +
'http://www.w3c.org</a>) sets web standards</p>',
'The W3C body (http://www.w3c.org) sets web standards')
end
def test_content_with_link_in_parentheses
assert_markup_parsed_as(
'<p>(<a href="http://wiki.org/wiki.cgi?WhatIsWiki">What is a wiki?</a>)</p>',
"<p>(<a href='http://wiki.org/wiki.cgi?WhatIsWiki'>What is a wiki?</a>)</p>",
'("What is a wiki?":http://wiki.org/wiki.cgi?WhatIsWiki)')
end
def test_content_with_image_link
assert_markup_parsed_as(
'<p>This <img src="http://hobix.com/sample.jpg" alt="" /> is a Textile image link.</p>',
"<p>This <img src='http://hobix.com/sample.jpg' alt=''/> is a Textile image link.</p>",
'This !http://hobix.com/sample.jpg! is a Textile image link.')
end
def test_content_with_inlined_img_tag
assert_markup_parsed_as(
'<p>This <img src="http://hobix.com/sample.jpg" alt="" /> is an inline image link.</p>',
"<p>This <img src='http://hobix.com/sample.jpg' alt=''/> is an inline image link.</p>",
'This <img src="http://hobix.com/sample.jpg" alt="" /> is an inline image link.')
# currently, upper case HTML elements are not allowed
assert_markup_parsed_as(
'<p>This &lt;IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.</p>',
'<p>This &lt;IMG SRC="http://hobix.com/sample.jpg" alt=""&gt; is an inline image link.</p>',
'This <IMG SRC="http://hobix.com/sample.jpg" alt=""> is an inline image link.')
end
@ -239,7 +239,7 @@ class PageRendererTest < Test::Unit::TestCase
'<a class="existingWikiWord" href="MyWay.html">My Way</a> in kinda ' +
'<a class="existingWikiWord" href="ThatWay.html">That Way</a> in ' +
'<span class="newWikiWord">His Way</span> though ' +
'<a class="existingWikiWord" href="MyWay.html">My Way</a> OverThere&#8212;see ' +
"<a class=\"existingWikiWord\" href=\"MyWay.html\">My Way</a> OverThere\u8212see " +
'<a class="existingWikiWord" href="SmartEngine.html">Smart Engine</a> in that ' +
'<span class="newWikiWord">Smart Engine GUI</span></p>',
test_renderer(@revision).display_content_for_export
@ -254,7 +254,7 @@ class PageRendererTest < Test::Unit::TestCase
test_renderer(@revision).display_content
@revision.content = "f\r\nVersionHistory\r\n\r\ncry VersionHistory"
assert_equal "<p>f<br /><span class=\"newWikiWord\">Version History" +
assert_equal "<p>f<br/><span class=\"newWikiWord\">Version History" +
"<a href=\"../show/VersionHistory\">?</a></span></p>\n\n\n\t<p>cry " +
"<span class=\"newWikiWord\">Version History<a href=\"../show/VersionHistory\">?</a>" +
"</span></p>",
@ -321,14 +321,14 @@ class PageRendererTest < Test::Unit::TestCase
EOL
assert_markup_parsed_as(
"<ul>\n\t<li><a href=\"~b\">a</a></li>\n\t\t<li>c~ d</li>\n\t</ul>",
"<ul>\n\t<li><a href='~b'>a</a></li>\n\t\t<li>c~ d</li>\n\t</ul>",
list_with_tildas)
end
def test_textile_image_in_mixed_wiki
set_web_property :markup, :mixed
assert_markup_parsed_as(
"<p><img src=\"http://google.com\" alt=\"\" />\nss</p>",
"<p><img src='http://google.com' alt=''/>\nss</p>",
"!http://google.com!\r\nss")
end
@ -395,4 +395,4 @@ class PageRendererTest < Test::Unit::TestCase
test_renderer(page.revisions.last).display_content
end
end
end

View file

@ -40,7 +40,7 @@ class WebTest < Test::Unit::TestCase
assert_equal '123', web.password
# new web should be set for maximum features enabled
assert_equal :textile, web.markup
assert_equal :markdownMML, web.markup
assert_equal '008B26', web.color
assert !web.safe_mode?
assert_equal([], web.pages)