Skip to content

Commit

Permalink
Top-level add-node button creates disconnected component. (#10416)
Browse files Browse the repository at this point in the history
Closes #10389.
kazcw authored Jul 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 764259f commit 2168cfd
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions app/gui2/e2e/componentBrowser.spec.ts
Original file line number Diff line number Diff line change
@@ -39,16 +39,16 @@ test('Different ways of opening Component Browser', async ({ page }) => {
// (+) button
await locate.addNewNodeButton(page).click()
await expectAndCancelBrowser(page, '')
// (+) button with selection (ignored)
await locate.graphNodeByBinding(page, 'final').click()
await locate.addNewNodeButton(page).click()
await expectAndCancelBrowser(page, '')
// Enter key
await locate.graphEditor(page).press('Enter')
await expectAndCancelBrowser(page, '')

// With source node

// (+) button
await locate.graphNodeByBinding(page, 'final').click()
await locate.addNewNodeButton(page).click()
await expectAndCancelBrowser(page, '', 'final')
// Enter key
await locate.graphNodeByBinding(page, 'final').click()
await locate.graphEditor(page).press('Enter')
@@ -117,7 +117,7 @@ test('Graph Editor pans to Component Browser', async ({ page }) => {
})

test('Accepting suggestion', async ({ page }) => {
// Clicking enry
// Clicking entry
await actions.goToGraph(page)
await locate.addNewNodeButton(page).click()
let nodeCount = await locate.graphNode(page).count()
7 changes: 6 additions & 1 deletion app/gui2/src/components/GraphEditor.vue
Original file line number Diff line number Diff line change
@@ -496,6 +496,11 @@ function addNodeAuto() {
createWithComponentBrowser(fromSelection() ?? { placement: { type: 'viewport' } })
}
function addNodeDisconnected() {
nodeSelection.deselectAll()
createWithComponentBrowser({ placement: { type: 'viewport' } })
}
function fromSelection(): NewNodeOptions | undefined {
if (graphStore.editedNodeInfo != null) return undefined
const firstSelectedNode = set.first(nodeSelection.selected)
@@ -715,7 +720,7 @@ const groupColors = computed(() => {
@collapseNodes="collapseNodes"
@removeNodes="deleteSelected"
/>
<PlusButton title="Add Component" @click.stop="addNodeAuto()" />
<PlusButton title="Add Component" @click.stop="addNodeDisconnected()" />
<Transition>
<Suspense ref="codeEditorArea">
<CodeEditor v-if="showCodeEditor" @close="showCodeEditor = false" />

0 comments on commit 2168cfd

Please sign in to comment.