1 | <!DOCTYPE html>
|
2 | <html>
|
3 | <head>
|
4 | <meta charset="utf-8">
|
5 | <title>Basic Test Suite</title>
|
6 |
|
7 | <link rel="stylesheet" href="../node_modules/grunt-contrib-qunit/test/libs/qunit.css" media="screen">
|
8 | <script src="../node_modules/grunt-contrib-qunit/test/libs/qunit.js"></script>
|
9 |
|
10 | <script src="../dist/mock.js"></script>
|
11 | <script src="../node_modules/handlebars/dist/handlebars.js"></script>
|
12 | </head>
|
13 | <body>
|
14 | <script type="text/javascript">
|
15 | var tpl = Mock.heredoc(function() {
|
16 | /*
|
17 | <div bx-tmpl="list" bx-datakey="list">
|
18 | <table class="table" bx-name="tables" bx-path="brix/gallery/tables/" id="tables">
|
19 | <thead>
|
20 | <tr>
|
21 | <th></th>
|
22 | <th>访问来源</th>
|
23 | <th width="200px">UV占比</th>
|
24 | <th>UV</th>
|
25 | <th>PV</th>
|
26 | <th>人均页面访问数</th>
|
27 | <th>宝贝收藏数</th>
|
28 | <th>收藏率</th>
|
29 | <th>成交金额</th>
|
30 | <th>转化率</th>
|
31 | <th>操作</th>
|
32 | </tr>
|
33 | </thead>
|
34 | <tbody>
|
35 | {{#each list}}
|
36 | <tr class="tr-parent bold">
|
37 | <td><i mx-click="toggle" class="J_expendCollapse icon-expend"></i></td>
|
38 | <td>{{id}} {{分组}}</td>
|
39 | <td>
|
40 | <span class="process-parent" style="width: {{UV占比}}px;"></span>
|
41 | {{UV占比}}%
|
42 | </td>
|
43 | <td>{{UV}}</td>
|
44 | <td>{{PV}}</td>
|
45 | <td>{{人均页面访问数}}</td>
|
46 | <td>{{宝贝收藏数}}</td>
|
47 | <td>{{收藏率}}</td>
|
48 | <td>{{成交金额}}</td>
|
49 | <td>{{转化率}}</td>
|
50 | <td>
|
51 | </td>
|
52 | </tr>
|
53 | {{#each children}}
|
54 | <tr class="tr-child">
|
55 | <td></td>
|
56 | <td>{{渠道}}</td>
|
57 | <td>
|
58 | <span class="process-child" style="width: {{UV占比}}px;"></span>
|
59 | {{UV占比}}%
|
60 | </td>
|
61 | <td>{{UV}}</td>
|
62 | <td>{{PV}}</td>
|
63 | <td>{{人均页面访问数}}</td>
|
64 | <td>{{宝贝收藏数}}</td>
|
65 | <td>{{收藏率}}</td>
|
66 | <td>{{成交金额}}</td>
|
67 | <td>{{转化率}}</td>
|
68 | <td>
|
69 | <div class="operation">
|
70 | <a href="javascript:" mx-click="perspective{ srcIdLevel1:{{srcIdLevel1}},srcIdLevel2:{{srcIdLevel2}},channel:{{渠道}},vs:{{vs}} }" class="mr10">透视分析</a>
|
71 | </div>
|
72 | </td>
|
73 | </tr>
|
74 | {{/each}}
|
75 | {{/each}}
|
76 | </tbody>
|
77 | </table>
|
78 | </div>
|
79 | <!-- Mock {
|
80 | 'id|+1': 1,
|
81 | 'list|1-5': [],
|
82 | 'children|1-5': [],
|
83 | '分组|1': '@AREA',
|
84 | '渠道|1': '@REGION',
|
85 | 'percent|1-100': 1,
|
86 | 'UV占比|1-100': 1,
|
87 | 'UV|1-100000000': 1,
|
88 | 'PV|1-100000000': 1,
|
89 | '人均页面访问数|1-100000000': 1,
|
90 | '宝贝收藏数|1-100000000': 1,
|
91 | '收藏率': '@percent%',
|
92 | '成交金额|1-100000000.2': 1.0,
|
93 | '转化率': '@INTEGER(1,100)%',
|
94 | 'srcIdLevel1|1-10': 1,
|
95 | 'srcIdLevel2|1-10': 1,
|
96 | 'vs': '@渠道'
|
97 | }
|
98 | -->
|
99 | */
|
100 | })
|
101 | test('mock4tpl', function() {
|
102 | var data = Mock.tpl(tpl);
|
103 | ok(data.list.length)
|
104 | })
|
105 | </script>
|
106 |
|
107 | <div id="qunit"></div>
|
108 | <div id="qunit-fixture"></div
|
109 | </body>
|
110 | </html>
|