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

28 lines
809 B
JavaScript

import { mount } from '@vue/test-utils';
import { asyncExpect } from '@/tests/utils';
import Slider from '..';
import mountTest from '../../../tests/shared/mountTest';
describe('Slider', () => {
mountTest(Slider);
it('should show tooltip when hovering slider handler', async () => {
const wrapper = mount(Slider, {
props: {
defaultValue: 30,
},
sync: false,
attachTo: 'body',
});
await asyncExpect(() => {
wrapper.findAll('.ant-slider-handle')[0].trigger('mouseenter');
});
await asyncExpect(() => {
expect(document.body.innerHTML).toMatchSnapshot();
wrapper.findAll('.ant-slider-handle')[0].trigger('mouseleave');
}, 0);
await asyncExpect(() => {
expect(document.body.innerHTML).toMatchSnapshot();
}, 0);
});
});