@@ -182,37 +182,23 @@ describe('defineModel()', () => {
182
182
} )
183
183
} )
184
184
185
- test ( 'w/ Boolean And Function types, production mode' , ( ) => {
185
+ test ( 'w/ Boolean types, production mode' , ( ) => {
186
186
const { content, bindings } = compile (
187
187
`
188
188
<script setup lang="ts">
189
- const modelValue = defineModel<boolean | string>()
190
- const fn = defineModel<() => void>('fn')
191
- const fnWithDefault = defineModel<() => void>('fnWithDefault', { default: () => null })
192
- const optional = defineModel<string>('optional', { required: false })
189
+ const modelValue = defineModel<boolean | string | number>()
193
190
</script>
194
191
` ,
195
192
{ defineModel : true , isProd : true }
196
193
)
197
194
assertCode ( content )
198
- expect ( content ) . toMatch ( '"modelValue": { type: [Boolean, String] }' )
199
- expect ( content ) . toMatch ( '"fn": {}' )
200
- expect ( content ) . toMatch (
201
- '"fnWithDefault": { type: Function, ...{ default: () => null } },'
202
- )
203
- expect ( content ) . toMatch ( '"optional": { required: false }' )
204
- expect ( content ) . toMatch (
205
- 'emits: ["update:modelValue", "update:fn", "update:fnWithDefault", "update:optional"]'
206
- )
195
+ expect ( content ) . toMatch ( '"modelValue": { type: [Boolean, String, Number] }' )
196
+ expect ( content ) . toMatch ( 'emits: ["update:modelValue"]' )
207
197
expect ( content ) . toMatch (
208
198
`const modelValue = _useModel(__props, "modelValue")`
209
199
)
210
- expect ( content ) . toMatch ( `const fn = _useModel(__props, "fn")` )
211
200
expect ( bindings ) . toStrictEqual ( {
212
- modelValue : BindingTypes . SETUP_REF ,
213
- fn : BindingTypes . SETUP_REF ,
214
- fnWithDefault : BindingTypes . SETUP_REF ,
215
- optional : BindingTypes . SETUP_REF
201
+ modelValue : BindingTypes . SETUP_REF
216
202
} )
217
203
} )
218
204
} )
0 commit comments