Skip to content

Commit c6fb7d1

Browse files
committed
test: add regression test for clearing stale handler highlight
Verify that clicking a step with no service calls clears the previously highlighted handler in the reference panel.
1 parent 7934697 commit c6fb7d1

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

frontend/src/features/cookbook/components/linked-detail.test.tsx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,24 @@ describe('LinkedPatternDetail', () => {
252252
expect(mockDispatch).toHaveBeenCalled()
253253
})
254254

255+
it('clears highlighted handler when clicked step has no service calls', () => {
256+
const flowWithNoop: SagaFlow = {
257+
...sampleFlow,
258+
steps: [
259+
...sampleFlow.steps,
260+
{ name: 'noop', lineNumber: 20, serviceCalls: [], earlyExit: null },
261+
],
262+
}
263+
264+
render(<LinkedPatternDetail flow={flowWithNoop} starlarkContent={sampleStarlark} />)
265+
266+
fireEvent.click(screen.getByTestId('flow-node-step-0'))
267+
expect(screen.getByTestId('handler-reference').dataset.highlighted).toBe('position_keeping.initiate_log')
268+
269+
fireEvent.click(screen.getByTestId('flow-node-step-2'))
270+
expect(screen.getByTestId('handler-reference').dataset.highlighted).toBe('')
271+
})
272+
255273
it('renders without crashing when flow has no steps', () => {
256274
const emptyFlow: SagaFlow = {
257275
name: 'empty-saga',

0 commit comments

Comments
 (0)