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
221221} )
222222
223223test ( "Async computed values can have defaults" , t => {
224- t . plan ( 6 )
224+ t . plan ( 8 )
225225 const vm = new Vue ( {
226226 asyncComputed : {
227227 x : {
@@ -238,9 +238,27 @@ test("Async computed values can have defaults", t => {
238238 return Promise . resolve ( true )
239239 }
240240 }
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+ } ,
242259 } )
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' )
244262 t . equal ( vm . y , null , 'y doesn\'t have a default' )
245263 t . equal ( vm . z , null , 'z doesn\'t have a default despite being defined with an object' )
246264 Vue . nextTick ( ( ) => {
You can’t perform that action at this time.
0 commit comments