Mercurial > hg > soundsoftware-site
comparison test/unit/helpers/application_helper_test.rb @ 117:af80e5618e9b redmine-1.1
* Update to Redmine 1.1-stable branch (Redmine SVN rev 4707)
author | Chris Cannam |
---|---|
date | Thu, 13 Jan 2011 12:53:21 +0000 |
parents | 94944d00e43c |
children | cd2282d2aa55 |
comparison
equal
deleted
inserted
replaced
39:150ceac17a8d | 117:af80e5618e9b |
---|---|
13 # | 13 # |
14 # You should have received a copy of the GNU General Public License | 14 # You should have received a copy of the GNU General Public License |
15 # along with this program; if not, write to the Free Software | 15 # along with this program; if not, write to the Free Software |
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
17 | 17 |
18 require File.dirname(__FILE__) + '/../../test_helper' | 18 require File.expand_path('../../../test_helper', __FILE__) |
19 | 19 |
20 class ApplicationHelperTest < ActionView::TestCase | 20 class ApplicationHelperTest < ActionView::TestCase |
21 | 21 |
22 fixtures :projects, :roles, :enabled_modules, :users, | 22 fixtures :projects, :roles, :enabled_modules, :users, |
23 :repositories, :changesets, | 23 :repositories, :changesets, |
273 "<pre><div>content</div></pre>" => "<pre><div>content</div></pre>", | 273 "<pre><div>content</div></pre>" => "<pre><div>content</div></pre>", |
274 "HTML comment: <!-- no comments -->" => "<p>HTML comment: <!-- no comments --></p>", | 274 "HTML comment: <!-- no comments -->" => "<p>HTML comment: <!-- no comments --></p>", |
275 "<!-- opening comment" => "<p><!-- opening comment</p>", | 275 "<!-- opening comment" => "<p><!-- opening comment</p>", |
276 # remove attributes except class | 276 # remove attributes except class |
277 "<pre class='foo'>some text</pre>" => "<pre class='foo'>some text</pre>", | 277 "<pre class='foo'>some text</pre>" => "<pre class='foo'>some text</pre>", |
278 '<pre class="foo">some text</pre>' => '<pre class="foo">some text</pre>', | |
279 "<pre class='foo bar'>some text</pre>" => "<pre class='foo bar'>some text</pre>", | |
280 '<pre class="foo bar">some text</pre>' => '<pre class="foo bar">some text</pre>', | |
278 "<pre onmouseover='alert(1)'>some text</pre>" => "<pre>some text</pre>", | 281 "<pre onmouseover='alert(1)'>some text</pre>" => "<pre>some text</pre>", |
282 # xss | |
283 '<pre><code class=""onmouseover="alert(1)">text</code></pre>' => '<pre><code>text</code></pre>', | |
284 '<pre class=""onmouseover="alert(1)">text</pre>' => '<pre>text</pre>', | |
279 } | 285 } |
280 to_test.each { |text, result| assert_equal result, textilizable(text) } | 286 to_test.each { |text, result| assert_equal result, textilizable(text) } |
281 end | 287 end |
282 | 288 |
283 def test_allowed_html_tags | 289 def test_allowed_html_tags |
420 Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor. | 426 Nullam commodo metus accumsan nulla. Curabitur lobortis dui id dolor. |
421 | 427 |
422 h2. Subtitle with [[Wiki|another Wiki]] link | 428 h2. Subtitle with [[Wiki|another Wiki]] link |
423 | 429 |
424 h2. Subtitle with %{color:red}red text% | 430 h2. Subtitle with %{color:red}red text% |
425 | 431 |
432 <pre> | |
433 some code | |
434 </pre> | |
435 | |
426 h3. Subtitle with *some* _modifiers_ | 436 h3. Subtitle with *some* _modifiers_ |
427 | 437 |
428 h1. Another title | 438 h1. Another title |
429 | 439 |
430 h3. An "Internet link":http://www.redmine.org/ inside subtitle | 440 h3. An "Internet link":http://www.redmine.org/ inside subtitle |
456 '</ul>' + | 466 '</ul>' + |
457 '</li>' + | 467 '</li>' + |
458 '</ul>' | 468 '</ul>' |
459 | 469 |
460 @project = Project.find(1) | 470 @project = Project.find(1) |
461 assert textilizable(raw).gsub("\n", "").include?(expected) | 471 assert textilizable(raw).gsub("\n", "").include?(expected), textilizable(raw) |
462 end | 472 end |
463 | 473 |
464 def test_table_of_content_should_contain_included_page_headings | 474 def test_table_of_content_should_contain_included_page_headings |
465 raw = <<-RAW | 475 raw = <<-RAW |
466 {{toc}} | 476 {{toc}} |