Skip to content

Commit ff1f7f2

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
test(ui): cover floating compact code search
1 parent 0f50cbd commit ff1f7f2

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

‎apps/sim/app/workspace/[workspaceId]/components/code-search-overlay/code-search-overlay.test.tsx‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,28 @@ describe('CodeSearchOverlay', () => {
8585
expect(parentClick).not.toHaveBeenCalled()
8686
})
8787

88+
it('keeps preview search compact in a floating overlay with a usable input ref', () => {
89+
const { overlay, input } = renderOverlay({
90+
inputKind: 'plain',
91+
className: 'top-10 right-[8px]',
92+
})
93+
expect(overlay.getAttribute('role')).toBe('presentation')
94+
expect(overlay.className).toContain('top-10 right-[8px]')
95+
expect(overlay.hasAttribute('data-toolbar-root')).toBe(false)
96+
expect(input.parentElement?.className).toContain('h-[23px]')
97+
expect(inputRef.current).toBe(input)
98+
99+
const setter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')?.set
100+
act(() => {
101+
setter?.call(input, 'preview')
102+
input.dispatchEvent(new Event('input', { bubbles: true }))
103+
overlay.querySelector<HTMLButtonElement>('[aria-label="Next match"]')?.click()
104+
})
105+
expect(callbacks.onQueryChange).toHaveBeenCalledWith('preview')
106+
expect(callbacks.onNext).toHaveBeenCalledTimes(1)
107+
expect(parentClick).not.toHaveBeenCalled()
108+
})
109+
88110
it('retains the attached terminal edge, marker, wider tally, and disabled navigation', () => {
89111
const { overlay, input } = renderOverlay({
90112
appearance: 'attached',

0 commit comments

Comments
 (0)