diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-12 14:00:43 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-12 14:00:43 +0000 |
commit | 0ede069d2c793995dadcd432b5540c8f74599889 (patch) | |
tree | 9af671081c89719b8efb3c8d7a0d3061fe34963e /test | |
parent | e14a9f5503a909482d07e38a27c1718aa24cf528 (diff) | |
download | redmine-0ede069d2c793995dadcd432b5540c8f74599889.tar.gz redmine-0ede069d2c793995dadcd432b5540c8f74599889.zip |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/lib/redmine/wiki_formatting/textile_formatter_test.rb | 44 |
1 files changed, 44 insertions, 0 deletions
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' => '<p style="color:red;">text</p>', + 'p{color:red;}. text' => '<p style="color:red;">text</p>', + 'p{color: red}. text' => '<p style="color: red;">text</p>', + 'p{color:#f00}. text' => '<p style="color:#f00;">text</p>', + 'p{color:#ff0000}. text' => '<p style="color:#ff0000;">text</p>', + 'p{border:10px}. text' => '<p style="border:10px;">text</p>', + 'p{border:10}. text' => '<p style="border:10;">text</p>', + 'p{border:10%}. text' => '<p style="border:10%;">text</p>', + 'p{border:10em}. text' => '<p style="border:10em;">text</p>', + 'p{border:1.5em}. text' => '<p style="border:1.5em;">text</p>', + 'p{border-left:1px}. text' => '<p style="border-left:1px;">text</p>', + 'p{border-right:1px}. text' => '<p style="border-right:1px;">text</p>', + 'p{border-top:1px}. text' => '<p style="border-top:1px;">text</p>', + 'p{border-bottom:1px}. text' => '<p style="border-bottom:1px;">text</p>', + }, false) + + # multiple styles + assert_html_output({ + 'p{color:red; border-top:1px}. text' => '<p style="color:red;border-top:1px;">text</p>', + 'p{color:red ; border-top:1px}. text' => '<p style="color:red;border-top:1px;">text</p>', + 'p{color:red;border-top:1px}. text' => '<p style="color:red;border-top:1px;">text</p>', + }, false) + + # styles with multiple values + assert_html_output({ + 'p{border:1px solid red;}. text' => '<p style="border:1px solid red;">text</p>', + 'p{border-top-left-radius: 10px 5px;}. text' => '<p style="border-top-left-radius: 10px 5px;">text</p>', + }, false) + end + + def test_invalid_styles_should_be_filtered + assert_html_output({ + 'p{invalid}. text' => '<p>text</p>', + 'p{invalid:red}. text' => '<p>text</p>', + 'p{color:(red)}. text' => '<p>text</p>', + 'p{color:red;invalid:blue}. text' => '<p style="color:red;">text</p>', + 'p{invalid:blue;color:red}. text' => '<p style="color:red;">text</p>', + 'p{color:"}. text' => '<p>text</p>', + }, false) + end + def test_inline_code assert_html_output( 'this is @some code@' => 'this is <code>some code</code>', |