File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed
Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -2,9 +2,14 @@ import test from "tape"
22import AsyncComputed from "../src"
33import Vue from 'vue'
44
5- const testErrorLog = [ ]
5+ let baseErrorCallback = ( ) => {
6+ throw new Error ( 'Unexpected error thrown' )
7+ }
8+
9+ let testErrorCallback = baseErrorCallback
10+
611Vue . use ( AsyncComputed , {
7- errorHandler : msg => testErrorLog . push ( msg )
12+ errorHandler : msg => testErrorCallback ( msg )
813} )
914
1015test ( "Async computed values get computed" , t => {
@@ -150,7 +155,7 @@ test("Having only sync computed data still works", t => {
150155} )
151156
152157test ( "Handle errors in computed properties" , t => {
153- t . plan ( 4 )
158+ t . plan ( 2 )
154159 const vm = new Vue ( {
155160 asyncComputed : {
156161 a ( ) {
@@ -159,15 +164,10 @@ test("Handle errors in computed properties", t => {
159164 }
160165 } )
161166 t . equal ( vm . a , null )
162- t . equal ( testErrorLog . length , 0 )
163- Vue . nextTick ( ( ) =>
164- // In Vue 2.0 it takes an additional tick before
165- // we see the error
166- Vue . nextTick ( ( ) => {
167- t . equal ( vm . a , null )
168- t . equal ( testErrorLog . length , 1 )
169- } )
170- )
167+ testErrorCallback = msg => {
168+ t . equal ( vm . a , null )
169+ testErrorCallback = baseErrorCallback
170+ }
171171} )
172172
173173test ( "Handle multiple asyncComputed objects the same way normal as \
You can’t perform that action at this time.
0 commit comments