mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 23:46:28 +08:00
test: Fix test case
This commit is contained in:
parent
1cad665d15
commit
f3a26d170f
@ -110,33 +110,37 @@ describe('Tag', () => {
|
||||
|
||||
describe('visibility', () => {
|
||||
it('can be controlled by visible with visible as initial value', () => {
|
||||
const { asFragment, rerender } = render(<Tag visible />);
|
||||
expect(asFragment().firstChild).toMatchSnapshot();
|
||||
const { container, rerender } = render(<Tag visible />);
|
||||
expect(container.querySelector('.ant-tag-hidden')).toBeFalsy();
|
||||
|
||||
rerender(<Tag visible={false} />);
|
||||
act(() => {
|
||||
jest.runAllTimers();
|
||||
});
|
||||
expect(asFragment().firstChild).toMatchSnapshot();
|
||||
expect(container.querySelector('.ant-tag-hidden')).toBeTruthy();
|
||||
|
||||
rerender(<Tag visible />);
|
||||
act(() => {
|
||||
jest.runAllTimers();
|
||||
});
|
||||
expect(asFragment().firstChild).toMatchSnapshot();
|
||||
expect(container.querySelector('.ant-tag-hidden')).toBeFalsy();
|
||||
});
|
||||
|
||||
it('can be controlled by visible with hidden as initial value', () => {
|
||||
const { asFragment, rerender } = render(<Tag visible={false} />);
|
||||
expect(asFragment().firstChild).toMatchSnapshot();
|
||||
const { container, rerender } = render(<Tag visible={false} />);
|
||||
expect(container.querySelector('.ant-tag-hidden')).toBeTruthy();
|
||||
|
||||
rerender(<Tag visible />);
|
||||
act(() => {
|
||||
jest.runAllTimers();
|
||||
});
|
||||
expect(asFragment().firstChild).toMatchSnapshot();
|
||||
expect(container.querySelector('.ant-tag-hidden')).toBeFalsy();
|
||||
|
||||
rerender(<Tag visible={false} />);
|
||||
act(() => {
|
||||
jest.runAllTimers();
|
||||
});
|
||||
expect(asFragment().firstChild).toMatchSnapshot();
|
||||
expect(container.querySelector('.ant-tag-hidden')).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user