diff --git a/app/gui/integration-test/project-view/collapsingAndEntering.spec.ts b/app/gui/integration-test/project-view/collapsingAndEntering.spec.ts index 20ce3cdc97ae..a38ec0f5ff97 100644 --- a/app/gui/integration-test/project-view/collapsingAndEntering.spec.ts +++ b/app/gui/integration-test/project-view/collapsingAndEntering.spec.ts @@ -2,7 +2,7 @@ import { test, type Page } from '@playwright/test' import * as actions from './actions' import { expect } from './customExpect' import { mockCollapsedFunctionInfo } from './expressionUpdates' -import { CONTROL_KEY } from './keyboard' +import { CONTROL_KEY, DELETE_KEY } from './keyboard' import * as locate from './locate' import { edgesFromNode, edgesToNode } from './locate' import { mockSuggestion } from './suggestionUpdates' @@ -200,6 +200,37 @@ test('Input node is not collapsed', async ({ page }) => { await expect(locate.outputNode(page)).toHaveCount(1) }) +test('Collapsed call shows argument placeholders', async ({ page }) => { + await actions.goToGraph(page) + await mockCollapsedFunctionInfo(page, 'final', 'func1', [0]) + await mockSuggestion(page, { + type: 'method', + module: 'local.Mock_Project.Main', + name: 'func1', + arguments: [ + { + name: 'arg1', + reprType: 'Standard.Base.Any.Any', + isSuspended: false, + hasDefault: false, + defaultValue: null as any, + tagValues: null as any, + }, + ], + selfType: 'local.Mock_Project.Main', + returnType: 'Standard.Base.Any.Any', + isStatic: true, + documentation: '', + annotations: [], + }) + const collapsedCallComponent = locate.graphNodeByBinding(page, 'final') + await locate.graphNodeByBinding(page, 'prod').click() + await page.keyboard.press(DELETE_KEY) + await expect(await edgesToNode(page, collapsedCallComponent)).toHaveCount(0) + await expect(locate.selectedNodes(page)).toHaveCount(0) + await expect(collapsedCallComponent.locator('.WidgetArgumentName .name')).toHaveText('arg1') +}) + async function expectInsideMain(page: Page) { await actions.expectNodePositionsInitialized(page, -16) await expect(locate.graphNode(page)).toHaveCount(MAIN_FILE_NODES) diff --git a/app/gui/integration-test/project-view/expressionUpdates.ts b/app/gui/integration-test/project-view/expressionUpdates.ts index 5846ef888f14..733c9896037f 100644 --- a/app/gui/integration-test/project-view/expressionUpdates.ts +++ b/app/gui/integration-test/project-view/expressionUpdates.ts @@ -8,6 +8,7 @@ export async function mockCollapsedFunctionInfo( page: Page, expression: ExpressionLocator, functionName: string, + notAppliedArguments: number[] = [], ) { await mockMethodCallInfo(page, expression, { methodPointer: { @@ -15,7 +16,7 @@ export async function mockCollapsedFunctionInfo( definedOnType: 'local.Mock_Project.Main', name: functionName, }, - notAppliedArguments: [], + notAppliedArguments, }) } diff --git a/app/gui/src/project-view/util/callTree.ts b/app/gui/src/project-view/util/callTree.ts index 087ded4b9163..af374226c358 100644 --- a/app/gui/src/project-view/util/callTree.ts +++ b/app/gui/src/project-view/util/callTree.ts @@ -120,9 +120,13 @@ export class ArgumentPlaceholder extends Argument { return this.argInfo.defaultValue } - /** TODO: Add docs */ + /** Whether the argument should be hidden when the component isn't currently focused for editing. */ override get hideByDefault(): boolean { - return !isRequiredArgument(this.argInfo) && this.dynamicConfig?.display !== DisplayMode.Always + return ( + this.argInfo.hasDefault && + !isRequiredArgument(this.argInfo) && + this.dynamicConfig?.display !== DisplayMode.Always + ) } }