Skip to content

Commit

Permalink
Code Review feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
AdRiley committed Mar 6, 2025
1 parent a215b55 commit d248e32
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import { computedContent } from './css'
import { expect } from './customExpect'
import { CONTROL_KEY } from './keyboard'
import * as locate from './locate'
import { mockExpressionUpdate } from './expressionUpdates'

test('Node can open and load visualization', async ({ page }) => {
await actions.goToGraph(page)
const node = locate.graphNode(page).last()
const node = locate.graphNodeByBinding(page, 'final')
await node.click({ position: { x: 8, y: 8 } })
await expect(locate.componentMenu(page)).toExist()
await locate.toggleVisualizationButton(page).click()
Expand All @@ -24,6 +25,12 @@ test('Node can open and load visualization', async ({ page }) => {
const textContent = await computedContent(element)
const jsonContent = JSON.parse(textContent)
expect(typeof jsonContent).toBe('object')
const nodeType = await locate.visualisationNodeType(page)
await expect(nodeType).toHaveText('Unknown')
await mockExpressionUpdate(page, 'final', { type: ['Standard.Table.Table.Table'] })
await expect(nodeType).toHaveText('Table')
await mockExpressionUpdate(page, 'final', { type: ['Standard.Table.Table.DifferentType'] })
await expect(nodeType).toHaveText('DifferentType')
})

test('Previewing visualization', async ({ page }) => {
Expand Down
4 changes: 4 additions & 0 deletions app/gui/integration-test/project-view/locate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ export const geoMapVisualization = visualizationLocator('.GeoMapVisualization')
export const imageBase64Visualization = visualizationLocator('.ImageBase64Visualization')
export const warningsVisualization = visualizationLocator('.WarningsVisualization')

export function visualisationNodeType(page: Page) {
return page.getByTestId('visualisationNodeType')
}

// === Edge locators ===

/** All edges going from a node with given binding. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ useEvent(window, 'pointerup', (e) => interaction.handlePointerEvent(e, 'pointeru
class="after-toolbars node-type"
:title="props.typename ?? UNKNOWN_TYPE"
v-text="nodeShortType"
data-testid="visualisationNodeType"
/>
</div>
</template>
Expand Down
18 changes: 9 additions & 9 deletions app/gui/src/project-view/stores/project/computedValueRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,15 @@ function updateInfo(
if (newInfo.rawTypename !== info.rawTypename) info.rawTypename = newInfo.rawTypename
if (newInfo.methodCall !== info.methodCall) info.methodCall = newInfo.methodCall
if (newInfo.payload !== info.payload) info.payload = newInfo.payload
if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = update.profilingInfo
// Ensure new fields can't be added to `ExpressionInfo` without this code being updated.
const _allFieldsHandled = {
typename,
rawTypename,
methodCall,
payload,
profilingInfo,
} satisfies ExpressionInfo
if (newInfo.profilingInfo !== info.profilingInfo) info.profilingInfo = newInfo.profilingInfo
// Ensure new fields can't be added to `ExpressionInfo` without this code being updated.
const _allFieldsHandled = {
typename: newInfo.typename,
rawTypename: newInfo.rawTypename,
methodCall: newInfo.methodCall,
payload: newInfo.payload,
profilingInfo: newInfo.profilingInfo
} satisfies ExpressionInfo;
}

/**
Expand Down

0 comments on commit d248e32

Please sign in to comment.