Skip to content

Commit a287018

Browse files
committed
Add tests for new js_value_syntax on template
1 parent 80e8226 commit a287018

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#
2+
# HTML
3+
#
4+
Given vue (HTML directives);
5+
<template>
6+
<input v-for="i in keys" />
7+
</template>
8+
9+
Do:
10+
# refresh detect_on_enter
11+
:syntax off\<CR>
12+
:syntax on\<CR>
13+
14+
Execute:
15+
AssertEqual 'htmlArg', SyntaxAt(2, 10)
16+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(2, 17)
17+
18+
Given vue (HTML slots);
19+
<template>
20+
<custom-button
21+
#default="scopedProps"
22+
#[dynamicSlot[2]]="variable"
23+
/>
24+
</template>
25+
26+
Do:
27+
# refresh detect_on_enter
28+
:syntax off\<CR>
29+
:syntax on\<CR>
30+
31+
Execute:
32+
AssertEqual 'htmlArg', SyntaxAt(3, 5)
33+
AssertEqual 'htmlArg', SyntaxAt(4, 5)
34+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(3, 15)
35+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(4, 7)
36+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(4, 24)
37+
38+
Given vue (HTML events);
39+
<template>
40+
<custom-button
41+
@click='events.goToCheckout(i)'
42+
@[object.hoverEvent(true)]="event"
43+
/>
44+
</template>
45+
46+
Do:
47+
# refresh detect_on_enter
48+
:syntax off\<CR>
49+
:syntax on\<CR>
50+
51+
Execute:
52+
AssertEqual 'htmlArg', SyntaxAt(3, 5)
53+
AssertEqual 'htmlArg', SyntaxAt(4, 5)
54+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(3, 13)
55+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(4, 7)
56+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(4, 33)
57+
58+
Given vue (HTML attributes and props);
59+
<template>
60+
<custom-button
61+
:color='customColor'
62+
:[iconProp]="isLoading ? 'loading' : 'bag'"
63+
variant="primary"
64+
tabindex='0'
65+
aria-label="buy our stuff"
66+
/>
67+
</template>
68+
69+
Do:
70+
# refresh detect_on_enter
71+
:syntax off\<CR>
72+
:syntax on\<CR>
73+
74+
Execute:
75+
# dynamic and static props
76+
AssertEqual 'htmlArg', SyntaxAt(3, 5)
77+
AssertEqual 'htmlArg', SyntaxAt(4, 5)
78+
AssertEqual 'htmlArg', SyntaxAt(5, 5)
79+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(3, 13)
80+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(4, 7)
81+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(4, 18)
82+
# variant tabindex
83+
AssertEqual 'htmlArg', SyntaxAt(5, 5)
84+
AssertEqual 'htmlArg', SyntaxAt(6, 5)
85+
# both types of string
86+
AssertEqual 'htmlString', SyntaxAt(3, 12)
87+
AssertEqual 'htmlString', SyntaxAt(6, 16)
88+
AssertEqual 'htmlString', SyntaxAt(4, 17)
89+
AssertEqual 'htmlString', SyntaxAt(7, 16)
90+
91+
Given vue (HTML mustaches syntax);
92+
<template>
93+
<button>
94+
Buy {{ getProduct() }}!
95+
</button>
96+
</template>
97+
98+
Do:
99+
# refresh detect_on_enter
100+
:syntax off\<CR>
101+
:syntax on\<CR>
102+
103+
Execute:
104+
AssertEqual 'htmlSpecialChar', SyntaxAt(3, 9)
105+
AssertEqual 'vueJavascriptInTemplate', SyntaxAt(3, 11)

0 commit comments

Comments
 (0)