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: () => ({
|
||||
positiveText: void 0,
|
||||
negativeText: void 0
|
||||
negativeText: void 0,
|
||||
className: ''
|
||||
}),
|
||||
methods: {
|
||||
show,
|
||||
|
|
|
@ -217,14 +217,18 @@
|
|||
if (otherId !== id) {
|
||||
return
|
||||
}
|
||||
// This setTimeout is dumb, but it fixes issues with modals opening other modals
|
||||
// due to the popstate/pushstate dance.
|
||||
setTimeout(() => {
|
||||
requestAnimationFrame(() => {
|
||||
window.addEventListener('popstate', this.onPopState)
|
||||
this.set({ statePushed: true })
|
||||
window.history.pushState({ modal: id }, null, location.href)
|
||||
document.body.classList.toggle('modal-open', true)
|
||||
this._a11yDialog.show()
|
||||
requestAnimationFrame(() => {
|
||||
this.set({ fadedIn: true })
|
||||
})
|
||||
})
|
||||
},
|
||||
onPopState (event) {
|
||||
let { id } = this.get()
|
||||
|
|
|
@ -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