ant-design-vue/components/slider/__tests__/index.test.js

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-01-12 03:33:27 +00:00
import { mount } from '@vue/test-utils';
import { asyncExpect } from '@/tests/utils';
import Slider from '..';
describe('Slider', () => {
it('should show tooltip when hovering slider handler', async () => {
const wrapper = mount(Slider, {
propsData: {
defaultValue: 30,
},
sync: false,
2019-01-12 03:33:27 +00:00
});
await asyncExpect(() => {
2019-01-12 03:33:27 +00:00
wrapper
.findAll('.ant-slider-handle')
.at(0)
.trigger('mouseenter');
});
let dropdownWrapper = null;
await asyncExpect(() => {
2019-01-12 03:33:27 +00:00
dropdownWrapper = mount(
{
render() {
return wrapper.find({ name: 'Trigger' }).vm.getComponent();
},
},
2019-01-12 03:33:27 +00:00
{ sync: false },
);
});
await asyncExpect(() => {
2019-01-12 03:33:27 +00:00
expect(dropdownWrapper.html()).toMatchSnapshot();
wrapper
.findAll('.ant-slider-handle')
.at(0)
.trigger('mouseleave');
});
await asyncExpect(() => {
2019-01-12 03:33:27 +00:00
dropdownWrapper = mount(
{
render() {
return wrapper.find({ name: 'Trigger' }).vm.getComponent();
},
},
2019-01-12 03:33:27 +00:00
{ sync: false },
);
});
await asyncExpect(() => {
2019-01-12 03:33:27 +00:00
expect(dropdownWrapper.html()).toMatchSnapshot();
});
});
});