3 QUnit
.module( 'mediawiki.template.mustache', {
5 // Stub register some templates
6 this.sandbox
.stub( mw
.templates
, 'get' ).returns( {
7 'test_greeting.mustache': '<div>{{foo}}{{>suffix}}</div>',
8 'test_greeting_suffix.mustache': ' goodbye'
13 QUnit
.test( 'render', 2, function ( assert
) {
14 var html
, htmlPartial
, data
, partials
,
15 template
= mw
.template
.get( 'stub', 'test_greeting.mustache' ),
16 partial
= mw
.template
.get( 'stub', 'test_greeting_suffix.mustache' );
25 html
= template
.render( data
).html();
26 htmlPartial
= template
.render( data
, partials
).html();
28 assert
.strictEqual( html
, 'Hello', 'Render without partial' );
29 assert
.strictEqual( htmlPartial
, 'Hello goodbye', 'Render with partial' );