"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
/* eslint-disable sonarjs/no-duplicate-string */
const react_1 = tslib_1.__importDefault(require("react"));
const react_native_testing_library_1 = require("react-native-testing-library");
const react_test_renderer_1 = tslib_1.__importDefault(require("react-test-renderer"));
const native_1 = require("styled-components/native");
const __1 = tslib_1.__importDefault(require(".."));
const theme_1 = tslib_1.__importDefault(require("../../../theme"));
const styles_1 = require("../styles");
describe('<PinInput />', () => {
    it('should render textinput', () => {
        const onChangeText = jest.fn();
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with password', () => {
        const onChangeText = jest.fn();
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} password {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with password and handle icon press', () => {
        const onChangeText = jest.fn();
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const { getByTestId, queryByTestId, rerender } = (0, react_native_testing_library_1.render)(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default accessibility="Exibir ou ocultar inputs - eye" onChangeText={onChangeText} password {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(queryByTestId('Exibir ou ocultar inputs - eye-slash')).toBeNull();
        expect(queryByTestId('Exibir ou ocultar inputs - eye')).toBeTruthy();
        react_native_testing_library_1.fireEvent.press(getByTestId('Exibir ou ocultar inputs - eye'));
        // Rerenderizar o componente para que as mudanças de estado sejam aplicadas
        rerender(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default accessibility="Exibir ou ocultar inputs - eye-slash" onChangeText={onChangeText} password {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(queryByTestId('Exibir ou ocultar inputs - eye-slash')).toBeTruthy();
        expect(queryByTestId('Exibir ou ocultar inputs - eye')).toBeNull();
    });
    it('should render textinput with animated', () => {
        const onChangeText = jest.fn();
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} animated {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with centered', () => {
        const onChangeText = jest.fn();
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} centered {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with contrast', () => {
        const onChangeText = jest.fn();
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} contrast {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with custom mask', () => {
        const onChangeText = jest.fn();
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} mask="(**) *****-****" {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with custom ful fill', () => {
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const onChange = jest.fn();
        const onChangeText = jest.fn();
        const wrapper = (0, react_native_testing_library_1.render)(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default testID="pinInput" id="test" accessibility="" onChangeText={onChangeText} onFulfill={onChange} {...defaultStyle}/>
      </native_1.ThemeProvider>);
        react_native_testing_library_1.fireEvent.changeText(wrapper.getByTestId('pinInput'), 'some value');
        // expect(onChange).toHaveBeenCalled();
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with custom code length', () => {
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const onChangeText = jest.fn();
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} codeLength={6} {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with custom caption', () => {
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const onChangeText = jest.fn();
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} caption="test" {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with custom error message', () => {
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const onChangeText = jest.fn();
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} error="testError" {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with error', () => {
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const onChangeText = jest.fn();
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} error {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render textinput with value', () => {
        const defaultStyle = (0, styles_1.defaultStyling)(theme_1.default);
        const onChangeText = jest.fn();
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <__1.default id="test" accessibility="" onChangeText={onChangeText} value="testing" {...defaultStyle}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
});
//# sourceMappingURL=PinInput.test.js.map