Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1430646
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
Sat, May 16, 19:21 (4 h, 12 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
0e/ee/7daa0e480940015d347a3087c4c3
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