Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4126030
tables.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
tables.test.js
View Options
const
tables
=
require
(
'../../../resources/skins.vector.js/tables.js'
).
init
;
describe
(
'tables'
,
()
=>
{
test
(
'wraps table with div'
,
()
=>
{
document
.
body
.
innerHTML
=
`
<div class="mw-parser-output">
<table class="wikitable">
<tbody><tr><th>table table table</th></tr></tbody>
</table>
</div>
`
;
tables
();
expect
(
document
.
body
.
innerHTML
).
toMatchSnapshot
();
}
);
test
(
'wraps multiple table with div'
,
()
=>
{
document
.
body
.
innerHTML
=
`
<div class="mw-parser-output">
<table class="wikitable">
<tbody><tr><th>table table table</th></tr></tbody>
</table>
<table class="wikitable">
<table class="wikitable">
<tbody><tr><th>table table table</th></tr></tbody>
</table>
<table class="wikitable">
<tbody><tr><th>table table table</th></tr></tbody>
</table>
</div>
`
;
tables
();
expect
(
document
.
body
.
innerHTML
).
toMatchSnapshot
();
}
);
test
(
'doesnt wrap nested tables'
,
()
=>
{
document
.
body
.
innerHTML
=
`
<div class="mw-parser-output">
<table class="wikitable">
<tbody>
<tr><th>table table table</th></tr>
<tr><td><table class="wikitable"><tbody><tr><th>table table table</th></tr></tbody></table><td></tr>
</tbody>
</table>
</div>
`
;
tables
();
expect
(
document
.
body
.
innerHTML
).
toMatchSnapshot
();
}
);
test
(
'doesnt wrap tables that are not wikitables'
,
()
=>
{
document
.
body
.
innerHTML
=
`
<div class="mw-parser-output">
<table>
<tbody>
<tr><th>table table table</th></tr>
<tr><td><table><tbody><tr><th>table table table</th></tr></tbody></table><td></tr>
</tbody>
</table>
<div>
`
;
tables
();
expect
(
document
.
body
.
innerHTML
).
toMatchSnapshot
();
}
);
test
(
'doesnt wrap tables that already have noresize'
,
()
=>
{
document
.
body
.
innerHTML
=
`
<div class="mw-parser-output">
<div class="noresize">
<table class="wikitable">
<tbody>
<tr><th>table table table</th></tr>
</tbody>
</table>
</div>
</div>
`
;
tables
();
expect
(
document
.
body
.
innerHTML
).
toMatchSnapshot
();
}
);
test
(
'doesnt wrap tables that are already wrapped'
,
()
=>
{
document
.
body
.
innerHTML
=
`
<div class="mw-parser-output">
<div>
<table class="wikitable">
<tbody>
<tr><th>table table table</th></tr>
</tbody>
</table>
</div>
</div>
`
;
tables
();
expect
(
document
.
body
.
innerHTML
).
toMatchSnapshot
();
}
);
test
(
'doesnt wrap floated tables'
,
()
=>
{
document
.
body
.
innerHTML
=
`
<div class="mw-parser-output">
<table class="wikitable" style="float:right">
<tbody>
<tr><th>table table table</th></tr>
</tbody>
</table>
<div>
`
;
tables
();
expect
(
document
.
body
.
innerHTML
).
toMatchSnapshot
();
}
);
}
);
File Metadata
Details
Attached
Mime Type
text/html
Expires
Wed, Aug 19, 07:51 (2 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9b/67/17e2e873db7665eeae2c4e62fd1d
Default Alt Text
tables.test.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment