import * as React from 'react';
import renderer from 'react-test-renderer';
import { fireEvent, render } from '@testing-library/react-native';
// import { Plus } from '@pingtou/rn-vant-icons';
import snapshotTest from '../../tests/shared/snapshotTest';
import { Button } from '../index';
describe('Button', () => {
snapshotTest('render text button by default', () => );
snapshotTest('render primary button width type', () => (
));
snapshotTest('render success button width type', () => (
));
snapshotTest('render warning button width type', () => (
));
snapshotTest('render danger button width type', () => (
));
snapshotTest('render primary button in plain', () => (
));
snapshotTest('render success button in plain', () => (
));
snapshotTest('render button width loading', () => );
snapshotTest('render button width spinner loading', () => (
));
snapshotTest('render square button', () => (
));
snapshotTest('render round button', () => (
));
// snapshotTest('render button width icon', () => (
// } type="primary">
// 按钮
//
// ));
snapshotTest('render button width large size', () => (
));
snapshotTest('render button width normal size', () => (
));
snapshotTest('render button width small size', () => (
));
snapshotTest('render button width mini size', () => (
));
snapshotTest('render button width custom color', () => );
it('render button with custom testID', () => {
const tree = renderer
.create()
.toJSON();
expect(tree).toMatchSnapshot();
});
it('should execute onPressIn', () => {
const onPressInMock = jest.fn();
const onPress = jest.fn();
const { getByTestId } = render(
);
fireEvent(getByTestId('button'), 'onPressIn');
expect(onPressInMock).toHaveBeenCalledTimes(1);
});
it('should execute onPressOut', () => {
const onPressOutMock = jest.fn();
const onPress = jest.fn();
const { getByTestId } = render(
);
fireEvent(getByTestId('button'), 'onPressOut');
expect(onPressOutMock).toHaveBeenCalledTimes(1);
});
});