diff --git a/app/gui2/e2e/widgets.spec.ts b/app/gui2/e2e/widgets.spec.ts index ca33d5a357a7..17b29579d267 100644 --- a/app/gui2/e2e/widgets.spec.ts +++ b/app/gui2/e2e/widgets.spec.ts @@ -65,8 +65,8 @@ test('Selection widgets in Data.read node', async ({ page }) => { // Set value on `on_problems` (static drop-down) const onProblemsArg = argumentNames.filter({ has: page.getByText('on_problems') }) await onProblemsArg.click() - await dropDown.expectVisibleWithOptions(page, ['Ignore', 'Report Warning', 'Report Error']) - await dropDown.clickOption(page, 'Report Error') + await dropDown.expectVisibleWithOptions(page, ['Ignore', 'Report_Warning', 'Report_Error']) + await dropDown.clickOption(page, 'Report_Error') await expect(onProblemsArg.locator('.WidgetToken')).toHaveText([ 'Problem_Behavior', '.', @@ -83,8 +83,8 @@ test('Selection widgets in Data.read node', async ({ page }) => { notAppliedArguments: [0, 1], }) await page.getByText('Report_Error').click() - await dropDown.expectVisibleWithOptions(page, ['Ignore', 'Report Warning', 'Report Error']) - await dropDown.clickOption(page, 'Report Warning') + await dropDown.expectVisibleWithOptions(page, ['Ignore', 'Report_Warning', 'Report_Error']) + await dropDown.clickOption(page, 'Report_Warning') await expect(onProblemsArg.locator('.WidgetToken')).toHaveText([ 'Problem_Behavior', '.', @@ -95,8 +95,8 @@ test('Selection widgets in Data.read node', async ({ page }) => { const pathArg = argumentNames.filter({ has: page.getByText('path') }) await pathArg.click() await expect(page.locator('.dropdownContainer')).toBeVisible() - await dropDown.expectVisibleWithOptions(page, ['File 1', 'File 2']) - await dropDown.clickOption(page, 'File 2') + await dropDown.expectVisibleWithOptions(page, ['"File 1"', '"File 2"']) + await dropDown.clickOption(page, '"File 2"') await expect(pathArg.locator('.EnsoTextInputWidget > input')).toHaveValue('"File 2"') // Change value on `path` (dynamic config) @@ -109,8 +109,8 @@ test('Selection widgets in Data.read node', async ({ page }) => { notAppliedArguments: [1], }) await page.getByText('path').click() - await dropDown.expectVisibleWithOptions(page, ['File 1', 'File 2']) - await dropDown.clickOption(page, 'File 1') + await dropDown.expectVisibleWithOptions(page, ['"File 1"', '"File 2"']) + await dropDown.clickOption(page, '"File 1"') await expect(pathArg.locator('.EnsoTextInputWidget > input')).toHaveValue('"File 1"') }) @@ -154,8 +154,8 @@ test('Managing aggregates in `aggregate` node', async ({ page }) => { // Change aggregation type const firstItem = columnsArg.locator('.item > .WidgetPort > .WidgetSelection') await firstItem.click() - await dropDown.expectVisibleWithOptions(page, ['Group By', 'Count', 'Count Distinct']) - await dropDown.clickOption(page, 'Count Distinct') + await dropDown.expectVisibleWithOptions(page, ['Group_By', 'Count', 'Count_Distinct']) + await dropDown.clickOption(page, 'Count_Distinct') await expect(columnsArg.locator('.WidgetToken')).toHaveText([ 'Aggregate_Column', '.', @@ -180,8 +180,8 @@ test('Managing aggregates in `aggregate` node', async ({ page }) => { // Set column const columnArg = firstItem.locator('.WidgetSelection').first() await columnArg.click() - await dropDown.expectVisibleWithOptions(page, ['column 1', 'column 2']) - await dropDown.clickOption(page, 'column 1') + await dropDown.expectVisibleWithOptions(page, ['"column 1"', '"column 2"']) + await dropDown.clickOption(page, '"column 1"') await expect(columnsArg.locator('.WidgetToken')).toHaveText([ 'Aggregate_Column', '.', @@ -219,8 +219,8 @@ test('Managing aggregates in `aggregate` node', async ({ page }) => { const secondItem = columnsArg.locator('.item > .WidgetPort > .WidgetSelection').nth(1) const secondColumnArg = secondItem.locator('.WidgetSelection').first() await secondColumnArg.click() - await dropDown.expectVisibleWithOptions(page, ['column 1', 'column 2']) - await dropDown.clickOption(page, 'column 2') + await dropDown.expectVisibleWithOptions(page, ['"column 1"', '"column 2"']) + await dropDown.clickOption(page, '"column 2"') await expect(secondItem.locator('.WidgetToken')).toHaveText(['Aggregate_Column', '.', 'Group_By']) await expect(secondItem.locator('.EnsoTextInputWidget > input').first()).toHaveValue('"column 2"') diff --git a/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue b/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue index 6f03bd63fd55..6d181ffd2e80 100644 --- a/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue +++ b/app/gui2/src/components/GraphEditor/widgets/WidgetSelection.vue @@ -21,11 +21,7 @@ import { targetIsOutside } from '@/util/autoBlur' import { ArgumentInfoKey } from '@/util/callTree' import { arrayEquals } from '@/util/data/array' import { asNot } from '@/util/data/types.ts' -import { - qnLastSegment, - tryQualifiedName, - type IdentifierOrOperatorIdentifier, -} from '@/util/qualifiedName' +import { qnLastSegment, tryQualifiedName } from '@/util/qualifiedName' import { computed, ref, watch } from 'vue' const props = defineProps(widgetProps(widgetDefinition)) @@ -42,24 +38,20 @@ interface Tag { parameters?: ArgumentWidgetConfiguration[] } -function identToLabel(name: IdentifierOrOperatorIdentifier): string { - return name.replaceAll('_', ' ') -} - function tagFromExpression(expression: string): Tag { const qn = tryQualifiedName(expression) if (!qn.ok) return { expression } const entry = suggestions.entries.getEntryByQualifiedName(qn.value) if (entry) return tagFromEntry(entry) return { - label: identToLabel(qnLastSegment(qn.value)), + label: qnLastSegment(qn.value), expression: qn.value, } } function tagFromEntry(entry: SuggestionEntry): Tag { return { - label: identToLabel(entry.name), + label: entry.name, expression: entry.selfType != null ? `_.${entry.name}` @@ -81,7 +73,6 @@ const dynamicTags = computed(() => { if (config?.kind !== 'Single_Choice') return [] return config.values.map((value) => ({ ...tagFromExpression(value.value), - ...(value.label ? { label: value.label } : {}), parameters: value.parameters, })) }) @@ -163,6 +154,8 @@ watch(selectedIndex, (_index) => { }, }) }) + +const isHovered = ref(false)