Skip to content

Commit a051466

Browse files
hanoiizackad
authored andcommitted
test: add a test containing common alpinejs odd attributes
1 parent d62f26b commit a051466

File tree

2 files changed

+183
-0
lines changed

2 files changed

+183
-0
lines changed

tests/Element/__snapshots__/jsfmt.spec.js.snap

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,128 @@
11
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
22

3+
exports[`alpinejs.twig - twig-verify > alpinejs.twig 1`] = `
4+
<div x-data="{ open: false }">
5+
...
6+
</div>
7+
8+
<div x-bind:class="! open ? 'hidden' : ''">
9+
...
10+
</div>
11+
12+
<button x-on:click="open = ! open">
13+
Toggle
14+
</button>
15+
16+
<div>
17+
Copyright ©
18+
19+
<span x-text="new Date().getFullYear()"></span>
20+
</div>
21+
22+
<div x-html="(await axios.get('/some/html/partial')).data">
23+
...
24+
</div>
25+
26+
<div x-data="{ search: '' }">
27+
<input type="text" x-model="search">
28+
29+
Searching for: <span x-text="search"></span>
30+
</div>
31+
32+
<div x-show="open">
33+
...
34+
</div>
35+
36+
<div x-show="open" x-transition>
37+
...
38+
</div>
39+
40+
<template x-for="post in posts">
41+
<h2 x-text="post.title"></h2>
42+
</template>
43+
44+
<template x-if="open">
45+
<div>...</div>
46+
</template>
47+
48+
<div x-init="date = new Date()"></div>
49+
50+
<div x-effect="console.log('Count is '+count)"></div>
51+
52+
<input type="text" x-ref="content">
53+
<button x-on:click="navigator.clipboard.writeText($refs.content.value)">
54+
Copy
55+
</button>
56+
57+
<div x-cloak>
58+
...
59+
</div>
60+
61+
<div x-ignore>
62+
...
63+
</div>
64+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
65+
<div x-data="{ open: false }">
66+
...
67+
</div>
68+
69+
<div x-bind:class="! open ? 'hidden' : ''">
70+
...
71+
</div>
72+
73+
<button x-on:click="open = ! open">Toggle</button>
74+
75+
<div>
76+
Copyright ©
77+
78+
<span x-text="new Date().getFullYear()"></span>
79+
</div>
80+
81+
<div x-html="(await axios.get('/some/html/partial')).data">
82+
...
83+
</div>
84+
85+
<div x-data="{ search: '' }">
86+
<input type="text" x-model="search" />Searching for: <span x-text="search"></span>
87+
</div>
88+
89+
<div x-show="open">
90+
...
91+
</div>
92+
93+
<div x-show="open" x-transition>
94+
...
95+
</div>
96+
97+
<template x-for="post in posts">
98+
<h2 x-text="post.title"></h2>
99+
</template>
100+
101+
<template x-if="open">
102+
<div>
103+
...
104+
</div>
105+
</template>
106+
107+
<div x-init="date = new Date()"></div>
108+
109+
<div x-effect="console.log('Count is '+count)"></div>
110+
111+
<input type="text" x-ref="content" />
112+
<button x-on:click="navigator.clipboard.writeText($refs.content.value)">
113+
Copy
114+
</button>
115+
116+
<div x-cloak>
117+
...
118+
</div>
119+
120+
<div x-ignore>
121+
...
122+
</div>
123+
124+
`;
125+
3126
exports[`attributes.twig - twig-verify > attributes.twig 1`] = `
4127
<a href="#abcd" target="_blank" lang="en" >Link</a>
5128

tests/Element/alpinejs.twig

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<div x-data="{ open: false }">
2+
...
3+
</div>
4+
5+
<div x-bind:class="! open ? 'hidden' : ''">
6+
...
7+
</div>
8+
9+
<button x-on:click="open = ! open">
10+
Toggle
11+
</button>
12+
13+
<div>
14+
Copyright ©
15+
16+
<span x-text="new Date().getFullYear()"></span>
17+
</div>
18+
19+
<div x-html="(await axios.get('/some/html/partial')).data">
20+
...
21+
</div>
22+
23+
<div x-data="{ search: '' }">
24+
<input type="text" x-model="search">
25+
26+
Searching for: <span x-text="search"></span>
27+
</div>
28+
29+
<div x-show="open">
30+
...
31+
</div>
32+
33+
<div x-show="open" x-transition>
34+
...
35+
</div>
36+
37+
<template x-for="post in posts">
38+
<h2 x-text="post.title"></h2>
39+
</template>
40+
41+
<template x-if="open">
42+
<div>...</div>
43+
</template>
44+
45+
<div x-init="date = new Date()"></div>
46+
47+
<div x-effect="console.log('Count is '+count)"></div>
48+
49+
<input type="text" x-ref="content">
50+
<button x-on:click="navigator.clipboard.writeText($refs.content.value)">
51+
Copy
52+
</button>
53+
54+
<div x-cloak>
55+
...
56+
</div>
57+
58+
<div x-ignore>
59+
...
60+
</div>

0 commit comments

Comments
 (0)