Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7488595
ext.cite.highlighting.test.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ext.cite.highlighting.test.js
View Options
'use strict'
;
/* eslint-disable no-jquery/no-global-selector */
QUnit
.
module
(
'ext.cite.highlighting (Cite)'
,
{
beforeEach
:
function
()
{
const
$content
=
$
(
`
<div>
<sup id="cite_ref-foo1_2-0" class="reference">
<a href="#cite_note-foo1-2"><span>[</span>2<span>]</span></a>
</sup>
<sup id="cite_ref-foo1_2-1" class="reference">
<a href="#cite_note-foo1-2"><span>[</span>2<span>]</span></a>
</sup>
<ol class="references">
<li id="cite_note-foo1-2">^
<sup><a href="#cite_ref-foo1_2-0"><i><b>a</b></i></a></sup>
<sup><a href="#cite_ref-foo1_2-1"><i><b>b</b></i></a></sup>
<span class="reference-text">Named and reused</span>
</li>
</ol>
</div>
`
);
$
(
'#qunit-fixture'
).
append
(
$content
);
mw
.
hook
(
'wikipage.content'
).
fire
(
$
(
'#qunit-fixture'
)
);
}
}
);
QUnit
.
test
(
'highlights backlink in the reference list for the clicked reference'
,
(
assert
)
=>
{
const
$content
=
$
(
'#qunit-fixture'
);
const
$footnoteMarkerLink
=
$content
.
find
(
'#cite_ref-foo1_2-1 a'
);
const
$backlink
=
$content
.
find
(
'#cite_note-foo1-2 sup:nth-child(2) a'
);
$footnoteMarkerLink
.
trigger
(
'click'
);
assert
.
true
(
$backlink
.
hasClass
(
'mw-cite-targeted-backlink'
)
);
}
);
QUnit
.
test
(
'hides clickable up-arrow when jumping back from multiple used references '
,
(
assert
)
=>
{
const
$content
=
$
(
'#qunit-fixture'
);
const
$footnoteMarkerLink
=
$content
.
find
(
'#cite_ref-foo1_2-1 a'
);
$footnoteMarkerLink
.
trigger
(
'click'
);
const
$backlink
=
$content
.
find
(
'#cite_note-foo1-2 sup:nth-child(2) a'
);
$backlink
.
trigger
(
'click'
);
// eslint-disable-next-line no-jquery/no-sizzle
assert
.
false
(
$backlink
.
is
(
':visible'
)
);
}
);
QUnit
.
test
(
'uses the last clicked target for the clickable up arrow on multiple used references'
,
(
assert
)
=>
{
const
$content
=
$
(
'#qunit-fixture'
);
const
$footnoteMarkerLink2
=
$content
.
find
(
'#cite_ref-foo1_2-1 a'
);
const
$footnoteMarkerLink1
=
$content
.
find
(
'#cite_ref-foo1_2-0 a'
);
$footnoteMarkerLink2
.
trigger
(
'click'
);
$footnoteMarkerLink1
.
trigger
(
'click'
);
const
$backlinkToFirstMarker
=
$content
.
find
(
'li#cite_note-foo1-2 a.mw-cite-up-arrow-backlink'
);
assert
.
strictEqual
(
$backlinkToFirstMarker
.
length
,
1
);
// The backlink href points to the id of the last clicked ref marker
assert
.
strictEqual
(
$backlinkToFirstMarker
.
attr
(
'href'
),
'#cite_ref-foo1_2-0'
);
}
);
File Metadata
Details
Attached
Mime Type
text/html
Expires
Mon, Nov 23, 17:53 (1 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
73/fc/2ac9b1889738823858bc4d8dbc8b
Default Alt Text
ext.cite.highlighting.test.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment