mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-05-04 21:22:07 +00:00
test: add Window type augmentation and standardize window access
- Add browser_tests/types/globals.d.ts with Window interface augmentation - Add types for app, graph, LiteGraph, LGraphBadge and test globals - Standardize window['prop'] to window.prop across 37 test files - Update browser_tests/tsconfig.json to include new type definitions Amp-Thread-ID: https://ampcode.com/threads/T-019c16b3-cc31-70ea-9727-a933cb0ee942 Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
@@ -11,14 +11,14 @@ test.describe('Keybindings', { tag: '@keyboard' }, () => {
|
||||
comfyPage
|
||||
}) => {
|
||||
await comfyPage.command.registerKeybinding({ key: 'k' }, () => {
|
||||
window['TestCommand'] = true
|
||||
window.TestCommand = true
|
||||
})
|
||||
|
||||
const textBox = comfyPage.widgetTextBox
|
||||
await textBox.click()
|
||||
await textBox.fill('k')
|
||||
await expect(textBox).toHaveValue('k')
|
||||
expect(await comfyPage.page.evaluate(() => window['TestCommand'])).toBe(
|
||||
expect(await comfyPage.page.evaluate(() => window.TestCommand)).toBe(
|
||||
undefined
|
||||
)
|
||||
})
|
||||
@@ -27,7 +27,7 @@ test.describe('Keybindings', { tag: '@keyboard' }, () => {
|
||||
comfyPage
|
||||
}) => {
|
||||
await comfyPage.command.registerKeybinding({ key: 'k', ctrl: true }, () => {
|
||||
window['TestCommand'] = true
|
||||
window.TestCommand = true
|
||||
})
|
||||
|
||||
const textBox = comfyPage.widgetTextBox
|
||||
@@ -35,23 +35,21 @@ test.describe('Keybindings', { tag: '@keyboard' }, () => {
|
||||
await textBox.fill('q')
|
||||
await textBox.press('Control+k')
|
||||
await expect(textBox).toHaveValue('q')
|
||||
expect(await comfyPage.page.evaluate(() => window['TestCommand'])).toBe(
|
||||
true
|
||||
)
|
||||
expect(await comfyPage.page.evaluate(() => window.TestCommand)).toBe(true)
|
||||
})
|
||||
|
||||
test('Should not trigger keybinding reserved by text input when typing in input fields', async ({
|
||||
comfyPage
|
||||
}) => {
|
||||
await comfyPage.command.registerKeybinding({ key: 'Ctrl+v' }, () => {
|
||||
window['TestCommand'] = true
|
||||
window.TestCommand = true
|
||||
})
|
||||
|
||||
const textBox = comfyPage.widgetTextBox
|
||||
await textBox.click()
|
||||
await textBox.press('Control+v')
|
||||
await expect(textBox).toBeFocused()
|
||||
expect(await comfyPage.page.evaluate(() => window['TestCommand'])).toBe(
|
||||
expect(await comfyPage.page.evaluate(() => window.TestCommand)).toBe(
|
||||
undefined
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user