mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-28 10:12:11 +00:00
Fix: Escape closes Settings dialog if login dialog open (#4364)
This commit is contained in:
@@ -172,4 +172,58 @@ describe('dialogStore', () => {
|
||||
expect(store.dialogStack[0].title).toBe('Original Title')
|
||||
})
|
||||
})
|
||||
|
||||
describe('ESC key behavior with multiple dialogs', () => {
|
||||
it('should only allow the active dialog to close with ESC key', () => {
|
||||
const store = useDialogStore()
|
||||
|
||||
// Create dialogs with different priorities
|
||||
store.showDialog({
|
||||
key: 'dialog-1',
|
||||
component: MockComponent,
|
||||
priority: 1
|
||||
})
|
||||
|
||||
store.showDialog({
|
||||
key: 'dialog-2',
|
||||
component: MockComponent,
|
||||
priority: 2
|
||||
})
|
||||
|
||||
store.showDialog({
|
||||
key: 'dialog-3',
|
||||
component: MockComponent,
|
||||
priority: 3
|
||||
})
|
||||
|
||||
// Only the active dialog should be closable with ESC
|
||||
const activeDialog = store.dialogStack.find(
|
||||
(d) => d.key === store.activeKey
|
||||
)
|
||||
const inactiveDialogs = store.dialogStack.filter(
|
||||
(d) => d.key !== store.activeKey
|
||||
)
|
||||
|
||||
expect(activeDialog?.dialogComponentProps.closeOnEscape).toBe(true)
|
||||
inactiveDialogs.forEach((dialog) => {
|
||||
expect(dialog.dialogComponentProps.closeOnEscape).toBe(false)
|
||||
})
|
||||
|
||||
// Close the active dialog
|
||||
store.closeDialog({ key: store.activeKey! })
|
||||
|
||||
// The new active dialog should now be closable with ESC
|
||||
const newActiveDialog = store.dialogStack.find(
|
||||
(d) => d.key === store.activeKey
|
||||
)
|
||||
const newInactiveDialogs = store.dialogStack.filter(
|
||||
(d) => d.key !== store.activeKey
|
||||
)
|
||||
|
||||
expect(newActiveDialog?.dialogComponentProps.closeOnEscape).toBe(true)
|
||||
newInactiveDialogs.forEach((dialog) => {
|
||||
expect(dialog.dialogComponentProps.closeOnEscape).toBe(false)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user