mirror of
https://github.com/ant-design/ant-design.git
synced 2026-02-09 02:49:18 +08:00
✅ Add test case for wave
This commit is contained in:
@@ -6,6 +6,9 @@ let styleForPesudo: HTMLStyleElement | null;
|
||||
|
||||
// Where el is the DOM element you'd like to test for visibility
|
||||
function isHidden(element: HTMLElement) {
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
return false;
|
||||
}
|
||||
return !element || element.offsetParent === null;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,6 +189,18 @@ exports[`Button renders correctly 1`] = `
|
||||
</button>
|
||||
`;
|
||||
|
||||
exports[`Button should has click wave effect 1`] = `
|
||||
<button
|
||||
ant-click-animating-without-extra-node="true"
|
||||
class="ant-btn ant-btn-primary"
|
||||
type="button"
|
||||
>
|
||||
<span>
|
||||
button
|
||||
</span>
|
||||
</button>
|
||||
`;
|
||||
|
||||
exports[`Button should support link button 1`] = `
|
||||
<a
|
||||
class="ant-btn"
|
||||
|
||||
@@ -143,4 +143,13 @@ describe('Button', () => {
|
||||
);
|
||||
expect(wrapper2).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should has click wave effect', async () => {
|
||||
const wrapper = mount(
|
||||
<Button type="primary">button</Button>
|
||||
);
|
||||
wrapper.find('.ant-btn').getDOMNode().click();
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
19
components/switch/__tests__/__snapshots__/index.test.js.snap
Normal file
19
components/switch/__tests__/__snapshots__/index.test.js.snap
Normal file
@@ -0,0 +1,19 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`Switch should has click wave effect 1`] = `
|
||||
<button
|
||||
ant-click-animating="true"
|
||||
aria-checked="false"
|
||||
class="ant-switch"
|
||||
role="switch"
|
||||
type="button"
|
||||
>
|
||||
<span
|
||||
class="ant-switch-inner"
|
||||
/>
|
||||
<div
|
||||
class="ant-click-animating-node"
|
||||
style="border-color: buttonface;"
|
||||
/>
|
||||
</button>
|
||||
`;
|
||||
@@ -1,6 +1,15 @@
|
||||
import React from 'react';
|
||||
import Switch from '..';
|
||||
import { mount } from 'enzyme';
|
||||
import focusTest from '../../../tests/shared/focusTest';
|
||||
|
||||
describe('Switch', () => {
|
||||
focusTest(Switch);
|
||||
|
||||
it('should has click wave effect', async () => {
|
||||
const wrapper = mount(<Switch />);
|
||||
wrapper.find('.ant-switch').getDOMNode().click();
|
||||
await new Promise(resolve => setTimeout(resolve, 0));
|
||||
expect(wrapper.render()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user