[fix] Revert test changes - tests should use event.key format

This commit is contained in:
snomiao
2025-09-30 05:59:23 +00:00
parent e5adc840fe
commit 14255b3512
2 changed files with 9 additions and 13 deletions

View File

@@ -2,15 +2,11 @@ import { expect } from '@playwright/test'
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.setSetting('Comfy.UseNewMenu', 'Disabled')
})
test.describe('Keybindings', () => {
test('Should not trigger non-modifier keybinding when typing in input fields', async ({
comfyPage
}) => {
await comfyPage.registerKeybinding({ key: 'KeyK' }, () => {
await comfyPage.registerKeybinding({ key: 'k' }, () => {
window['TestCommand'] = true
})
@@ -26,7 +22,7 @@ test.describe('Keybindings', () => {
test('Should not trigger modifier keybinding when typing in input fields', async ({
comfyPage
}) => {
await comfyPage.registerKeybinding({ key: 'KeyK', ctrl: true }, () => {
await comfyPage.registerKeybinding({ key: 'k', ctrl: true }, () => {
window['TestCommand'] = true
})

View File

@@ -12,7 +12,7 @@ import {
} from '@/stores/keybindingStore'
// Mock stores
vi.mock('@/platform/settings/settingStore', () => ({
vi.mock('@/stores/settingStore', () => ({
useSettingStore: vi.fn(() => ({
get: vi.fn(() => [])
}))
@@ -66,7 +66,7 @@ describe('keybindingService - Escape key handling', () => {
it('should execute ExitSubgraph command when Escape is pressed', async () => {
const event = new KeyboardEvent('keydown', {
code: 'Escape',
key: 'Escape',
bubbles: true,
cancelable: true
})
@@ -83,7 +83,7 @@ describe('keybindingService - Escape key handling', () => {
it('should not execute command when Escape is pressed with modifiers', async () => {
const event = new KeyboardEvent('keydown', {
code: 'Escape',
key: 'Escape',
ctrlKey: true,
bubbles: true,
cancelable: true
@@ -100,7 +100,7 @@ describe('keybindingService - Escape key handling', () => {
it('should not execute command when typing in input field', async () => {
const inputElement = document.createElement('input')
const event = new KeyboardEvent('keydown', {
code: 'Escape',
key: 'Escape',
bubbles: true,
cancelable: true
})
@@ -130,7 +130,7 @@ describe('keybindingService - Escape key handling', () => {
document.body.appendChild(dialog)
const event = new KeyboardEvent('keydown', {
code: 'Escape',
key: 'Escape',
bubbles: true,
cancelable: true
})
@@ -158,7 +158,7 @@ describe('keybindingService - Escape key handling', () => {
)
const event = new KeyboardEvent('keydown', {
code: 'Escape',
key: 'Escape',
bubbles: true,
cancelable: true
})
@@ -185,7 +185,7 @@ describe('keybindingService - Escape key handling', () => {
keybindingService = useKeybindingService()
const event = new KeyboardEvent('keydown', {
code: 'Escape',
key: 'Escape',
bubbles: true,
cancelable: true
})