mirror of
https://gitee.com/ant-design-vue/ant-design-vue.git
synced 2024-12-14 17:01:19 +08:00
6f903c3a75
* feat: update switch * fix: avoid bind attrs to root * test: update switch * docs: update switch breakchange * style: remove unused import Co-authored-by: tangjinzhou <415800467@qq.com>
29 lines
908 B
JavaScript
29 lines
908 B
JavaScript
import Switch from '..';
|
|
import { mount } from '@vue/test-utils';
|
|
import focusTest from '../../../tests/shared/focusTest';
|
|
import { resetWarned } from '../../_util/warning';
|
|
import mountTest from '../../../tests/shared/mountTest';
|
|
|
|
describe('Switch', () => {
|
|
focusTest(Switch);
|
|
mountTest(Switch);
|
|
|
|
it('should has click wave effect', async () => {
|
|
const wrapper = mount(Switch);
|
|
wrapper.find('.ant-switch').trigger('click');
|
|
await new Promise(resolve => setTimeout(resolve, 0));
|
|
expect(wrapper.html()).toMatchSnapshot();
|
|
});
|
|
|
|
it('warning if set `value`', () => {
|
|
resetWarned();
|
|
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
mount(Switch, { props: { value: '' } });
|
|
expect(errorSpy).toHaveBeenCalledWith(
|
|
'Warning: [antdv: Switch] `value` is not validate prop, do you mean `checked`?',
|
|
);
|
|
errorSpy.mockRestore();
|
|
});
|
|
});
|