mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-25 00:38:33 +00:00
80e52e1155
* 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
38 lines
1.2 KiB
JSON
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=\"{"parts":["~~~~"]}\"></span></p>",
|
|
"expected": true
|
|
},
|
|
{
|
|
"msg": "Signature node with trailing whitespace",
|
|
"html": "<p>Foo bar <span typeof=\"mw:Transclusion\" data-mw=\"{"parts":["~~~~"]}\"></span> </p>",
|
|
"expected": true
|
|
},
|
|
{
|
|
"msg": "Signature node (with some junk from switching)",
|
|
"html": "<p>Foo bar <span typeof=\"mw:Transclusion\" data-mw=\"{"parts":["~~~~"]}\" data-dtsignatureforswitching=\"1\" data-parsoid=\"{"stx":"html","dsr":[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=\"{"parts":["~~~~"]}\"></span>)</p>",
|
|
"expected": false
|
|
},
|
|
{
|
|
"msg": "Signature node (not at the end, multiline)",
|
|
"html": "<p>Foo bar <span typeof=\"mw:Transclusion\" data-mw=\"{"parts":["~~~~"]}\"></span></p><p>Baz</p>",
|
|
"expected": false
|
|
}
|
|
]
|