(refs #231)Generate anchors for headers in wiki markup

This commit is contained in:
Jeffrey Olchovy
2014-02-08 13:59:27 -05:00
parent d683dd2c38
commit 153a32e340
2 changed files with 58 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
package view
import org.specs2.mutable._
class GitBucketHtmlSerializerSpec extends Specification {
import GitBucketHtmlSerializer._
"generateAnchorName" should {
"convert whitespace characters to hyphens" in {
val before = "foo bar baz"
val after = generateAnchorName(before)
after mustEqual "foo-bar-baz"
}
"normalize characters with diacritics" in {
val before = "Dónde estará mi vida"
val after = generateAnchorName(before)
after mustEqual "donde-estara-mi-vida"
}
"omit special characters" in {
val before = "foo!bar@baz>9000"
val after = generateAnchorName(before)
after mustEqual "foobarbaz9000"
}
}
}