Skip to content

Commit c168b9c

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

File tree

1 file changed

+107
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)