2019-01-12 03:33:27 +00:00
|
|
|
import { mount } from '@vue/test-utils';
|
|
|
|
import { asyncExpect } from '@/tests/utils';
|
|
|
|
import Slider from '..';
|
2020-03-07 11:45:13 +00:00
|
|
|
import mountTest from '../../../tests/shared/mountTest';
|
2018-06-06 02:48:15 +00:00
|
|
|
|
|
|
|
describe('Slider', () => {
|
2020-03-07 11:45:13 +00:00
|
|
|
mountTest(Slider);
|
2018-06-06 02:48:15 +00:00
|
|
|
it('should show tooltip when hovering slider handler', async () => {
|
|
|
|
const wrapper = mount(Slider, {
|
2020-07-25 07:46:49 +00:00
|
|
|
props: {
|
2018-06-06 02:48:15 +00:00
|
|
|
defaultValue: 30,
|
|
|
|
},
|
|
|
|
sync: false,
|
2019-01-12 03:33:27 +00:00
|
|
|
});
|
2018-06-06 02:48:15 +00:00
|
|
|
await asyncExpect(() => {
|
2019-01-12 03:33:27 +00:00
|
|
|
wrapper
|
|
|
|
.findAll('.ant-slider-handle')
|
|
|
|
.at(0)
|
|
|
|
.trigger('mouseenter');
|
|
|
|
});
|
|
|
|
let dropdownWrapper = null;
|
2018-06-06 02:48:15 +00:00
|
|
|
await asyncExpect(() => {
|
2019-01-12 03:33:27 +00:00
|
|
|
dropdownWrapper = mount(
|
|
|
|
{
|
|
|
|
render() {
|
|
|
|
return wrapper.find({ name: 'Trigger' }).vm.getComponent();
|
|
|
|
},
|
2018-06-06 02:48:15 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
{ sync: false },
|
|
|
|
);
|
|
|
|
});
|
2018-06-06 02:48:15 +00:00
|
|
|
await asyncExpect(() => {
|
2019-01-12 03:33:27 +00:00
|
|
|
expect(dropdownWrapper.html()).toMatchSnapshot();
|
|
|
|
wrapper
|
|
|
|
.findAll('.ant-slider-handle')
|
|
|
|
.at(0)
|
|
|
|
.trigger('mouseleave');
|
|
|
|
});
|
2018-06-06 02:48:15 +00:00
|
|
|
await asyncExpect(() => {
|
2019-01-12 03:33:27 +00:00
|
|
|
dropdownWrapper = mount(
|
|
|
|
{
|
|
|
|
render() {
|
|
|
|
return wrapper.find({ name: 'Trigger' }).vm.getComponent();
|
|
|
|
},
|
2018-06-06 02:48:15 +00:00
|
|
|
},
|
2019-01-12 03:33:27 +00:00
|
|
|
{ sync: false },
|
|
|
|
);
|
|
|
|
});
|
2018-06-06 02:48:15 +00:00
|
|
|
await asyncExpect(() => {
|
2019-01-12 03:33:27 +00:00
|
|
|
expect(dropdownWrapper.html()).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|