You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
import { mount } from '@vue/test-utils';
|
|
import Checkbox from '..';
|
|
import focusTest from '../../../tests/shared/focusTest';
|
|
import { resetWarned } from '../../_util/warning';
|
|
import mountTest from '../../../tests/shared/mountTest';
|
|
|
|
describe('Checkbox', () => {
|
|
focusTest(Checkbox);
|
|
mountTest(Checkbox);
|
|
it('responses hover events', () => {
|
|
const onMouseEnter = jest.fn();
|
|
const onMouseLeave = jest.fn();
|
|
|
|
const wrapper = mount(Checkbox, {
|
|
listeners: {
|
|
mouseenter: onMouseEnter,
|
|
mouseleave: onMouseLeave,
|
|
},
|
|
});
|
|
|
|
wrapper.trigger('mouseenter');
|
|
expect(onMouseEnter).toHaveBeenCalled();
|
|
|
|
wrapper.trigger('mouseleave');
|
|
expect(onMouseLeave).toHaveBeenCalled();
|
|
});
|
|
it('warning if set `value`', () => {
|
|
resetWarned();
|
|
|
|
const errorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
mount(Checkbox, {
|
|
propsData: {
|
|
value: 'xxx',
|
|
},
|
|
});
|
|
expect(errorSpy).toHaveBeenCalledWith(
|
|
'Warning: [antdv: Checkbox] `value` is not validate prop, do you mean `checked`?',
|
|
);
|
|
errorSpy.mockRestore();
|
|
});
|
|
});
|