-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathif.html
170 lines (153 loc) · 4.06 KB
/
if.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Expression tests</title>
<link rel="stylesheet" href="https://get.mavo.io/mavo.css" />
<link rel="stylesheet" href="style.css" />
<script src="https://get.mavo.io/mavo.js"></script>
<script src="mavotest.js"></script>
</head>
<body>
<h1>mv-if tests</h1>
<section mv-app id="mvIf">
<h1>mv-if</h1>
<table class="reftest">
<tr>
<td>A<span mv-if="false">B</span>C</td>
<td>AC</td>
</tr>
<tr>
<td>A<span mv-if="true">B</span>C</td>
<td>ABC</td>
</tr>
<tr>
<td>A<span mv-if="true">B<span mv-if="true">C</span></span>D</td>
<td>ABCD</td>
</tr>
<tr>
<td>A<span mv-if="true">B<span mv-if="false">C</span></span>D</td>
<td>ABD</td>
</tr>
<tr title="Nested mv-if false > true">
<td>A<span mv-if="false">B<span mv-if="true">C</span></span>D</td>
<td>AD</td>
</tr>
<tr title="Property (prop1) in false mv-if">
<td>A<span mv-if="false"><span property="prop1">C</span></span>[prop1]</td>
<td>A</td>
</tr>
<tr title="false > true > prop2">
<td>A<span mv-if="false">B<span mv-if="true"><span property="prop2">C</span></span></span>[prop2]</td>
<td>A</td>
</t>
<tr title="Property with same name (prop3) across multiple mv-ifs, one false, one true">
<td>
<span mv-if="false">
<span property="prop3">A</span>
</span>
<span mv-if="true">
<span property="prop3">B</span>
</span>
[prop3]
</td>
<td>B B</td>
</tr>
<!-- <tr title="Expression inside hidden mv-if should be able to make it visible (currently failing)">
<td>
<span mv-if="prop4">
A
<span property="prop4">[months(prop5)]</span>
</span>
<meta property="prop5" content="[18992567]" />
</td>
<td>
A 7
</td>
</tr> -->
</table>
</section>
<section>
<h1>mv-if on Collection</h1>
<p>Currently failing, see <a href="https://github.com/mavoweb/mavo/issues/332">#332</a></p>
<table class="reftest" style="height: 10em; /* Prevent flickering */">
<tr title="Filtering a collection" class="ignore">
<td mv-expressions="{{ }}" mv-app="app" mv-storage='data:application/json,{
"task": [
{
"taskTitle": "Buy Milk",
"done": true
},
{
"taskTitle": "Finish thesis",
"done": false
}
]
}'>
<input type="checkbox" mv-storage="none" property="filter" checked>
<div property="task" mv-multiple mv-if="!filter or (filter and !done)">
<input class="toggle" type="checkbox" property="done">
<label property="taskTitle"></label>
</div>
</td>
<td>
Finish thesis
</td>
</tr>
</table>
</section>
<section mv-app id="ifteraction">
<h1>mv-if Interactive tests</h1>
<p>Check the checkbox. The displayed value next to it should go from "1 1 1" to "2 4 6 3 5 7"</p>
<table class="reftest">
<tr>
<td>
<input property="test" type="checkbox" data-click="wait 1s">
<span mv-if="test" class="if1">
<span property="nested1">2</span>
<span mv-if="true" class="if2">
<span property="nested2">4</span>
<span mv-if="true" class="if3">
<span property="nested3">6</span>
</span>
</span>
</span>
[nested1 + 1] [nested2 + 1] [nested3 + 1]
</td>
<td><input type="checkbox" checked> 2 4 6 3 5 7</td>
</tr>
<tr>
<td>
<span mv-if="test" class="if1">
<span property="nested4">2</span>
<span mv-if="test" class="if2">
<span property="nested5">4</span>
<span mv-if="test" class="if3">
<span property="nested6">6</span>
</span>
</span>
</span>
[nested4 + 1] [nested5 + 1] [nested6 + 1]
</td>
<td>2 4 6 3 5 7</td>
</tr>
</table>
</section>
<script type="application/json" id="numbers">{
"numbers": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
}</script>
<section mv-app="mvifnumbers" mv-storage="#numbers">
<h1>mv-if on collection of primitives</h1>
<table class="reftest">
<tr>
<td>
<div property="numbers" mv-multiple mv-if="$index mod 2 = 0"></div>
</td>
<td>
<div>1</div><div>3</div><div>5</div><div>7</div><div>9</div>
</td>
</tr>
</table>
</section>
</body>
</html>