ant-design/components/table/__tests__/Table.hooks.test.js
二货机器人 6d685c7e8a
fix: Table customize filter update (#21218)
* fix: useSyncState logic

* add test case
2020-02-04 17:30:41 +08:00

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');
});
});