"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
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 theme_1 = tslib_1.__importDefault(require("../../../theme"));
const index_1 = tslib_1.__importDefault(require("../index"));
const onPressEvent = jest.fn();
describe('<ToggleButton />', () => {
    beforeEach(() => {
        jest.resetAllMocks();
    });
    it('should render toggle component', () => {
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <index_1.default value={true} onValueChange={() => { }}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should trigger onValueChange function when toggle is pressed', () => {
        const testId = 'toggle_button';
        const { getByTestId } = (0, react_native_testing_library_1.render)(<native_1.ThemeProvider theme={theme_1.default}>
        <index_1.default id={testId} value={false} onValueChange={onPressEvent}/>
      </native_1.ThemeProvider>);
        const component = getByTestId(testId);
        (0, react_native_testing_library_1.fireEvent)(component, 'onValueChange', true);
        expect(onPressEvent).toHaveBeenCalledTimes(1);
    });
    it('should render component with custom thumb color', () => {
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <index_1.default value={true} onValueChange={() => { }} thumbColor={{ trueColor: 'red', falseColor: 'blue' }}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render component with custom track color', () => {
        const wrapper = react_test_renderer_1.default.create(<native_1.ThemeProvider theme={theme_1.default}>
        <index_1.default value={true} onValueChange={() => { }} trackColor={{ trueColor: 'red', falseColor: 'blue' }}/>
      </native_1.ThemeProvider>);
        expect(wrapper.toJSON()).toMatchSnapshot();
    });
    it('should render component disabled if disable prop is passed', () => {
        const testId = 'toggle_button';
        const { getByTestId } = (0, react_native_testing_library_1.render)(<native_1.ThemeProvider theme={theme_1.default}>
        <index_1.default id={testId} value={true} onValueChange={() => { }} isDisabled/>
      </native_1.ThemeProvider>);
        const component = getByTestId(testId);
        expect(component).toHaveProperty(['_fiber', 'memoizedProps', 'disabled'], true);
    });
});
//# sourceMappingURL=Toggle.test.js.map