spoiler tags are now inline

This commit is contained in:
albert
2011-10-24 13:49:45 -04:00
parent d2177512ea
commit 1fc7907374
4 changed files with 254 additions and 187 deletions

View File

@@ -17,10 +17,11 @@ class DTextTest < ActiveSupport::TestCase
end
def test_spoilers
assert_equal("", p("this is [spoiler]an inline spoiler[/spoiler]."))
assert_equal("", p("this is\n\n[spoiler]\na block spoiler\n[/spoiler]."))
assert_equal("", p("[spoiler]this is a spoiler with no closing tag\nnew text"))
assert_equal("", p("[spoiler]this is [spoiler]a nested[/spoiler] spoiler[/spoiler]"))
assert_equal("<p>this is <span class=\"spoiler\">an inline spoiler</span>.</p>", p("this is [spoiler]an inline spoiler[/spoiler]."))
assert_equal("<p>this is</p><p><span class=\"spoiler\"><br>a block spoiler</span><br>[/spoiler].</p>", p("this is\n\n[spoiler]\na block spoiler\n[/spoiler]."))
assert_equal("<p><span class=\"spoiler\">this is a spoiler with no closing tag</span></p><p>new text</p>", p("[spoiler]this is a spoiler with no closing tag\n\nnew text"))
assert_equal("<p><span class=\"spoiler\">this is a spoiler with no closing tag</span><br>new text</p>", p("[spoiler]this is a spoiler with no closing tag\nnew text"))
assert_equal("<p><span class=\"spoiler\">this is </span>a nested[/spoiler] spoiler[/spoiler]</p>", p("[spoiler]this is [spoiler]a nested[/spoiler] spoiler[/spoiler]"))
end
def test_paragraphs
@@ -78,11 +79,6 @@ class DTextTest < ActiveSupport::TestCase
assert_equal('<p><a href="/posts?tags=%3C3">&lt;3</a></p>', p("{{<3}}"))
end
def test_missing_spoiler_tags
assert_equal('<div class="spoiler"><p>testing</p></div>', p('[spoiler]testing'))
assert_equal('<div class="spoiler"><div class="spoiler"><p>testing</p></div></div>', p('[spoiler][spoiler]testing[/spoiler]'))
end
def test_extra_newlines
assert_equal('<p>a</p><p>b</p>', p("a\n\n\n\n\n\n\nb\n\n\n\n"))
end