mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 23:35:38 +08:00
dd31d7775a
* test: migrate part of utils tests * test: migrate part of utils tests * test: migrate part of utils tests
18 lines
609 B
TypeScript
18 lines
609 B
TypeScript
import React from 'react';
|
|
import useSyncState from '../hooks/useSyncState';
|
|
import { render, fireEvent } from '../../../tests/utils';
|
|
|
|
describe('Table', () => {
|
|
it('useSyncState', () => {
|
|
const Test: React.FC = () => {
|
|
const [getVal, setVal] = useSyncState('light');
|
|
return <span onClick={() => setVal('bamboo')}>{getVal()}</span>;
|
|
};
|
|
|
|
const { container } = render(<Test />);
|
|
expect(container.querySelector('span')?.innerHTML).toBe('light');
|
|
fireEvent.click(container.querySelector('span')!);
|
|
expect(container.querySelector('span')?.innerHTML).toBe('bamboo');
|
|
});
|
|
});
|