Updated tests

This commit is contained in:
Patrick Steele-Idem 2017-02-21 17:16:53 -07:00
parent 0eb586f82e
commit bc384549f6
100 changed files with 100 additions and 64 deletions

View File

@ -1,3 +1,3 @@
<div class="a">
Hello ${state.name}
<div class="b">
Hello ${data.name}
</div>

View File

@ -1,3 +1,3 @@
<div class="a">
Hello ${data.name}
<div class="b">
Hello ${state.name}
</div>

View File

@ -0,0 +1 @@
Hello Frank! Hello John!

View File

@ -0,0 +1,7 @@
<script template-helpers>
function greeting(name, out) {
out.write('Hello ' + name + '!');
}
</script>
<invoke greeting('Frank', out)/> <invoke greeting('John', out)/>

View File

@ -0,0 +1 @@
FRANK 3650 []

View File

@ -0,0 +1,3 @@
<var name='Frank' age=10 foo/>
-- ${name.toUpperCase()} ${age*365} [${foo}]

View File

@ -0,0 +1 @@
exports.templateData = {};

View File

@ -0,0 +1 @@
exports.templateData = {};

View File

@ -1,3 +1,4 @@
<var empty=""/>
$ var empty="";
<img alt="">
<img alt=empty>

View File

@ -1,4 +1,4 @@
var foo = {
$ var foo = {
name: 'Frank',
toString: function() {
return this.name;

View File

@ -1,2 +1,3 @@
var attrs={name: 'Frank'}
$ var attrs={name: 'Frank'};
<test-hello ${attrs} adult=true/>

View File

@ -1,2 +1,3 @@
var attrs={name: 'Frank', adult: true}
$ var attrs={name: 'Frank', adult: true};
<test-hello ${attrs}/>

View File

@ -1,6 +1,6 @@
<div class="hello">
<h1>test-hello</h1>
<div class="body">
<invoke input.renderBody(out) />
$ input.renderBody(out);
</div>
</div>

View File

@ -1,4 +1,4 @@
<var dynamic='<Frank>'/>
$ var dynamic='<Frank>';
<ul>
<li>

View File

@ -1,7 +1,7 @@
<script template-helpers>
var array1 = ['a', 'b', 'c'];
var array2 = ['red', 'green', 'blue'];
</script>
static {
var array1 = ['a', 'b', 'c'];
var array2 = ['red', 'green', 'blue'];
}
<var i item>
<for(i=0; i<array1.length; i++)>

View File

@ -1,7 +1,7 @@
<script template-helpers>
var notEmpty = require('marko/helpers/notEmpty');
var empty = require('marko/helpers/empty');
</script>
static {
var notEmpty = require('marko/helpers/notEmpty');
var empty = require('marko/helpers/empty');
}
<div if(notEmpty(['a', 'b', 'c']))>
notEmpty-YES

View File

@ -3,7 +3,7 @@
Hello ${input.name}! You have ${input.count} new messages.
</h1>
<p if(input.renderBody)>
<invoke input.renderBody(out)/>
$ input.renderBody(out);
</p>
<p else>
No body!

View File

@ -3,6 +3,6 @@
Hello ${input.name}! You have ${input.count} new messages.
</h1>
<p>
<invoke input.renderBody(out)/>
$ input.renderBody(out);
</p>
</div>

View File

@ -1 +1 @@
Hello Frank! Hello John!
Hello Frank!Hello John!

View File

@ -1,7 +1,7 @@
<script template-helpers>
function greeting(name, out) {
static function greeting(name, out) {
out.write('Hello ' + name + '!');
}
</script>
<invoke greeting('Frank', out)/> <invoke greeting('John', out)/>
$ greeting('Frank', out);
$ greeting('John', out);

View File

@ -1,8 +1,7 @@
---
<script template-helpers>
static {
var testHelpers = require('./test-helpers')
</script>
}
---
Hello ${testHelpers.upperCase("world")}!
Hello ${testHelpers.trim(" World ")}!
---

View File

@ -1,4 +1,4 @@
var basePath='/abc';
$ var basePath='/abc';
<script type="application/json">
${JSON.stringify({

View File

@ -1,4 +1,5 @@
<var a=4/>
$ var a=4;
---
<% a=10 %>
${a}

View File

@ -1,6 +1,8 @@
<var rootClass=input.rootClass
colors=input.colors
message=input.message />
$ {
var rootClass=input.rootClass,
colors=input.colors,
message=input.message;
}
<div class="hello-world ${rootClass}">
${message}

View File

@ -1,2 +1,3 @@
var a = 1, b = 1 + 1, c = 4 - 1, d = 'a' instanceof Boolean, e = 5 * 5 + 5 - 2 / 2, f = typeof 'foo' === 'string';
<div>${a},${b},${c},${d},${e},${f}</div>

View File

@ -1,2 +1,3 @@
<var name=input.name count=input.count/>
$ var name=input.name, count=input.count;
-- ${name != null ? "Hello ${name.toUpperCase()}! You have ${count} new messages." : null}

View File

@ -1,4 +1,4 @@
<var tabs=input.tabs/>
$ var tabs=input.tabs;
<div class="tabs">
<ul>
@ -8,7 +8,11 @@
</ul>
<div class="tab-content">
<div class="tab" for(tab in tabs)>
<invoke tab.renderBody(out) if(tab.renderBody)/>
$ {
if(tab.renderBody) {
tab.renderBody(out);
}
}
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
var pageTitle="Marko Templating Engine"
var currentPage='home'
$ var pageTitle="Marko Templating Engine"
$ var currentPage='home'
<!DOCTYPE html>
html lang="en"

View File

@ -1,4 +1,4 @@
<var tabs=input.tabs/>
$ var tabs=input.tabs;
<div class="tabs">
<ul>
@ -8,7 +8,11 @@
</ul>
<div class="tab-content">
<div class="tab" for(tab in tabs)>
<invoke tab.renderBody(out) if(tab.renderBody)/>
$ {
if (tab.renderBody) {
tab.renderBody(out);
}
}
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<var pageTitle="Marko Templating Engine"/>
<var currentPage='home'/>
$ var pageTitle="Marko Templating Engine";
$ var currentPage='home';
<!DOCTYPE html>
html lang="en"

View File

@ -1,4 +1,4 @@
<var tabs=input.tabs/>
$ var tabs=input.tabs;
<div class="tabs">
<ul>
@ -8,7 +8,11 @@
</ul>
<div class="tab-content">
<div class="tab" for(tab in tabs)>
<invoke tab.renderBody(out) if(tab.renderBody)/>
$ {
if(tab.renderBody) {
tab.renderBody(out) ;
}
}
</div>
</div>
</div>

View File

@ -1,5 +1,5 @@
<var pageTitle="Marko Templating Engine"/>
<var currentPage='home'/>
$ var pageTitle="Marko Templating Engine";
$ var currentPage='home';
<!DOCTYPE html>
<html lang="en">

View File

@ -1,4 +1,4 @@
<var tabs=input.tabs/>
$ var tabs=input.tabs;
<div class="tabs">
<ul class="nav nav-tabs">
@ -10,7 +10,11 @@
</ul>
<div class="tab-content">
<div id=tab.id class=tab.divClass for(tab in tabs)>
<invoke tab.renderBody(out) if(tab.renderBody) />
$ {
if(tab.renderBody) {
tab.renderBody(out);
}
}
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
<var showConditionalTab=input.showConditionalTab/>
$ var showConditionalTab=input.showConditionalTab;
<test-tabs-new>
<test-tab-new title="Tab 1">

View File

@ -1,4 +1,4 @@
<var tabs=input.tabs/>
$ var tabs=input.tabs;
<div class="tabs">
<ul class="nav nav-tabs">
@ -10,7 +10,7 @@
</ul>
<div class="tab-content">
<div id=tab.id class=tab.divClass for(tab in tabs)>
<invoke tab.renderBody(out) />
$ tab.renderBody(out);
</div>
</div>
</div>

View File

@ -1,4 +1,4 @@
<var showConditionalTab=input.showConditionalTab/>
$ var showConditionalTab=input.showConditionalTab;
<test-tabs>
<test-tab title="Tab 1">

View File

@ -1 +1 @@
Hello John. You are from San Jose, CA Zero: 0
Hello John. You are from San Jose, CA Zero: 0

View File

@ -1,5 +1,4 @@
$ var person=input.person;
---
<var person=input.person/>
Hello ${person.name}. You are from ${person.address.city}, ${person.address.state} Zero: ${input.zero}
---

View File

@ -1,4 +1,4 @@
var foo = {
$ var foo = {
toString: function() {
return 'bar';
}

View File

@ -1,11 +1,11 @@
<var colors=['red', 'green', 'blue']/>
$ var colors=['red', 'green', 'blue']
<div for(color in colors)>
${color}
</div>
<assign colors=['orange', 'purple', 'yellow']/>
$ colors=['orange', 'purple', 'yellow'];
<div for(color in colors)>
${color}

View File

@ -1,3 +1,3 @@
var date = new Date('Sat Jan 01 2000 00:00:00 GMT+0000 (UTC)');
$ var date = new Date('Sat Jan 01 2000 00:00:00 GMT+0000 (UTC)');
<div>${date.toISOString()}</div>

View File

@ -1,2 +1,2 @@
var a = 1, b = 2;
$ var a = 1, b = 2;
<div>${a},${b}</div>

View File

@ -1,3 +1,3 @@
<var name='Frank' age=10 foo/>
$ var name='Frank', age=10, foo;
-- ${name.toUpperCase()} ${age*365} [${foo}]

View File

@ -1,3 +1,3 @@
var n=0
$ var n=0
ul
li while(n < 4) -- ${n++}

View File

@ -1,4 +1,4 @@
var n=0
$ var n=0
ul
while(n < 4)
li -- ${n++}