Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4146947
footerLink.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
footerLink.test.js
View Options
import
footerLink
from
'../../../src/changeListeners/footerLink'
;
// Since footerLink manipulates the DOM, this test is, by necessity, an
// integration test.
QUnit
.
module
(
'ext.popups/changeListeners/footerLink @integration'
,
{
beforeEach
()
{
const
boundActions
=
{};
// Stub internal usage of mw.message
mw
.
message
=
(
str
)
=>
(
{
text
()
{
return
str
;
}
}
);
boundActions
.
showSettings
=
this
.
showSettingsSpy
=
this
.
sandbox
.
spy
();
this
.
$footer
=
$
(
'<ul>'
)
.
attr
(
'id'
,
'footer-places'
)
.
appendTo
(
document
.
body
);
this
.
footerLinkChangeListener
=
footerLink
(
boundActions
);
// A helper method, which should make the following tests more easily
// readable.
this
.
whenLinkPreviewsBoots
=
function
()
{
const
newState
=
{
settings
:
{
shouldShowFooterLink
:
true
}
};
this
.
footerLinkChangeListener
(
undefined
,
newState
);
};
this
.
getLink
=
()
=>
this
.
$footer
.
find
(
'li:last-child'
);
},
afterEach
()
{
this
.
$footer
.
remove
();
}
}
);
QUnit
.
test
(
'it should append the link to the footer menu'
,
function
(
assert
)
{
this
.
whenLinkPreviewsBoots
();
const
$link
=
this
.
getLink
();
assert
.
strictEqual
(
$link
.
length
,
1
,
'The link is singular.'
);
assert
.
strictEqual
(
$link
.
css
(
'display'
),
'list-item'
,
'Creating the link and showing/hiding it aren\'t exclusive.'
);
}
);
QUnit
.
test
(
'it should show and hide the link'
,
function
(
assert
)
{
this
.
whenLinkPreviewsBoots
();
const
$link
=
this
.
getLink
();
assert
.
strictEqual
(
$link
.
css
(
'display'
),
'list-item'
,
'Link is visible'
);
const
oldState
=
{
settings
:
{
shouldShowFooterLink
:
true
}
},
newState
=
{
settings
:
{
shouldShowFooterLink
:
false
}
};
this
.
footerLinkChangeListener
(
oldState
,
newState
);
assert
.
strictEqual
(
$link
.
css
(
'display'
),
'none'
,
'Link is NOT visible'
);
}
);
QUnit
.
test
(
'it should call the showSettings bound action creator'
,
function
(
assert
)
{
this
.
whenLinkPreviewsBoots
();
const
$link
=
this
.
getLink
();
$link
.
trigger
(
'click'
);
assert
.
true
(
this
.
showSettingsSpy
.
called
,
'Show settings is called.'
);
}
);
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Aug 19 2026, 18:12 (5 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
3b/46/56515bacf98f44f6dae14e4378bc
Default Alt Text
footerLink.test.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment