mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-08 14:35:52 +01:00
add tests, failing right now
This commit is contained in:
@@ -32,7 +32,28 @@ class HelpersSpec extends Specification {
|
||||
after mustEqual """Example Project. <a href="http://example.com">http://example.com</a>. (See also <a href="https://github.com/">https://github.com/</a>)"""
|
||||
}
|
||||
|
||||
"properly escape html metacharacters" in {
|
||||
val before = "<>&"
|
||||
val after = detectAndRenderLinks(before).toString()
|
||||
after mustEqual """<>&"""
|
||||
}
|
||||
|
||||
"escape html metacharacters adjacent to a link" in {
|
||||
val before = "<http://example.com>"
|
||||
val after = detectAndRenderLinks(before).toString()
|
||||
after mustEqual """<<a href="http://example.com">http://example.com</a>>"""
|
||||
}
|
||||
|
||||
"stop link recognition at a metacharacter" in {
|
||||
val before = "http://exa<mple.com"
|
||||
val after = detectAndRenderLinks(before).toString()
|
||||
after mustEqual """<a href="http://exa">http://exa</a><mple.com"""
|
||||
}
|
||||
|
||||
"make sure there are no double quotes in the href attribute" in {
|
||||
val before = "http://exa\"mple.com"
|
||||
val after = detectAndRenderLinks(before).toString()
|
||||
after mustEqual """<a href="http://exa"mple.com">http://exa"mple.com</a>"""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user