Backspace and delete delete nodes (#10075)

This commit is contained in:
Kaz Wesley 2024-05-24 07:57:45 -07:00 committed by GitHub
parent adfe2dbab4
commit b45e9e9c54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -67,3 +67,23 @@ test('Selecting nodes by area drag', async ({ page }) => {
await expect(node1).toBeSelected()
await expect(node2).toBeSelected()
})
test('Deleting selected node with backspace key', async ({ page }) => {
await actions.goToGraph(page)
const nodesCount = await locate.graphNode(page).count()
const deletedNode = locate.graphNodeByBinding(page, 'final')
await deletedNode.click()
await page.keyboard.press('Backspace')
await expect(locate.graphNode(page)).toHaveCount(nodesCount - 1)
})
test('Deleting selected node with delete key', async ({ page }) => {
await actions.goToGraph(page)
const nodesCount = await locate.graphNode(page).count()
const deletedNode = locate.graphNodeByBinding(page, 'final')
await deletedNode.click()
await page.keyboard.press('Delete')
await expect(locate.graphNode(page)).toHaveCount(nodesCount - 1)
})

View File

@ -29,7 +29,7 @@ export const componentBrowserBindings = defineKeybinds('component-browser', {
export const graphBindings = defineKeybinds('graph-editor', {
openComponentBrowser: ['Enter'],
toggleVisualization: ['Space'],
deleteSelected: ['OsDelete'],
deleteSelected: ['Delete', 'Backspace'],
zoomToSelected: ['Mod+Shift+A'],
selectAll: ['Mod+A'],
deselectAll: ['Escape'],