mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-30 19:21:54 +00:00
[fix] Revert test changes - tests should use event.key format
This commit is contained in:
@@ -2,15 +2,11 @@ import { expect } from '@playwright/test'
|
|||||||
|
|
||||||
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
|
||||||
|
|
||||||
test.beforeEach(async ({ comfyPage }) => {
|
|
||||||
await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled')
|
|
||||||
})
|
|
||||||
|
|
||||||
test.describe('Keybindings', () => {
|
test.describe('Keybindings', () => {
|
||||||
test('Should not trigger non-modifier keybinding when typing in input fields', async ({
|
test('Should not trigger non-modifier keybinding when typing in input fields', async ({
|
||||||
comfyPage
|
comfyPage
|
||||||
}) => {
|
}) => {
|
||||||
await comfyPage.registerKeybinding({ key: 'KeyK' }, () => {
|
await comfyPage.registerKeybinding({ key: 'k' }, () => {
|
||||||
window['TestCommand'] = true
|
window['TestCommand'] = true
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -26,7 +22,7 @@ test.describe('Keybindings', () => {
|
|||||||
test('Should not trigger modifier keybinding when typing in input fields', async ({
|
test('Should not trigger modifier keybinding when typing in input fields', async ({
|
||||||
comfyPage
|
comfyPage
|
||||||
}) => {
|
}) => {
|
||||||
await comfyPage.registerKeybinding({ key: 'KeyK', ctrl: true }, () => {
|
await comfyPage.registerKeybinding({ key: 'k', ctrl: true }, () => {
|
||||||
window['TestCommand'] = true
|
window['TestCommand'] = true
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
} from '@/stores/keybindingStore'
|
} from '@/stores/keybindingStore'
|
||||||
|
|
||||||
// Mock stores
|
// Mock stores
|
||||||
vi.mock('@/platform/settings/settingStore', () => ({
|
vi.mock('@/stores/settingStore', () => ({
|
||||||
useSettingStore: vi.fn(() => ({
|
useSettingStore: vi.fn(() => ({
|
||||||
get: vi.fn(() => [])
|
get: vi.fn(() => [])
|
||||||
}))
|
}))
|
||||||
@@ -66,7 +66,7 @@ describe('keybindingService - Escape key handling', () => {
|
|||||||
|
|
||||||
it('should execute ExitSubgraph command when Escape is pressed', async () => {
|
it('should execute ExitSubgraph command when Escape is pressed', async () => {
|
||||||
const event = new KeyboardEvent('keydown', {
|
const event = new KeyboardEvent('keydown', {
|
||||||
code: 'Escape',
|
key: 'Escape',
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
})
|
})
|
||||||
@@ -83,7 +83,7 @@ describe('keybindingService - Escape key handling', () => {
|
|||||||
|
|
||||||
it('should not execute command when Escape is pressed with modifiers', async () => {
|
it('should not execute command when Escape is pressed with modifiers', async () => {
|
||||||
const event = new KeyboardEvent('keydown', {
|
const event = new KeyboardEvent('keydown', {
|
||||||
code: 'Escape',
|
key: 'Escape',
|
||||||
ctrlKey: true,
|
ctrlKey: true,
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
@@ -100,7 +100,7 @@ describe('keybindingService - Escape key handling', () => {
|
|||||||
it('should not execute command when typing in input field', async () => {
|
it('should not execute command when typing in input field', async () => {
|
||||||
const inputElement = document.createElement('input')
|
const inputElement = document.createElement('input')
|
||||||
const event = new KeyboardEvent('keydown', {
|
const event = new KeyboardEvent('keydown', {
|
||||||
code: 'Escape',
|
key: 'Escape',
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
})
|
})
|
||||||
@@ -130,7 +130,7 @@ describe('keybindingService - Escape key handling', () => {
|
|||||||
document.body.appendChild(dialog)
|
document.body.appendChild(dialog)
|
||||||
|
|
||||||
const event = new KeyboardEvent('keydown', {
|
const event = new KeyboardEvent('keydown', {
|
||||||
code: 'Escape',
|
key: 'Escape',
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
})
|
})
|
||||||
@@ -158,7 +158,7 @@ describe('keybindingService - Escape key handling', () => {
|
|||||||
)
|
)
|
||||||
|
|
||||||
const event = new KeyboardEvent('keydown', {
|
const event = new KeyboardEvent('keydown', {
|
||||||
code: 'Escape',
|
key: 'Escape',
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
})
|
})
|
||||||
@@ -185,7 +185,7 @@ describe('keybindingService - Escape key handling', () => {
|
|||||||
keybindingService = useKeybindingService()
|
keybindingService = useKeybindingService()
|
||||||
|
|
||||||
const event = new KeyboardEvent('keydown', {
|
const event = new KeyboardEvent('keydown', {
|
||||||
code: 'Escape',
|
key: 'Escape',
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: true
|
cancelable: true
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user