summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-08 15:18:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-08 15:18:02 +0000
commit9ae6e60c260e8d695034244eb890fc77c60f54f6 (patch)
tree05bdb3a1cd404444a2c5225dbc0d67a510715fdd /test
parent077723c90a97e517b3726a0d9c66e36c0cd18d2f (diff)
downloadredmine-9ae6e60c260e8d695034244eb890fc77c60f54f6.tar.gz
redmine-9ae6e60c260e8d695034244eb890fc77c60f54f6.zip
Fixes syntax highlighting broken by r1930 (#2143).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@1993 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/helpers/application_helper_test.rb20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index cbf5a54bc..b3ff974e9 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -192,8 +192,9 @@ class ApplicationHelperTest < HelperTestCase
"<pre><div>content</div></pre>" => "<pre>&lt;div&gt;content&lt;/div&gt;</pre>",
"HTML comment: <!-- no comments -->" => "<p>HTML comment: &lt;!-- no comments --&gt;</p>",
"<!-- opening comment" => "<p>&lt;!-- opening comment</p>",
- # remove attributes
- "<pre class='foo'>some text</pre>" => "<pre>some text</pre>",
+ # remove attributes except class
+ "<pre class='foo'>some text</pre>" => "<pre class='foo'>some text</pre>",
+ "<pre onmouseover='alert(1)'>some text</pre>" => "<pre>some text</pre>",
}
to_test.each { |text, result| assert_equal result, textilizable(text) }
end
@@ -207,6 +208,21 @@ class ApplicationHelperTest < HelperTestCase
to_test.each { |text, result| assert_equal result, textilizable(text) }
end
+ def syntax_highlight
+ raw = <<-RAW
+<pre><code class="ruby">
+# Some ruby code here
+</pre></code>
+RAW
+
+ expected = <<-EXPECTED
+<pre><code class="ruby CodeRay"><span class="no">1</span> <span class="c"># Some ruby code here</span>
+</pre></code>
+EXPECTED
+
+ assert_equal expected.gsub(%r{[\r\n\t]}, ''), textilizable(raw).gsub(%r{[\r\n\t]}, '')
+ end
+
def test_wiki_links_in_tables
to_test = {"|[[Page|Link title]]|[[Other Page|Other title]]|\n|Cell 21|[[Last page]]|" =>
'<tr><td><a href="/wiki/ecookbook/Page" class="wiki-page new">Link title</a></td>' +