CommentParser: Add test case for already-linked timestamp

Follow-up to 8069585489.

Bug: T356142
Change-Id: Iae9e165f00cc8bfedeb057f113e1c8c5ba7e3bf1
This commit is contained in:
Ed Sanders 2024-01-30 11:01:02 +00:00 committed by Bartosz Dziewoński
parent 6cd913cdc1
commit 9590a7297d
3 changed files with 75 additions and 0 deletions

View file

@ -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",

View 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__{&quot;headingLevel&quot;:2,&quot;name&quot;:&quot;h-Alice-20240130095300&quot;,&quot;type&quot;:&quot;heading&quot;,&quot;level&quot;:0,&quot;id&quot;:&quot;h-Hello-20240130095300&quot;,&quot;replies&quot;:[&quot;c-Alice-20240130095300-Hello&quot;],&quot;text&quot;:&quot;Hello&quot;,&quot;linkableTitle&quot;:&quot;Hello&quot;}-->
<h2>
<!--__DTSUBSCRIBELINK__{&quot;headingLevel&quot;:2,&quot;name&quot;:&quot;h-Alice-20240130095300&quot;,&quot;type&quot;:&quot;heading&quot;,&quot;level&quot;:0,&quot;id&quot;:&quot;h-Hello-20240130095300&quot;,&quot;replies&quot;:[&quot;c-Alice-20240130095300-Hello&quot;],&quot;text&quot;:&quot;Hello&quot;,&quot;linkableTitle&quot;:&quot;Hello&quot;}--><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&amp;action=edit&amp;section=1" title="Edit section&#039;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__{&quot;headingLevel&quot;:2,&quot;name&quot;:&quot;h-Alice-20240130095300&quot;,&quot;type&quot;:&quot;heading&quot;,&quot;level&quot;:0,&quot;id&quot;:&quot;h-Hello-20240130095300&quot;,&quot;replies&quot;:[&quot;c-Alice-20240130095300-Hello&quot;],&quot;text&quot;:&quot;Hello&quot;,&quot;linkableTitle&quot;:&quot;Hello&quot;}-->
</div>
</div>
</div>
<p>
<span data-mw-comment-start="" id="c-Alice-20240130095300-Hello"></span>Test. <a href="/w/index.php?title=User:Alice&amp;action=edit&amp;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>

View 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": []
}
]