// @ts-ignore import { configure, shallow } from 'enzyme'; // @ts-ignore import Adapter from 'enzyme-adapter-react-16'; import * as React from 'react'; import { Text, View } from 'react-native'; import renderer from 'react-test-renderer'; import MDCellItem from '../index'; configure({ adapter: new Adapter() }); it('renders correctly with defaults', () => { const component = renderer.create().toJSON(); expect(component).toMatchSnapshot(); }); it('test press event', () => { const mockCallBack = jest.fn(); const cellItem = shallow(); cellItem.find('TouchableWithoutFeedback').simulate('press'); expect(mockCallBack.mock.calls.length).toEqual(1); }); it('test disabled press event', () => { const mockCallBack = jest.fn(); const cellItem = shallow( ); cellItem.find('TouchableWithoutFeedback').simulate('press'); expect(mockCallBack.mock.calls.length).toEqual(0); }); it('renders correctly with "title"', () => { const component = renderer .create( { console.log('press'); }} /> ) .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with "arrow" and "disable"', () => { const component = renderer .create() .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with "brief" and "addon"', () => { const component = renderer .create( ) .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with solt', () => { const component = renderer .create( } left={ } below={ 面向金融场景的Vue移动端UI组件库,丰富、灵活、实用,快速搭建优质的金融类产品,让复杂的金融场景变简单。基于「合理、好用」设计价值观,从交互操作、视觉抽象、图形可视等角度共同解决问题。 } /> ) .toJSON(); expect(component).toMatchSnapshot(); }); it('renders correctly with "children"', () => { const component = renderer .create( 信用付 ) .toJSON(); expect(component).toMatchSnapshot(); }); it('rendering fails when sytles is null', () => { // @ts-ignore const component = renderer.create().toJSON(); expect(component).toMatchSnapshot(); });