1
1
import {
2
- createAsyncComponent ,
2
+ defineAsyncComponent ,
3
3
h ,
4
4
Component ,
5
5
ref ,
@@ -10,10 +10,10 @@ import { createApp, nodeOps, serializeInner } from '@vue/runtime-test'
10
10
11
11
const timeout = ( n : number = 0 ) => new Promise ( r => setTimeout ( r , n ) )
12
12
13
- describe ( 'api: createAsyncComponent ' , ( ) => {
13
+ describe ( 'api: defineAsyncComponent ' , ( ) => {
14
14
test ( 'simple usage' , async ( ) => {
15
15
let resolve : ( comp : Component ) => void
16
- const Foo = createAsyncComponent (
16
+ const Foo = defineAsyncComponent (
17
17
( ) =>
18
18
new Promise ( r => {
19
19
resolve = r as any
@@ -47,7 +47,7 @@ describe('api: createAsyncComponent', () => {
47
47
48
48
test ( 'with loading component' , async ( ) => {
49
49
let resolve : ( comp : Component ) => void
50
- const Foo = createAsyncComponent ( {
50
+ const Foo = defineAsyncComponent ( {
51
51
loader : ( ) =>
52
52
new Promise ( r => {
53
53
resolve = r as any
@@ -87,7 +87,7 @@ describe('api: createAsyncComponent', () => {
87
87
88
88
test ( 'with loading component + explicit delay (0)' , async ( ) => {
89
89
let resolve : ( comp : Component ) => void
90
- const Foo = createAsyncComponent ( {
90
+ const Foo = defineAsyncComponent ( {
91
91
loader : ( ) =>
92
92
new Promise ( r => {
93
93
resolve = r as any
@@ -124,7 +124,7 @@ describe('api: createAsyncComponent', () => {
124
124
test ( 'error without error component' , async ( ) => {
125
125
let resolve : ( comp : Component ) => void
126
126
let reject : ( e : Error ) => void
127
- const Foo = createAsyncComponent (
127
+ const Foo = defineAsyncComponent (
128
128
( ) =>
129
129
new Promise ( ( _resolve , _reject ) => {
130
130
resolve = _resolve as any
@@ -169,7 +169,7 @@ describe('api: createAsyncComponent', () => {
169
169
test ( 'error with error component' , async ( ) => {
170
170
let resolve : ( comp : Component ) => void
171
171
let reject : ( e : Error ) => void
172
- const Foo = createAsyncComponent ( {
172
+ const Foo = defineAsyncComponent ( {
173
173
loader : ( ) =>
174
174
new Promise ( ( _resolve , _reject ) => {
175
175
resolve = _resolve as any
@@ -214,7 +214,7 @@ describe('api: createAsyncComponent', () => {
214
214
test ( 'error with error + loading components' , async ( ) => {
215
215
let resolve : ( comp : Component ) => void
216
216
let reject : ( e : Error ) => void
217
- const Foo = createAsyncComponent ( {
217
+ const Foo = defineAsyncComponent ( {
218
218
loader : ( ) =>
219
219
new Promise ( ( _resolve , _reject ) => {
220
220
resolve = _resolve as any
@@ -270,7 +270,7 @@ describe('api: createAsyncComponent', () => {
270
270
271
271
test ( 'timeout without error component' , async ( ) => {
272
272
let resolve : ( comp : Component ) => void
273
- const Foo = createAsyncComponent ( {
273
+ const Foo = defineAsyncComponent ( {
274
274
loader : ( ) =>
275
275
new Promise ( _resolve => {
276
276
resolve = _resolve as any
@@ -304,7 +304,7 @@ describe('api: createAsyncComponent', () => {
304
304
305
305
test ( 'timeout with error component' , async ( ) => {
306
306
let resolve : ( comp : Component ) => void
307
- const Foo = createAsyncComponent ( {
307
+ const Foo = defineAsyncComponent ( {
308
308
loader : ( ) =>
309
309
new Promise ( _resolve => {
310
310
resolve = _resolve as any
@@ -336,7 +336,7 @@ describe('api: createAsyncComponent', () => {
336
336
337
337
test ( 'timeout with error + loading components' , async ( ) => {
338
338
let resolve : ( comp : Component ) => void
339
- const Foo = createAsyncComponent ( {
339
+ const Foo = defineAsyncComponent ( {
340
340
loader : ( ) =>
341
341
new Promise ( _resolve => {
342
342
resolve = _resolve as any
@@ -369,7 +369,7 @@ describe('api: createAsyncComponent', () => {
369
369
370
370
test ( 'timeout without error component, but with loading component' , async ( ) => {
371
371
let resolve : ( comp : Component ) => void
372
- const Foo = createAsyncComponent ( {
372
+ const Foo = defineAsyncComponent ( {
373
373
loader : ( ) =>
374
374
new Promise ( _resolve => {
375
375
resolve = _resolve as any
@@ -405,7 +405,7 @@ describe('api: createAsyncComponent', () => {
405
405
406
406
test ( 'with suspense' , async ( ) => {
407
407
let resolve : ( comp : Component ) => void
408
- const Foo = createAsyncComponent (
408
+ const Foo = defineAsyncComponent (
409
409
( ) =>
410
410
new Promise ( _resolve => {
411
411
resolve = _resolve as any
@@ -432,7 +432,7 @@ describe('api: createAsyncComponent', () => {
432
432
433
433
test ( 'suspensible: false' , async ( ) => {
434
434
let resolve : ( comp : Component ) => void
435
- const Foo = createAsyncComponent ( {
435
+ const Foo = defineAsyncComponent ( {
436
436
loader : ( ) =>
437
437
new Promise ( _resolve => {
438
438
resolve = _resolve as any
@@ -461,7 +461,7 @@ describe('api: createAsyncComponent', () => {
461
461
462
462
test ( 'suspense with error handling' , async ( ) => {
463
463
let reject : ( e : Error ) => void
464
- const Foo = createAsyncComponent (
464
+ const Foo = defineAsyncComponent (
465
465
( ) =>
466
466
new Promise ( ( _resolve , _reject ) => {
467
467
reject = _reject
0 commit comments