Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2751641
mediawiki.template.mustache.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
843 B
Referenced Files
None
Subscribers
None
mediawiki.template.mustache.test.js
View Options
QUnit
.
module
(
'mediawiki.template.mustache'
,
(
hooks
)
=>
{
hooks
.
beforeEach
(
function
()
{
// Stub register some templates
this
.
sandbox
.
stub
(
mw
.
templates
,
'get'
).
returns
(
{
'test_greeting.mustache'
:
'<div>{{foo}}{{>suffix}}</div>'
,
'test_greeting_suffix.mustache'
:
' goodbye'
}
);
}
);
QUnit
.
test
(
'render'
,
(
assert
)
=>
{
const
template
=
mw
.
template
.
get
(
'stub'
,
'test_greeting.mustache'
);
const
partial
=
mw
.
template
.
get
(
'stub'
,
'test_greeting_suffix.mustache'
);
const
data
=
{
foo
:
'Hello'
};
const
partials
=
{
suffix
:
partial
};
const
html
=
template
.
render
(
data
).
html
();
assert
.
strictEqual
(
html
,
'Hello'
,
'Render without partial'
);
const
htmlPartial
=
template
.
render
(
data
,
partials
).
html
();
assert
.
strictEqual
(
htmlPartial
,
'Hello goodbye'
,
'Render with partial'
);
}
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 3, 18:56 (1 d, 10 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
aa/d7/8929d76d388780c935e23e6b7337
Default Alt Text
mediawiki.template.mustache.test.js (843 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment