feat: release OpsXShell 2.1.0 native Tauri edition

This commit is contained in:
Logan.Li committed 2026-07-30 23:32:51 +08:00
1 parent e9a0d21758
commit a3dba0c6ed
311 files changed
+31748 -14897

No files matched your search

+52
View File
@@ -0,0 +1,52 @@
import { render, screen } from '@testing-library/react'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { useKeyboardShortcuts } from '../../src/hooks/useKeyboardShortcuts'
import { KeybindingAction } from '../../src/constants/keybindings'
import { useKeybindingStore } from '../../src/stores/keybindingStore'
import { useCommandPaletteStore } from '../../src/stores/commandPaletteStore'
function ShortcutHarness() {
useKeyboardShortcuts()
return <input aria-label="editable" />
}
describe('editable clipboard shortcut contract', () => {
beforeEach(() => {
vi.clearAllMocks()
useKeybindingStore.setState({ customKeybindings: {}, isLoaded: true })
useCommandPaletteStore.setState({ isOpen: false })
})
it.each(['a', 'c', 'v', 'x', 'z', 'y'])('does not prevent Cmd/Ctrl+%s in an input', (key) => {
render(<ShortcutHarness />)
const input = screen.getByLabelText('editable')
const event = new KeyboardEvent('keydown', {
key,
metaKey: true,
bubbles: true,
cancelable: true,
})
expect(input.dispatchEvent(event)).toBe(true)
expect(event.defaultPrevented).toBe(false)
})
it('keeps paste reserved even when a user shortcut conflicts with Cmd/Ctrl+V', () => {
useKeybindingStore.setState({
customKeybindings: { [KeybindingAction.TOOLS_COMMAND_PALETTE]: 'Ctrl+V' },
isLoaded: true,
})
render(<ShortcutHarness />)
const input = screen.getByLabelText('editable')
const event = new KeyboardEvent('keydown', {
key: 'v',
metaKey: true,
bubbles: true,
cancelable: true,
})
input.dispatchEvent(event)
expect(event.defaultPrevented).toBe(false)
expect(useCommandPaletteStore.getState().isOpen).toBe(false)
})
})