File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -221,7 +221,7 @@ test("Multiple asyncComputed objects are handled the same as normal computed pro
221
221
} )
222
222
223
223
test ( "Async computed values can have defaults" , t => {
224
- t . plan ( 6 )
224
+ t . plan ( 8 )
225
225
const vm = new Vue ( {
226
226
asyncComputed : {
227
227
x : {
@@ -238,9 +238,27 @@ test("Async computed values can have defaults", t => {
238
238
return Promise . resolve ( true )
239
239
}
240
240
}
241
- }
241
+ } ,
242
+ watch : {
243
+ x : {
244
+ deep : true ,
245
+ immediate : true ,
246
+ handler ( newValue , oldValue ) {
247
+ if ( oldValue === undefined ) {
248
+ t . equal ( newValue , false , 'watch: x should default to false' )
249
+ }
250
+ }
251
+ } ,
252
+ } ,
253
+ computed : {
254
+ computedFromX : function ( ) {
255
+ t . equal ( this . x , false , 'computed: x should default to false' )
256
+ return this . x
257
+ } ,
258
+ } ,
242
259
} )
243
- t . equal ( vm . x , false , 'x should default to true' )
260
+ const computed = vm . computedFromX // Force computed execution
261
+ t . equal ( vm . x , false , 'x should default to false' )
244
262
t . equal ( vm . y , null , 'y doesn\'t have a default' )
245
263
t . equal ( vm . z , null , 'z doesn\'t have a default despite being defined with an object' )
246
264
Vue . nextTick ( ( ) => {
You can’t perform that action at this time.
0 commit comments