UNPKG

react-native-timer-picker

Version:

A simple, flexible, performant duration picker for React Native apps 🔥 Great for timers, alarms and duration inputs ⏰🕰️⏳ Includes iOS-style haptic and audio feedback 🍏

66 lines 2.04 kB
import React from "react"; import { render } from "@testing-library/react-native"; import DurationScroll from "../components/DurationScroll"; describe("DurationScroll", () => { const onDurationChangeMock = jest.fn(); const emptyStyles = { pickerContainer: {}, pickerLabelContainer: {}, pickerLabel: {}, pickerItemContainer: {}, pickerItem: {}, pickerAmPmContainer: {}, pickerAmPmLabel: {}, disabledPickerContainer: {}, disabledPickerItem: {}, pickerGradientOverlay: {} }; it("renders without crashing", () => { const { getByTestId } = render(/*#__PURE__*/React.createElement(DurationScroll, { aggressivelyGetLatestDuration: false, interval: 1, maximumValue: 1, onDurationChange: onDurationChangeMock, padWithNItems: 0, repeatNumbersNTimesNotExplicitlySet: true, styles: emptyStyles, testID: "duration-scroll" })); const component = getByTestId("duration-scroll"); expect(component).toBeDefined(); }); it("renders the correct number of items", () => { const { getAllByTestId } = render(/*#__PURE__*/React.createElement(DurationScroll, { aggressivelyGetLatestDuration: false, interval: 1, maximumValue: 23, onDurationChange: onDurationChangeMock, padWithNItems: 1, repeatNumbersNTimesNotExplicitlySet: true, styles: emptyStyles })); const items = getAllByTestId("picker-item"); expect(items).toHaveLength(10); }); it("renders the label if provided", () => { const { getByText } = render(/*#__PURE__*/React.createElement(DurationScroll, { aggressivelyGetLatestDuration: false, interval: 1, label: "Duration", maximumValue: 59, onDurationChange: onDurationChangeMock, padWithNItems: 1, repeatNumbersNTimesNotExplicitlySet: true, styles: emptyStyles })); const label = getByText("Duration"); expect(label).toBeDefined(); }); }); //# sourceMappingURL=DurationScroll.test.js.map