mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-27 09:43:30 +00:00
CommentParser: Add test case for already-linked timestamp
Follow-up to 8069585489
.
Bug: T356142
Change-Id: Iae9e165f00cc8bfedeb057f113e1c8c5ba7e3bf1
This commit is contained in:
parent
6cd913cdc1
commit
9590a7297d
|
@ -255,6 +255,14 @@
|
|||
"config": "../data/enwiki-config.json",
|
||||
"data": "../data/enwiki-data.json"
|
||||
},
|
||||
{
|
||||
"name": "Timestamp links",
|
||||
"title": "User_talk:Ed",
|
||||
"dom": "cases/timestamplink/timestamplink.html",
|
||||
"expected": "../cases/timestamplink/timestamplink.json",
|
||||
"config": "../data/enwiki-config.json",
|
||||
"data": "../data/enwiki-data.json"
|
||||
},
|
||||
{
|
||||
"name": "Signatures with Special:Contributions (alias with underscored)",
|
||||
"title": "Talk:Signatures Alias",
|
||||
|
|
24
tests/cases/timestamplink/timestamplink.html
Normal file
24
tests/cases/timestamplink/timestamplink.html
Normal file
|
@ -0,0 +1,24 @@
|
|||
<div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
|
||||
<div class="mw-heading mw-heading2 ext-discussiontools-init-section">
|
||||
<!--__DTSUBSCRIBEBUTTONDESKTOP__{"headingLevel":2,"name":"h-Alice-20240130095300","type":"heading","level":0,"id":"h-Hello-20240130095300","replies":["c-Alice-20240130095300-Hello"],"text":"Hello","linkableTitle":"Hello"}-->
|
||||
<h2>
|
||||
<!--__DTSUBSCRIBELINK__{"headingLevel":2,"name":"h-Alice-20240130095300","type":"heading","level":0,"id":"h-Hello-20240130095300","replies":["c-Alice-20240130095300-Hello"],"text":"Hello","linkableTitle":"Hello"}--><span class="mw-headline" id="Hello" data-mw-thread-id="h-Hello-20240130095300"><span data-mw-comment-start="" id="h-Hello-20240130095300"></span>Hello<span data-mw-comment-end="h-Hello-20240130095300"></span></span><span class="mw-editsection"><span class="mw-editsection-bracket">[</span><a href="/w/index.php?title=User_talk:Ed&action=edit&section=1" title="Edit section's source code: Hello"><span>edit source</span></a><span class="mw-editsection-bracket">]</span></span>
|
||||
</h2>
|
||||
<!--__DTELLIPSISBUTTON__{"threadItem":{"headingLevel":2,"name":"h-Alice-20240130095300","type":"heading","level":0,"id":"h-Hello-20240130095300","replies":["c-Alice-20240130095300-Hello"]}}-->
|
||||
<div class="ext-discussiontools-init-section-bar">
|
||||
<div class="ext-discussiontools-init-section-metadata">
|
||||
<!--__DTLATESTCOMMENTTHREAD__{"id":"c-Alice-20240130095300-Hello","timestamp":"20240130095300"}__--><!--__DTCOMMENTCOUNT__1__--><!--__DTAUTHORCOUNT__1__-->
|
||||
</div>
|
||||
<div class="ext-discussiontools-init-section-actions">
|
||||
<!--__DTSUBSCRIBEBUTTONMOBILE__{"headingLevel":2,"name":"h-Alice-20240130095300","type":"heading","level":0,"id":"h-Hello-20240130095300","replies":["c-Alice-20240130095300-Hello"],"text":"Hello","linkableTitle":"Hello"}-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p>
|
||||
<span data-mw-comment-start="" id="c-Alice-20240130095300-Hello"></span>Test. <a href="/w/index.php?title=User:Alice&action=edit&redlink=1" class="new" title="User:Alice (page does not exist)">Alice</a> (<a href="/w/index.php/User_talk:Alice" title="User talk:Alice">talk</a>) <a href="/wiki/User_talk:Ed#c-Alice-20240130095300-Hello" class="ext-discussiontools-init-timestamplink">09:53, 30 January 2024 (UTC)</a>
|
||||
<span class="ext-discussiontools-init-replylink-buttons" data-mw-thread-id="c-Alice-20240130095300-Hello">
|
||||
<!--__DTREPLYBUTTONSCONTENT__--><!--__DTELLIPSISBUTTON__{"threadItem":{"timestamp":"20240130095300","author":"Alice","type":"comment","level":1,"id":"c-Alice-20240130095300-Hello","replies":[]}}-->
|
||||
</span>
|
||||
<span data-mw-comment-end="c-Alice-20240130095300-Hello"></span>
|
||||
</p>
|
||||
</div>
|
43
tests/cases/timestamplink/timestamplink.json
Normal file
43
tests/cases/timestamplink/timestamplink.json
Normal file
|
@ -0,0 +1,43 @@
|
|||
[
|
||||
{
|
||||
"headingLevel": 2,
|
||||
"id": "h-Hello-20240130095300",
|
||||
"level": 0,
|
||||
"name": "h-Alice-20240130095300",
|
||||
"placeholderHeading": false,
|
||||
"range": [
|
||||
"1/3/2/0",
|
||||
"1/3/2/3"
|
||||
],
|
||||
"replies": [
|
||||
{
|
||||
"author": "Alice",
|
||||
"id": "c-Alice-20240130095300-Hello",
|
||||
"level": 1,
|
||||
"name": "c-Alice-20240130095300",
|
||||
"range": [
|
||||
"3/2",
|
||||
"3/12/0"
|
||||
],
|
||||
"replies": [],
|
||||
"signatureRanges": [
|
||||
[
|
||||
"3/3",
|
||||
"3/8"
|
||||
]
|
||||
],
|
||||
"timestamp": "20240130095300",
|
||||
"timestampRanges": [
|
||||
[
|
||||
"3/7/0/0",
|
||||
"3/7/0/28"
|
||||
]
|
||||
],
|
||||
"type": "comment",
|
||||
"warnings": []
|
||||
}
|
||||
],
|
||||
"type": "heading",
|
||||
"warnings": []
|
||||
}
|
||||
]
|
Loading…
Reference in a new issue