Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4074543
init.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
init.test.js
View Options
'use strict'
;
describe
(
'SpecialBlock init.js'
,
()
=>
{
let
targetInput
,
Vue
;
beforeEach
(
()
=>
{
document
.
body
.
innerHTML
=
''
;
const
form
=
document
.
createElement
(
'form'
);
form
.
className
=
'mw-htmlform'
;
document
.
body
.
appendChild
(
form
);
targetInput
=
document
.
createElement
(
'input'
);
targetInput
.
id
=
'mw-bi-target'
;
form
.
appendChild
(
targetInput
);
mw
.
Api
.
prototype
.
loadMessagesIfMissing
=
jest
.
fn
().
mockResolvedValue
(
undefined
);
Vue
=
require
(
'vue'
);
Vue
.
createMwApp
=
jest
.
fn
().
mockReturnValue
(
{
use
:
jest
.
fn
().
mockReturnValue
(
{
mount
:
jest
.
fn
()
}
)
}
);
}
);
afterEach
(
()
=>
{
jest
.
resetModules
();
}
);
it
(
'should give the form the ID mw-block-form'
,
()
=>
{
const
mockConfig
=
{};
mw
.
config
.
set
=
(
key
,
value
)
=>
{
mockConfig
[
key
]
=
value
;
};
require
(
'../../../resources/src/mediawiki.special.block/init.js'
);
expect
(
document
.
querySelector
(
'.mw-htmlform'
).
id
).
toBe
(
'mw-block-form'
);
}
);
it
(
'should do nothing if there is no mw-htmlform'
,
()
=>
{
const
htmlForm
=
document
.
querySelector
(
'.mw-htmlform'
);
htmlForm
.
className
=
'not-mw-htmlform'
;
require
(
'../../../resources/src/mediawiki.special.block/init.js'
);
expect
(
htmlForm
.
id
).
not
.
toBe
(
'mw-block-form'
);
expect
(
mw
.
Api
.
prototype
.
loadMessagesIfMissing
).
not
.
toHaveBeenCalled
();
expect
(
Vue
.
createMwApp
).
not
.
toHaveBeenCalled
();
}
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 17 2026, 16:01 (10 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
1f/3c/9d971b4a11e91bfdf547683ba915
Default Alt Text
init.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment