File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -129,13 +129,14 @@ const Async = defineComponent({
129129must be tested as follow:
130130
131131``` js
132- test (' Async component' , () => {
132+ test (' Async component' , async () => {
133133 const TestComponent = defineComponent ({
134134 components: { Async },
135135 template: ' <Suspense><Async/></Suspense>'
136136 })
137137
138138 const wrapper = mount (TestComponent)
139+ await flushPromises ();
139140 // ...
140141})
141142```
@@ -146,4 +147,4 @@ test('Async component', () => {
146147- Use ` await nextTick() ` to ensure the DOM has updated before the test continues.
147148- Functions that might update the DOM (like ` trigger ` and ` setValue ` ) return ` nextTick ` , so you need to ` await ` them.
148149- Use ` flushPromises ` from Vue Test Utils to resolve any unresolved promises from non-Vue dependencies (such as API requests).
149- - Use ` Suspense ` to test components with an asynchronous ` setup ` .
150+ - Use ` Suspense ` to test components with an asynchronous ` setup ` in an asynchronous test function .
You can’t perform that action at this time.
0 commit comments