-
Notifications
You must be signed in to change notification settings - Fork 2k
/
handlebars-runtime-test.js
43 lines (41 loc) · 1.26 KB
/
handlebars-runtime-test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import * as Handlebars from 'handlebars/runtime';
import { assertEquals } from './lib/assert';
const template = Handlebars.template({
compiler: [8, '>= 4.3.0'],
main: function(container, depth0, helpers, partials, data) {
var helper,
lookupProperty =
container.lookupProperty ||
function(parent, propertyName) {
if (Object.prototype.hasOwnProperty.call(parent, propertyName)) {
return parent[propertyName];
}
return undefined;
};
return (
'Author: ' +
container.escapeExpression(
((helper =
(helper =
lookupProperty(helpers, 'author') ||
(depth0 != null ? lookupProperty(depth0, 'author') : depth0)) !=
null
? helper
: container.hooks.helperMissing),
typeof helper === 'function'
? helper.call(depth0 != null ? depth0 : container.nullContext || {}, {
name: 'author',
hash: {},
data: data,
loc: {
start: { line: 1, column: 8 },
end: { line: 1, column: 18 }
}
})
: helper)
)
);
},
useData: true
});
assertEquals(template({ author: 'Yehuda' }), 'Author: Yehuda');