UNPKG

881 BJavaScriptView Raw
1(function() {
2 var expect, Environment, Loader, templatesPath;
3
4 if(typeof require != 'undefined') {
5 expect = require('expect.js');
6 Environment = require('../src/environment').Environment;
7 Loader = require('../src/node-loaders').FileSystemLoader;
8 templatesPath = 'tests/templates';
9 }
10 else {
11 expect = window.expect;
12 Environment = nunjucks.Environment;
13 Loader = nunjucks.WebLoader;
14 templatesPath = '../templates';
15 }
16
17 describe('api', function() {
18 it('should always force compilation of parent template', function() {
19 var env = new Environment(new Loader(templatesPath));
20
21 var parent = env.getTemplate('base.html');
22 var child = env.getTemplate('base-inherit.html');
23 expect(child.render()).to.be('Foo*Bar*BazFizzle');
24 });
25 });
26})();