mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-12 00:15:50 +01:00
(refs #231)Generate anchors for headers in wiki markup
This commit is contained in:
28
src/test/scala/view/GitBucketHtmlSerializerSpec.scala
Normal file
28
src/test/scala/view/GitBucketHtmlSerializerSpec.scala
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user