-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
72 lines (72 loc) · 2.21 KB
/
test.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
<style>
body {
max-width: 80rem;
padding: 0 1rem;
margin: 1rem auto 0;
background-color: #000;
color: #fff;
font-family: sans-serif;
}
</style>
<h1>Hello, {{ guest }}</h1>
<p>My name: {{ name.first }} {{ name.last }}</p>
<p>This is a test {{ what.this.is }}</p>
<h2>If Tests</h2>
<ul>
<li>{{ if name }}Pass{{ end }} - simple</li>
<li>{{ if !name }}Fail{{ else }}Pass{{ end }} - negated</li>
<li>{{ if does_not_exist }}Fail{{ else }}Pass{{ end }} - null is falsy</li>
<li>{{ if "" }}Fail{{ else }}Pass{{ end }} - empty string is falsy</li>
<li>{{ if name.first == "Punit" }}Pass{{ else }}Fail{{ end }} - comparison</li>
<li>{{ if name.last == "Haaalait" }}Fail{{ else }}Pass{{ end }} - comparison false</li>
<li>{{ if name.last != "Halait" }}Fail{{ else }}Pass{{ end }} - comparison not equals</li>
<li>{{ if name.last != "Halait" }}Fail{{ else }}{{ if name.first }}Pass{{ else }}Fail{{ end }}{{ end }} - nested if</li>
<li>{{ if does_not_exist || name }}Pass{{ end }} - or</li>
<li>{{ if name && name.first == "Punit" }}Pass{{ end }} - and</li>
<li>{{ if does_not_exist || name.first == "Not Punit" }}Fail{{ else }}Pass{{ end }} - or false</li>
<li>{{ if does_not_exist && name.first == "Not Punit" }}Fail{{ else }}Pass{{ end }} - and false</li>
</ul>
<h2>For Tests</h2>
<div>
Countries:
<ul>
{{ for country in countries }}
<li>{{ country }}</li>
{{ end }}
</ul>
</div>
<div>
The languages:
<ul>
{{ for language in languages }}
<li>{{ language.name }}</li>
{{ end }}
</ul>
</div>
<div>
Nested for loop:
<ul>
{{ for language in languages }}
{{ for country in countries }}
<li>Outer: {{ language.name }} </li>
<li>Inner: {{ country }}</li>
{{ end }}
{{ end }}
</ul>
</div>
<div>
If in for:
<ul>
{{ for language in languages }}
<li>{{ if language.name == "Rust" }}Is Rust{{ else }}Is not Rust {{ end }}</li>
{{ end }}
</ul>
</div>
<div>
Nested array:
<ul>
{{ for item in nested.array }}
<li>{{ item }}</li>
{{ end }}
</ul>
</div>