Skip to content

Commit d248e32

Browse files
committed
Code Review feedback
1 parent a215b55 commit d248e32

File tree

4 files changed

+22
-10
lines changed

4 files changed

+22
-10
lines changed

app/gui/integration-test/project-view/graphNodeVisualization.spec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ import { computedContent } from './css'
55
import { expect } from './customExpect'
66
import { CONTROL_KEY } from './keyboard'
77
import * as locate from './locate'
8+
import { mockExpressionUpdate } from './expressionUpdates'
89

910
test('Node can open and load visualization', async ({ page }) => {
1011
await actions.goToGraph(page)
11-
const node = locate.graphNode(page).last()
12+
const node = locate.graphNodeByBinding(page, 'final')
1213
await node.click({ position: { x: 8, y: 8 } })
1314
await expect(locate.componentMenu(page)).toExist()
1415
await locate.toggleVisualizationButton(page).click()
@@ -24,6 +25,12 @@ test('Node can open and load visualization', async ({ page }) => {
2425
const textContent = await computedContent(element)
2526
const jsonContent = JSON.parse(textContent)
2627
expect(typeof jsonContent).toBe('object')
28+
const nodeType = await locate.visualisationNodeType(page)
29+
await expect(nodeType).toHaveText('Unknown')
30+
await mockExpressionUpdate(page, 'final', { type: ['Standard.Table.Table.Table'] })
31+
await expect(nodeType).toHaveText('Table')
32+
await mockExpressionUpdate(page, 'final', { type: ['Standard.Table.Table.DifferentType'] })
33+
await expect(nodeType).toHaveText('DifferentType')
2734
})
2835

2936
test('Previewing visualization', async ({ page }) => {

app/gui/integration-test/project-view/locate.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ export const geoMapVisualization = visualizationLocator('.GeoMapVisualization')
154154
export const imageBase64Visualization = visualizationLocator('.ImageBase64Visualization')
155155
export const warningsVisualization = visualizationLocator('.WarningsVisualization')
156156

157+
export function visualisationNodeType(page: Page) {
158+
return page.getByTestId('visualisationNodeType')
159+
}
160+
157161
// === Edge locators ===
158162

159163
/** All edges going from a node with given binding. */

app/gui/src/project-view/components/GraphEditor/GraphVisualization/VisualizationToolbar.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ useEvent(window, 'pointerup', (e) => interaction.handlePointerEvent(e, 'pointeru
107107
class="after-toolbars node-type"
108108
:title="props.typename ?? UNKNOWN_TYPE"
109109
v-text="nodeShortType"
110+
data-testid="visualisationNodeType"
110111
/>
111112
</div>
112113
</template>

app/gui/src/project-view/stores/project/computedValueRegistry.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ function updateInfo(
8282
if (newInfo.rawTypename !== info.rawTypename) info.rawTypename = newInfo.rawTypename
8383
if (newInfo.methodCall !== info.methodCall) info.methodCall = newInfo.methodCall
8484
if (newInfo.payload !== info.payload) info.payload = newInfo.payload
85-
if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = update.profilingInfo
86-
// Ensure new fields can't be added to `ExpressionInfo` without this code being updated.
87-
const _allFieldsHandled = {
88-
typename,
89-
rawTypename,
90-
methodCall,
91-
payload,
92-
profilingInfo,
93-
} satisfies ExpressionInfo
85+
if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = newInfo.profilingInfo
86+
// Ensure new fields can't be added to `ExpressionInfo` without this code being updated.
87+
const _allFieldsHandled = {
88+
typename: newInfo.typename,
89+
rawTypename: newInfo.rawTypename,
90+
methodCall: newInfo.methodCall,
91+
payload: newInfo.payload,
92+
profilingInfo: newInfo.profilingInfo
93+
} satisfies ExpressionInfo;
9494
}
9595

9696
/**

0 commit comments

Comments
 (0)