mediawiki-extensions-Discus.../tests/cases/isHtmlSigned.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

38 lines
1.2 KiB
JSON

[
{
"msg": "Simple message",
"html": "<p>Foo bar</p>",
"expected": false
},
{
"msg": "Literal tildes",
"html": "<p>Foo ~~~~</p>",
"expected": false
},
{
"msg": "Signature node",
"html": "<p>Foo bar <span typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[&quot;~~~~&quot;]}\"></span></p>",
"expected": true
},
{
"msg": "Signature node with trailing whitespace",
"html": "<p>Foo bar <span typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[&quot;~~~~&quot;]}\"></span> </p>",
"expected": true
},
{
"msg": "Signature node (with some junk from switching)",
"html": "<p>Foo bar <span typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[&quot;~~~~&quot;]}\" data-dtsignatureforswitching=\"1\" data-parsoid=\"{&quot;stx&quot;:&quot;html&quot;,&quot;dsr&quot;:[9,55,39,7]}\"></span></p>",
"expected": true
},
{
"msg": "Signature node (not at the end)",
"html": "<p>(Foo bar <span typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[&quot;~~~~&quot;]}\"></span>)</p>",
"expected": false
},
{
"msg": "Signature node (not at the end, multiline)",
"html": "<p>Foo bar <span typeof=\"mw:Transclusion\" data-mw=\"{&quot;parts&quot;:[&quot;~~~~&quot;]}\"></span></p><p>Baz</p>",
"expected": false
}
]