1 | <!DOCTYPE html>
|
2 | <html>
|
3 | <head>
|
4 | <meta charset="utf-8">
|
5 | <title>Basic Test Suite</title>
|
6 | <script src="http://g.tbcdn.cn/kissy/k/1.3.1/seed-min.js"></script>
|
7 |
|
8 |
|
9 | <link rel="stylesheet" href="../node_modules/grunt-contrib-qunit/test/libs/qunit.css" media="screen">
|
10 | <script src="../node_modules/grunt-contrib-qunit/test/libs/qunit.js"></script>
|
11 |
|
12 | <script src="../dist/mock.js"></script>
|
13 | </head>
|
14 | <body>
|
15 | <script type="text/javascript">
|
16 | var tpl = Mock.heredoc(function(){
|
17 | /*
|
18 | {{#with data}}
|
19 | {{#if n > ../limit/5.0}}
|
20 | {{n+1.0}}
|
21 | {{/if}}
|
22 | {{/with}}
|
23 |
|
24 | {{#each comments}}
|
25 | {{author}}: {{body}}
|
26 | {{/each}}
|
27 |
|
28 | <!-- Mock
|
29 | {
|
30 | author: '@NAME',
|
31 | body: '@SENTENCE'
|
32 | }
|
33 | -->
|
34 | */
|
35 | })
|
36 |
|
37 | test('mock4xtpl', function() {
|
38 | stop()
|
39 | KISSY.use('xtemplate', function(S, XTemplate) {
|
40 | var ast = XTemplate.compiler.parse(tpl)
|
41 | var data = Mock.xtpl(ast)
|
42 | ok(data.comments.length)
|
43 | start()
|
44 | })
|
45 | })
|
46 |
|
47 | </script>
|
48 |
|
49 | <div id="qunit"></div>
|
50 | <div id="qunit-fixture"></div>
|
51 | </body>
|
52 | </html>
|