Skip to content

Commit d8bae33

Browse files
authored
Merge branch 'dev' into renovate/all-minor-patch
2 parents 574406a + 9707f9c commit d8bae33

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

src/components/modal/modal.spec.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,48 @@ describe('modal', () => {
986986

987987
wrapper.destroy()
988988
})
989+
990+
it('modal closes when no-stacking is true and another modal opens', async () => {
991+
const wrapper = mount(BModal, {
992+
attachToDocument: true,
993+
stubs: {
994+
transition: false
995+
},
996+
propsData: {
997+
static: true,
998+
id: 'test',
999+
visible: true,
1000+
noStacking: true
1001+
}
1002+
})
1003+
1004+
expect(wrapper.isVueInstance()).toBe(true)
1005+
1006+
await waitNT(wrapper.vm)
1007+
await waitRAF()
1008+
await waitNT(wrapper.vm)
1009+
await waitRAF()
1010+
1011+
const $modal = wrapper.find('div.modal')
1012+
expect($modal.exists()).toBe(true)
1013+
1014+
expect($modal.element.style.display).toEqual('block')
1015+
1016+
// Simulate an other modal opening (by emiting a fake BvEvent)
1017+
// `bvEvent.vueTarget` is normally a Vue instance, but in this
1018+
// case we just use a random object since we are checking inequality
1019+
wrapper.vm.$root.$emit('bv::modal::show', { vueTarget: Number })
1020+
1021+
await waitNT(wrapper.vm)
1022+
await waitRAF()
1023+
await waitNT(wrapper.vm)
1024+
await waitRAF()
1025+
1026+
// Modal should now be closed
1027+
expect($modal.element.style.display).toEqual('none')
1028+
1029+
wrapper.destroy()
1030+
})
9891031
})
9901032

9911033
describe('focus management', () => {

0 commit comments

Comments
 (0)