mediawiki-extensions-Discus.../tests/cases/isWikitextSigned.json
Bartosz Dziewoński 80e52e1155 Improve detecting typed signatures
* Remove the existing approach for detecting signatures that only
  worked in source mode; remove autoSignWikitext()

* Use the same approach for auto-signing in source mode as we have
  already used in visual

* In both modes, detect whether the user has already typed a signature
  at the end of their comment in the modifier, and if so, don't add a
  signature

* Add test cases for the detection

Bug: T255738
Change-Id: I791d3035cb1ffc33ce3966d4617a25d08700c35b
2020-07-22 00:00:53 +02:00

53 lines
969 B
JSON

[
{
"msg": "Simple message",
"wikitext": "Foo bar",
"expected": false
},
{
"msg": "Already signed",
"wikitext": "Foo bar ~~~~",
"expected": true
},
{
"msg": "Already signed with trailing whitespace",
"wikitext": "Foo bar ~~~~ \n",
"expected": true
},
{
"msg": "Already signed (not at the end)",
"wikitext": "(Foo bar ~~~~)",
"expected": false
},
{
"msg": "Not signed, literal tildes",
"wikitext": "Hello, I'm <nowiki>~~~~</nowiki>",
"expected": false
},
{
"msg": "Already signed multi-line",
"wikitext": "Foo\n\nbar\n\n~~~~",
"expected": true
},
{
"msg": "Already signed with hyphens",
"wikitext": "Foo bar --~~~~",
"expected": true
},
{
"msg": "Already signed without space",
"wikitext": "Foo bar~~~~",
"expected": true
},
{
"msg": "Signed with 5 tildes",
"wikitext": "Foo bar ~~~~~",
"expected": false
},
{
"msg": "Signed with 3 tildes",
"wikitext": "Foo bar ~~~",
"expected": false
}
]