mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-30 12:28:33 +08:00
27 lines
590 B
JavaScript
27 lines
590 B
JavaScript
|
import React from 'react';
|
||
|
import { mount } from 'enzyme';
|
||
|
import useSyncState from '../hooks/useSyncState';
|
||
|
|
||
|
describe('Table', () => {
|
||
|
it('useSyncState', () => {
|
||
|
const Test = () => {
|
||
|
const [getVal, setVal] = useSyncState('light');
|
||
|
|
||
|
return (
|
||
|
<span
|
||
|
onClick={() => {
|
||
|
setVal('bamboo');
|
||
|
}}
|
||
|
>
|
||
|
{getVal()}
|
||
|
</span>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
const wrapper = mount(<Test />);
|
||
|
expect(wrapper.text()).toEqual('light');
|
||
|
wrapper.find('span').simulate('click');
|
||
|
expect(wrapper.text()).toEqual('bamboo');
|
||
|
});
|
||
|
});
|