File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1013,3 +1013,28 @@ test("Watch as array with more then one value", t => {
10131013 } )
10141014 } )
10151015} )
1016+
1017+ test ( "$asyncComputed[name].state resolves to 'success' even if the computed value is 0 (issue #75)" , t => {
1018+ t . plan ( 11 )
1019+ const vm = new Vue ( {
1020+ asyncComputed : {
1021+ a ( ) {
1022+ return Promise . resolve ( 0 )
1023+ } ,
1024+ }
1025+ } )
1026+ t . equal ( vm . $asyncComputed [ 'a' ] . state , 'updating' )
1027+ t . equal ( vm . $asyncComputed [ 'a' ] . updating , true )
1028+ t . equal ( vm . $asyncComputed [ 'a' ] . success , false )
1029+ t . equal ( vm . $asyncComputed [ 'a' ] . error , false )
1030+ t . equal ( vm . $asyncComputed [ 'a' ] . exception , null )
1031+
1032+ Vue . nextTick ( ( ) => {
1033+ t . equal ( vm . a , 0 )
1034+ t . equal ( vm . $asyncComputed [ 'a' ] . state , 'success' )
1035+ t . equal ( vm . $asyncComputed [ 'a' ] . updating , false )
1036+ t . equal ( vm . $asyncComputed [ 'a' ] . success , true )
1037+ t . equal ( vm . $asyncComputed [ 'a' ] . error , false )
1038+ t . equal ( vm . $asyncComputed [ 'a' ] . exception , null )
1039+ } )
1040+ } )
You can’t perform that action at this time.
0 commit comments