Skip to content

Commit

Permalink
fix: when fullscreen is false, the element returned by dateFullCellRe…
Browse files Browse the repository at this point in the history
…nder cannot be interactive (ant-design#34614)

* fix: when fullscreen is false, the element returned by dateFullCellRender cannot be interactive

* test: add test for Calendar
  • Loading branch information
madocto committed Mar 21, 2022
1 parent 232e236 commit 4debb88
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
16 changes: 16 additions & 0 deletions components/calendar/__tests__/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -403,4 +403,20 @@ describe('Calendar', () => {
);
expect(wrapper.find('.bamboo').first().text()).toEqual('Light');
});

it('when fullscreen is false, the element returned by dateFullCellRender should be interactive', () => {
const onClick = jest.fn();
const wrapper = mount(
<Calendar
fullscreen={false}
dateFullCellRender={() => (
<div className="bamboo" onClick={onClick}>
Light
</div>
)}
/>,
);
wrapper.find('.bamboo').first().simulate('click');
expect(onClick).toBeCalled();
});
});
4 changes: 4 additions & 0 deletions components/calendar/style/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
line-height: 18px;
}
}

.@{calendar-picker-prefix-cls}-cell::before {
pointer-events: none;
}
}

// ========================== Full ==========================
Expand Down

0 comments on commit 4debb88

Please sign in to comment.