Merge "resourceloader: Simplify StringSet fallback"
[lhc/web/wiklou.git] / tests / qunit / suites / resources / mediawiki / mediawiki.template.mustache.test.js
1 ( function () {
2
3 QUnit.module( 'mediawiki.template.mustache', {
4 beforeEach: function () {
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'
9 } );
10 }
11 } );
12
13 QUnit.test( 'render', 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' );
17
18 data = {
19 foo: 'Hello'
20 };
21 partials = {
22 suffix: partial
23 };
24
25 html = template.render( data ).html();
26 htmlPartial = template.render( data, partials ).html();
27
28 assert.strictEqual( html, 'Hello', 'Render without partial' );
29 assert.strictEqual( htmlPartial, 'Hello goodbye', 'Render with partial' );
30 } );
31
32 }() );