Skip to content

Commit f1c6da0

Browse files
test: add coverage for outsideClickIgnoreClass undefined fallback
Adds test case to cover the scenario where outsideClickIgnoreClass is explicitly set to undefined, ensuring the fallback to default props is properly tested and improves test coverage for line 1327 in index.tsx. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent b1150b1 commit f1c6da0

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/test/datepicker_test.test.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,15 @@ describe("DatePicker", () => {
711711
expect(input?.classList.contains(outsideClickIgnoreClass)).toBe(true);
712712
});
713713

714+
it("should apply the default outsideClickIgnoreClass when prop is undefined", () => {
715+
const { container } = render(
716+
<DatePicker outsideClickIgnoreClass={undefined} />,
717+
);
718+
const input = safeQuerySelector<HTMLInputElement>(container, "input");
719+
fireEvent.focus(input);
720+
expect(input?.classList.contains(OUTSIDE_CLICK_IGNORE_CLASS)).toBe(true);
721+
});
722+
714723
it("should toggle the open status of calendar on click of the icon when toggleCalendarOnIconClick is set to true", () => {
715724
const { container } = render(
716725
<DatePicker

0 commit comments

Comments
 (0)