Skip to content

Commit

Permalink
Add test for focus method
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardHelm committed Feb 18, 2025
1 parent f8325be commit 0f60790
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -625,4 +625,19 @@ describe('vwc-inline-time-picker', () => {
});
});
});

describe('focus method', () => {
it('should focus the first picker programmatically to avoid visual focus', async () => {
const firstPicker = element.shadowRoot!.querySelector(
'#hours'
) as HTMLElement;
const focusSpy = vi.spyOn(firstPicker, 'focus');
const options = {};

element.focus(options);

expect(element.shadowRoot!.activeElement).toBe(firstPicker);
expect(focusSpy).toHaveBeenCalledWith(options);
});
});
});

0 comments on commit 0f60790

Please sign in to comment.