This commit is contained in:
Wei Zhu 2018-02-02 14:50:55 +08:00
parent aa88c656f1
commit 980b2cc32b

View File

@ -2,6 +2,8 @@ import React from 'react';
import { mount, render } from 'enzyme';
import moment from 'moment';
import DatePicker from '../';
import UnwrappedRangePicker from '../RangePicker';
import locale from '../locale/en_US';
import { setMockDate, resetMockDate } from '../../../tests/utils';
import focusTest from '../../../tests/shared/focusTest';
@ -133,4 +135,22 @@ describe('RangePicker', () => {
).toBe(true);
resetMockDate();
});
it('clear hover value only when picker is open', () => {
const wrapper = mount(
<UnwrappedRangePicker
locale={locale}
onChange={() => {}}
ranges={{ Today: [moment(), moment()] }}
/>
);
wrapper.find('.ant-calendar-range-picker-input').first().simulate('click');
wrapper.find('.ant-calendar-range-quick-selector a')
.simulate('mouseEnter')
.simulate('click')
.simulate('mouseLeave');
expect(wrapper.state().hoverValue).not.toBe(null);
});
});