diff --git a/components/date-picker/RangePicker.tsx b/components/date-picker/RangePicker.tsx index b9bebcc887..111fe4bee9 100644 --- a/components/date-picker/RangePicker.tsx +++ b/components/date-picker/RangePicker.tsx @@ -5,6 +5,7 @@ import RangeCalendar from 'rc-calendar/lib/RangeCalendar'; import RcDatePicker from 'rc-calendar/lib/Picker'; import classNames from 'classnames'; import Icon from '../icon'; +import Tag from '../tag'; import warning from '../_util/warning'; import interopDefault from '../_util/interopDefault'; import { RangePickerValue, RangePickerPresetRange } from './interface'; @@ -211,14 +212,15 @@ export default class RangePicker extends React.Component const operations = Object.keys(ranges || {}).map((range) => { const value = ranges[range]; return ( - this.handleRangeClick(value)} onMouseEnter={() => this.setState({ hoverValue: value })} onMouseLeave={this.handleRangeMouseLeave} > {range} - + ); }); const rangeNode = ( diff --git a/components/date-picker/__tests__/RangePicker.test.js b/components/date-picker/__tests__/RangePicker.test.js index 0678230a71..c26114c284 100644 --- a/components/date-picker/__tests__/RangePicker.test.js +++ b/components/date-picker/__tests__/RangePicker.test.js @@ -50,7 +50,7 @@ describe('RangePicker', () => { ); const rangeCalendarWrapper = mount(wrapper.find('Trigger').instance().getComponent()); - rangeCalendarWrapper.find('.ant-calendar-range-quick-selector a') + rangeCalendarWrapper.find('.ant-calendar-range-quick-selector Tag') .simulate('click'); expect(render(wrapper.find('Trigger').instance().getComponent())) .toMatchSnapshot(); @@ -69,7 +69,7 @@ describe('RangePicker', () => { ); let rangeCalendarWrapper = mount(wrapper.find('Trigger').instance().getComponent()); - rangeCalendarWrapper.find('.ant-calendar-range-quick-selector a') + rangeCalendarWrapper.find('.ant-calendar-range-quick-selector Tag') .simulate('mouseEnter'); rangeCalendarWrapper = mount(wrapper.find('Trigger').instance().getComponent()); expect(rangeCalendarWrapper.find('.ant-calendar-selected-day').length).toBe(2); @@ -152,7 +152,7 @@ describe('RangePicker', () => { /> ); wrapper.find('.ant-calendar-picker-input').simulate('click'); - wrapper.find('.ant-calendar-range-quick-selector a').simulate('click'); + wrapper.find('.ant-calendar-range-quick-selector Tag').simulate('click'); expect( wrapper.find('.ant-calendar-range-picker-input').first().getDOMNode().value ).toBe(range[0].format(format)); @@ -171,7 +171,7 @@ describe('RangePicker', () => { /> ); wrapper.find('.ant-calendar-picker-input').simulate('click'); - wrapper.find('.ant-calendar-range-quick-selector a').simulate('click'); + wrapper.find('.ant-calendar-range-quick-selector Tag').simulate('click'); expect( wrapper.find('.ant-calendar-range-picker-input').first().getDOMNode().value ).toBe(range[0].format(format)); @@ -200,7 +200,7 @@ describe('RangePicker', () => { /> ); wrapper.find('.ant-calendar-picker-input').simulate('click'); - wrapper.find('.ant-calendar-range-quick-selector a').simulate('click'); + wrapper.find('.ant-calendar-range-quick-selector Tag').simulate('click'); expect(handleOk).toBeCalledWith(range); }); diff --git a/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap b/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap index 0f1af11395..ba622d9acf 100644 --- a/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap +++ b/components/date-picker/__tests__/__snapshots__/RangePicker.test.js.snap @@ -2990,9 +2990,12 @@ exports[`RangePicker switch to corresponding month panel when click presetted ra