@@ -88,8 +88,8 @@ describe('parser', () => {
88
88
. not . toHaveBeenWarned ( )
89
89
} )
90
90
91
- it ( 'not warn 3 root elements with v-if, v-elseif and v-else' , ( ) => {
92
- parse ( '<div v-if="1"></div><div v-elseif ="2"></div><div v-else></div>' , baseOptions )
91
+ it ( 'not warn 3 root elements with v-if, v-else-if and v-else' , ( ) => {
92
+ parse ( '<div v-if="1"></div><div v-else-if ="2"></div><div v-else></div>' , baseOptions )
93
93
expect ( 'Component template should contain exactly one root element' )
94
94
. not . toHaveBeenWarned ( )
95
95
} )
@@ -103,20 +103,20 @@ describe('parser', () => {
103
103
. not . toHaveBeenWarned ( )
104
104
} )
105
105
106
- it ( 'not warn 3 or more root elements with v-if, v-elseif and v-else on separate lines' , ( ) => {
106
+ it ( 'not warn 3 or more root elements with v-if, v-else-if and v-else on separate lines' , ( ) => {
107
107
parse ( `
108
108
<div v-if="1"></div>
109
- <div v-elseif ="2"></div>
109
+ <div v-else-if ="2"></div>
110
110
<div v-else></div>
111
111
` , baseOptions )
112
112
expect ( 'Component template should contain exactly one root element' )
113
113
. not . toHaveBeenWarned ( )
114
114
115
115
parse ( `
116
116
<div v-if="1"></div>
117
- <div v-elseif ="2"></div>
118
- <div v-elseif ="3"></div>
119
- <div v-elseif ="4"></div>
117
+ <div v-else-if ="2"></div>
118
+ <div v-else-if ="3"></div>
119
+ <div v-else-if ="4"></div>
120
120
<div v-else></div>
121
121
` , baseOptions )
122
122
expect ( 'Component template should contain exactly one root element' )
@@ -135,7 +135,7 @@ describe('parser', () => {
135
135
it ( 'generate correct ast for 3 or more root elements with v-if and v-else on separate lines' , ( ) => {
136
136
const ast = parse ( `
137
137
<div v-if="1"></div>
138
- <span v-elseif ="2"></span>
138
+ <span v-else-if ="2"></span>
139
139
<p v-else></p>
140
140
` , baseOptions )
141
141
expect ( ast . tag ) . toBe ( 'div' )
@@ -145,9 +145,9 @@ describe('parser', () => {
145
145
146
146
const astMore = parse ( `
147
147
<div v-if="1"></div>
148
- <span v-elseif ="2"></span>
149
- <div v-elseif ="3"></div>
150
- <span v-elseif ="4"></span>
148
+ <span v-else-if ="2"></span>
149
+ <div v-else-if ="3"></div>
150
+ <span v-else-if ="4"></span>
151
151
<p v-else></p>
152
152
` , baseOptions )
153
153
expect ( astMore . tag ) . toBe ( 'div' )
@@ -170,17 +170,17 @@ describe('parser', () => {
170
170
. toHaveBeenWarned ( )
171
171
} )
172
172
173
- it ( 'warn 3 root elements with v-if and v-elseif on first 2' , ( ) => {
174
- parse ( '<div v-if="1"></div><div v-elseif ></div><div></div>' , baseOptions )
173
+ it ( 'warn 3 root elements with v-if and v-else-if on first 2' , ( ) => {
174
+ parse ( '<div v-if="1"></div><div v-else-if ></div><div></div>' , baseOptions )
175
175
expect ( 'Component template should contain exactly one root element:\n\n' +
176
- '<div v-if="1"></div><div v-elseif ></div><div></div>' )
176
+ '<div v-if="1"></div><div v-else-if ></div><div></div>' )
177
177
. toHaveBeenWarned ( )
178
178
} )
179
179
180
- it ( 'warn 4 root elements with v-if, v-elseif and v-else on first 2' , ( ) => {
181
- parse ( '<div v-if="1"></div><div v-elseif ></div><div v-else></div><div></div>' , baseOptions )
180
+ it ( 'warn 4 root elements with v-if, v-else-if and v-else on first 2' , ( ) => {
181
+ parse ( '<div v-if="1"></div><div v-else-if ></div><div v-else></div><div></div>' , baseOptions )
182
182
expect ( 'Component template should contain exactly one root element:\n\n' +
183
- '<div v-if="1"></div><div v-elseif ></div><div v-else></div><div></div>' )
183
+ '<div v-if="1"></div><div v-else-if ></div><div v-else></div><div></div>' )
184
184
. toHaveBeenWarned ( )
185
185
} )
186
186
@@ -191,10 +191,10 @@ describe('parser', () => {
191
191
. toHaveBeenWarned ( )
192
192
} )
193
193
194
- it ( 'warn 2 root elements with v-if and v-elseif with v-for on 2nd' , ( ) => {
195
- parse ( '<div v-if="1"></div><div v-elseif ="2" v-for="i in [1]"></div>' , baseOptions )
194
+ it ( 'warn 2 root elements with v-if and v-else-if with v-for on 2nd' , ( ) => {
195
+ parse ( '<div v-if="1"></div><div v-else-if ="2" v-for="i in [1]"></div>' , baseOptions )
196
196
expect ( 'Cannot use v-for on stateful component root element because it renders multiple elements:\n' +
197
- '<div v-if="1"></div><div v-elseif ="2" v-for="i in [1]"></div>' )
197
+ '<div v-if="1"></div><div v-else-if ="2" v-for="i in [1]"></div>' )
198
198
. toHaveBeenWarned ( )
199
199
} )
200
200
@@ -270,8 +270,8 @@ describe('parser', () => {
270
270
expect ( ast . conditions [ 0 ] . exp ) . toBe ( 'show' )
271
271
} )
272
272
273
- it ( 'v-elseif directive syntax' , ( ) => {
274
- const ast = parse ( '<div><p v-if="show">hello</p><span v-elseif ="2">elseif</span><p v-else>world</p></div>' , baseOptions )
273
+ it ( 'v-else-if directive syntax' , ( ) => {
274
+ const ast = parse ( '<div><p v-if="show">hello</p><span v-else-if ="2">elseif</span><p v-else>world</p></div>' , baseOptions )
275
275
const ifAst = ast . children [ 0 ]
276
276
const conditionsAst = ifAst . conditions
277
277
expect ( conditionsAst . length ) . toBe ( 3 )
@@ -290,9 +290,9 @@ describe('parser', () => {
290
290
expect ( conditionsAst [ 1 ] . block . parent ) . toBe ( ast )
291
291
} )
292
292
293
- it ( 'v-elseif directive invalid syntax' , ( ) => {
294
- parse ( '<div><p v-elseif ="1">world</p></div>' , baseOptions )
295
- expect ( 'v-elseif ="1" used on element' ) . toHaveBeenWarned ( )
293
+ it ( 'v-else-if directive invalid syntax' , ( ) => {
294
+ parse ( '<div><p v-else-if ="1">world</p></div>' , baseOptions )
295
+ expect ( 'v-else-if ="1" used on element' ) . toHaveBeenWarned ( )
296
296
} )
297
297
298
298
it ( 'v-else directive invalid syntax' , ( ) => {
0 commit comments