mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Marko v3: Moved over some of the pending compiler tests
This commit is contained in:
parent
512074790f
commit
8a184dea2f
@ -1 +0,0 @@
|
||||
TBD
|
||||
@ -1,2 +0,0 @@
|
||||
<app-hello-world({name: 'Frank', age: 32})/>
|
||||
<app-hello-world name=("Frank".toUpperCase()) age=32/>
|
||||
@ -1 +0,0 @@
|
||||
TBD
|
||||
@ -1,7 +0,0 @@
|
||||
<module-imports>
|
||||
reverse from "./helpers";
|
||||
foo from "./foo";
|
||||
</module-imports>
|
||||
|
||||
Hello ${reverse('Frank')}
|
||||
|
||||
@ -1 +0,0 @@
|
||||
TBD
|
||||
1
test/fixtures/compiler/autotest/custom-tag-data/custom-tag-data-tag.js
vendored
Normal file
1
test/fixtures/compiler/autotest/custom-tag-data/custom-tag-data-tag.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
module.exports = function(input, out) {};
|
||||
30
test/fixtures/compiler/autotest/custom-tag-data/expected.js
vendored
Normal file
30
test/fixtures/compiler/autotest/custom-tag-data/expected.js
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
function create(__helpers) {
|
||||
var str = __helpers.s,
|
||||
empty = __helpers.e,
|
||||
notEmpty = __helpers.ne,
|
||||
escapeXml = __helpers.x,
|
||||
__loadTag = __helpers.t,
|
||||
custom_tag_data = __loadTag(require("./custom-tag-data-tag")),
|
||||
__merge = __helpers.m;
|
||||
|
||||
return function render(data, out) {
|
||||
custom_tag_data({
|
||||
name: "Frank",
|
||||
age: 32
|
||||
}, out);
|
||||
|
||||
custom_tag_data({
|
||||
name: "Frank".toUpperCase(),
|
||||
age: 32
|
||||
}, out);
|
||||
|
||||
custom_tag_data(__merge({
|
||||
age: 10
|
||||
}, {
|
||||
name: "Frank",
|
||||
age: 32
|
||||
}), out);
|
||||
};
|
||||
}
|
||||
|
||||
(module.exports = require("marko").c(__filename)).c(create);
|
||||
7
test/fixtures/compiler/autotest/custom-tag-data/marko-taglib.json
vendored
Normal file
7
test/fixtures/compiler/autotest/custom-tag-data/marko-taglib.json
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"<custom-tag-data>": {
|
||||
"renderer": "./custom-tag-data-tag.js",
|
||||
"@name": "string",
|
||||
"@age": "integer"
|
||||
}
|
||||
}
|
||||
3
test/fixtures/compiler/autotest/custom-tag-data/template.marko
vendored
Normal file
3
test/fixtures/compiler/autotest/custom-tag-data/template.marko
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
<custom-tag-data({name: 'Frank', age: 32})/>
|
||||
<custom-tag-data name=("Frank".toUpperCase()) age=32/>
|
||||
<custom-tag-data({name: 'Frank', age: 32}) age=10/>
|
||||
33
test/fixtures/compiler/autotest/macros/expected.js
vendored
Normal file
33
test/fixtures/compiler/autotest/macros/expected.js
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
function create(__helpers) {
|
||||
var str = __helpers.s,
|
||||
empty = __helpers.e,
|
||||
notEmpty = __helpers.ne,
|
||||
escapeXml = __helpers.x,
|
||||
forEach = __helpers.f;
|
||||
|
||||
return function render(data, out) {
|
||||
function macro_renderTree(node, out, renderBody) {
|
||||
out.w("Name: " +
|
||||
escapeXml(node.name) +
|
||||
" Children: ");
|
||||
|
||||
if (node.children) {
|
||||
out.w("<ul>");
|
||||
|
||||
forEach(node.children, function(child) {
|
||||
out.w("<li>");
|
||||
|
||||
macro_renderTree(child, out);
|
||||
|
||||
out.w("</li>");
|
||||
});
|
||||
|
||||
out.w("</ul>");
|
||||
}
|
||||
}
|
||||
|
||||
macro_renderTree(data.node, out);
|
||||
};
|
||||
}
|
||||
|
||||
(module.exports = require("marko").c(__filename)).c(create);
|
||||
@ -1,5 +1,5 @@
|
||||
<macro renderTree(node)>
|
||||
Name: ${child.name}
|
||||
Name: ${node.name}
|
||||
|
||||
Children:
|
||||
<ul if(node.children)>
|
||||
@ -9,4 +9,4 @@
|
||||
</ul>
|
||||
</macro>
|
||||
|
||||
<renderTree(data.node)>
|
||||
<renderTree(data.node)/>
|
||||
Loading…
x
Reference in New Issue
Block a user