|
1 | 1 | import { mount } from '@vue/test-utils' |
2 | | -import { waitNT } from '../../../tests/utils' |
| 2 | +import { waitNT, waitRAF } from '../../../tests/utils' |
3 | 3 | import { VBToggle } from './toggle' |
4 | 4 |
|
5 | 5 | // Emitted control event for collapse (emitted to collapse) |
@@ -29,6 +29,9 @@ describe('v-b-toggle directive', () => { |
29 | 29 |
|
30 | 30 | const wrapper = mount(App) |
31 | 31 |
|
| 32 | + await waitRAF() |
| 33 | + await waitNT(wrapper.vm) |
| 34 | + |
32 | 35 | expect(wrapper.vm).toBeDefined() |
33 | 36 | expect(wrapper.element.tagName).toBe('BUTTON') |
34 | 37 | expect(spy).not.toHaveBeenCalled() |
@@ -72,6 +75,9 @@ describe('v-b-toggle directive', () => { |
72 | 75 |
|
73 | 76 | const wrapper = mount(App) |
74 | 77 |
|
| 78 | + await waitRAF() |
| 79 | + await waitNT(wrapper.vm) |
| 80 | + |
75 | 81 | expect(wrapper.vm).toBeDefined() |
76 | 82 | expect(wrapper.element.tagName).toBe('BUTTON') |
77 | 83 | expect(spy).not.toHaveBeenCalled() |
@@ -113,6 +119,9 @@ describe('v-b-toggle directive', () => { |
113 | 119 |
|
114 | 120 | const wrapper = mount(App) |
115 | 121 |
|
| 122 | + await waitRAF() |
| 123 | + await waitNT(wrapper.vm) |
| 124 | + |
116 | 125 | expect(wrapper.vm).toBeDefined() |
117 | 126 | expect(wrapper.element.tagName).toBe('BUTTON') |
118 | 127 | expect(spy).not.toHaveBeenCalled() |
@@ -154,6 +163,9 @@ describe('v-b-toggle directive', () => { |
154 | 163 |
|
155 | 164 | const wrapper = mount(App) |
156 | 165 |
|
| 166 | + await waitRAF() |
| 167 | + await waitNT(wrapper.vm) |
| 168 | + |
157 | 169 | expect(wrapper.vm).toBeDefined() |
158 | 170 | expect(wrapper.element.tagName).toBe('A') |
159 | 171 | expect(spy).not.toHaveBeenCalled() |
@@ -207,6 +219,9 @@ describe('v-b-toggle directive', () => { |
207 | 219 | } |
208 | 220 | }) |
209 | 221 |
|
| 222 | + await waitRAF() |
| 223 | + await waitNT(wrapper.vm) |
| 224 | + |
210 | 225 | expect(wrapper.vm).toBeDefined() |
211 | 226 | expect(wrapper.element.tagName).toBe('BUTTON') |
212 | 227 | expect(spy).not.toHaveBeenCalled() |
@@ -279,6 +294,9 @@ describe('v-b-toggle directive', () => { |
279 | 294 |
|
280 | 295 | const wrapper = mount(App) |
281 | 296 |
|
| 297 | + await waitRAF() |
| 298 | + await waitNT(wrapper.vm) |
| 299 | + |
282 | 300 | expect(wrapper.vm).toBeDefined() |
283 | 301 | expect(wrapper.element.tagName).toBe('SPAN') |
284 | 302 | expect(spy).not.toHaveBeenCalled() |
|
0 commit comments