fix: fix dialogs within dialogs not opening (#1154)
* fix: fix dialogs within dialogs not opening fixes #1153 * remove console logs
This commit is contained in:
parent
ddd95aad27
commit
0649eee366
|
@ -43,7 +43,8 @@
|
||||||
},
|
},
|
||||||
data: () => ({
|
data: () => ({
|
||||||
positiveText: void 0,
|
positiveText: void 0,
|
||||||
negativeText: void 0
|
negativeText: void 0,
|
||||||
|
className: ''
|
||||||
}),
|
}),
|
||||||
methods: {
|
methods: {
|
||||||
show,
|
show,
|
||||||
|
|
|
@ -217,13 +217,17 @@
|
||||||
if (otherId !== id) {
|
if (otherId !== id) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
window.addEventListener('popstate', this.onPopState)
|
// This setTimeout is dumb, but it fixes issues with modals opening other modals
|
||||||
this.set({ statePushed: true })
|
// due to the popstate/pushstate dance.
|
||||||
window.history.pushState({ modal: id }, null, location.href)
|
setTimeout(() => {
|
||||||
document.body.classList.toggle('modal-open', true)
|
requestAnimationFrame(() => {
|
||||||
this._a11yDialog.show()
|
window.addEventListener('popstate', this.onPopState)
|
||||||
requestAnimationFrame(() => {
|
this.set({ statePushed: true })
|
||||||
this.set({ fadedIn: true })
|
window.history.pushState({ modal: id }, null, location.href)
|
||||||
|
document.body.classList.toggle('modal-open', true)
|
||||||
|
this._a11yDialog.show()
|
||||||
|
this.set({ fadedIn: true })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
onPopState (event) {
|
onPopState (event) {
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
import {
|
||||||
|
getNthDialogOptionsOption,
|
||||||
|
getNthStatus, getNthStatusOptionsButton,
|
||||||
|
modalDialog, sleep, visibleModalDialog
|
||||||
|
} from '../utils'
|
||||||
|
import { loginAsFoobar } from '../roles'
|
||||||
|
|
||||||
|
fixture`032-mute-dialog.js`
|
||||||
|
.page`http://localhost:4002`
|
||||||
|
|
||||||
|
test('Can open the mute dialog twice', async t => {
|
||||||
|
await loginAsFoobar(t)
|
||||||
|
await t
|
||||||
|
.expect(getNthStatus(1).exists).ok({ timeout: 30000 })
|
||||||
|
.hover(getNthStatus(1))
|
||||||
|
.click(getNthStatusOptionsButton(1))
|
||||||
|
.click(getNthDialogOptionsOption(3))
|
||||||
|
.expect(visibleModalDialog.innerText).contains('Mute notifications')
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
|
.pressKey('esc')
|
||||||
|
.expect(modalDialog.exists).notOk()
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
|
.click(getNthStatusOptionsButton(1))
|
||||||
|
.click(getNthDialogOptionsOption(3))
|
||||||
|
.expect(visibleModalDialog.innerText).contains('Mute notifications')
|
||||||
|
await sleep(500)
|
||||||
|
await t
|
||||||
|
.pressKey('esc')
|
||||||
|
.expect(modalDialog.exists).notOk()
|
||||||
|
})
|
Loading…
Reference in New Issue