mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Added test for templateRoot.prependChild
This commit is contained in:
parent
d28ea9ba33
commit
ee4fc809b2
24
test/fixtures/codegen/autotest/templateRoot-prependChild/expected.js
vendored
Normal file
24
test/fixtures/codegen/autotest/templateRoot-prependChild/expected.js
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
function create(__helpers) {
|
||||
var str = __helpers.s,
|
||||
empty = __helpers.e,
|
||||
notEmpty = __helpers.ne,
|
||||
escapeXml = __helpers.x;
|
||||
|
||||
return function render(data, out) {
|
||||
out.w("<ul>");
|
||||
|
||||
forEach(data.colors, function(color) {
|
||||
foo();
|
||||
|
||||
out.w("<li>" +
|
||||
escapeXml(color) +
|
||||
"</li>");
|
||||
|
||||
bar();
|
||||
});
|
||||
|
||||
out.w("</ul>");
|
||||
};
|
||||
}
|
||||
|
||||
(module.exports = require("marko").c(__filename)).c(create);
|
||||
20
test/fixtures/codegen/autotest/templateRoot-prependChild/index.js
vendored
Normal file
20
test/fixtures/codegen/autotest/templateRoot-prependChild/index.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function(builder) {
|
||||
var templateRoot = builder.templateRoot([
|
||||
builder.htmlElement(
|
||||
'div',
|
||||
[])
|
||||
]);
|
||||
|
||||
templateRoot.prependChild(builder.vars([
|
||||
{
|
||||
id: 'foo',
|
||||
init: builder.literal('bar')
|
||||
}
|
||||
]));
|
||||
|
||||
console.log(templateRoot.body.items);
|
||||
|
||||
return templateRoot;
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user