From 0ede069d2c793995dadcd432b5540c8f74599889 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 12 Feb 2012 14:00:43 +0000 Subject: Allows custom styles in textile formatting using a white list of styles (#2416). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8860 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .../wiki_formatting/textile_formatter_test.rb | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'test') diff --git a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb index 26250997e..ce4feb62a 100644 --- a/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb +++ b/test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb @@ -59,6 +59,50 @@ class Redmine::WikiFormatting::TextileFormatterTest < ActionView::TestCase end end + def test_styles + # single style + assert_html_output({ + 'p{color:red}. text' => '

text

', + 'p{color:red;}. text' => '

text

', + 'p{color: red}. text' => '

text

', + 'p{color:#f00}. text' => '

text

', + 'p{color:#ff0000}. text' => '

text

', + 'p{border:10px}. text' => '

text

', + 'p{border:10}. text' => '

text

', + 'p{border:10%}. text' => '

text

', + 'p{border:10em}. text' => '

text

', + 'p{border:1.5em}. text' => '

text

', + 'p{border-left:1px}. text' => '

text

', + 'p{border-right:1px}. text' => '

text

', + 'p{border-top:1px}. text' => '

text

', + 'p{border-bottom:1px}. text' => '

text

', + }, false) + + # multiple styles + assert_html_output({ + 'p{color:red; border-top:1px}. text' => '

text

', + 'p{color:red ; border-top:1px}. text' => '

text

', + 'p{color:red;border-top:1px}. text' => '

text

', + }, false) + + # styles with multiple values + assert_html_output({ + 'p{border:1px solid red;}. text' => '

text

', + 'p{border-top-left-radius: 10px 5px;}. text' => '

text

', + }, false) + end + + def test_invalid_styles_should_be_filtered + assert_html_output({ + 'p{invalid}. text' => '

text

', + 'p{invalid:red}. text' => '

text

', + 'p{color:(red)}. text' => '

text

', + 'p{color:red;invalid:blue}. text' => '

text

', + 'p{invalid:blue;color:red}. text' => '

text

', + 'p{color:"}. text' => '

text

', + }, false) + end + def test_inline_code assert_html_output( 'this is @some code@' => 'this is some code', -- cgit v1.2.3