react-native-timer-picker 2.4.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/README.md +35 -25
  2. package/package.json +143 -126
  3. package/dist/commonjs/components/DurationScroll/DurationScroll.js +0 -403
  4. package/dist/commonjs/components/DurationScroll/DurationScroll.js.map +0 -1
  5. package/dist/commonjs/components/DurationScroll/index.js +0 -27
  6. package/dist/commonjs/components/DurationScroll/index.js.map +0 -1
  7. package/dist/commonjs/components/DurationScroll/types.js +0 -6
  8. package/dist/commonjs/components/DurationScroll/types.js.map +0 -1
  9. package/dist/commonjs/components/Modal/Modal.js +0 -107
  10. package/dist/commonjs/components/Modal/Modal.js.map +0 -1
  11. package/dist/commonjs/components/Modal/index.js +0 -27
  12. package/dist/commonjs/components/Modal/index.js.map +0 -1
  13. package/dist/commonjs/components/Modal/styles.js +0 -25
  14. package/dist/commonjs/components/Modal/styles.js.map +0 -1
  15. package/dist/commonjs/components/Modal/types.js +0 -6
  16. package/dist/commonjs/components/Modal/types.js.map +0 -1
  17. package/dist/commonjs/components/PickerItem/PickerItem.js +0 -45
  18. package/dist/commonjs/components/PickerItem/PickerItem.js.map +0 -1
  19. package/dist/commonjs/components/PickerItem/index.js +0 -14
  20. package/dist/commonjs/components/PickerItem/index.js.map +0 -1
  21. package/dist/commonjs/components/TimerPicker/TimerPicker.js +0 -236
  22. package/dist/commonjs/components/TimerPicker/TimerPicker.js.map +0 -1
  23. package/dist/commonjs/components/TimerPicker/index.js +0 -39
  24. package/dist/commonjs/components/TimerPicker/index.js.map +0 -1
  25. package/dist/commonjs/components/TimerPicker/styles.js +0 -121
  26. package/dist/commonjs/components/TimerPicker/styles.js.map +0 -1
  27. package/dist/commonjs/components/TimerPicker/types.js +0 -6
  28. package/dist/commonjs/components/TimerPicker/types.js.map +0 -1
  29. package/dist/commonjs/components/TimerPickerModal/TimerPickerModal.js +0 -153
  30. package/dist/commonjs/components/TimerPickerModal/TimerPickerModal.js.map +0 -1
  31. package/dist/commonjs/components/TimerPickerModal/index.js +0 -39
  32. package/dist/commonjs/components/TimerPickerModal/index.js.map +0 -1
  33. package/dist/commonjs/components/TimerPickerModal/styles.js +0 -89
  34. package/dist/commonjs/components/TimerPickerModal/styles.js.map +0 -1
  35. package/dist/commonjs/components/TimerPickerModal/types.js +0 -6
  36. package/dist/commonjs/components/TimerPickerModal/types.js.map +0 -1
  37. package/dist/commonjs/index.js +0 -57
  38. package/dist/commonjs/index.js.map +0 -1
  39. package/dist/commonjs/tests/DurationScroll.test.js +0 -163
  40. package/dist/commonjs/tests/DurationScroll.test.js.map +0 -1
  41. package/dist/commonjs/tests/Modal.test.js +0 -119
  42. package/dist/commonjs/tests/Modal.test.js.map +0 -1
  43. package/dist/commonjs/tests/TimerPicker.test.js +0 -169
  44. package/dist/commonjs/tests/TimerPicker.test.js.map +0 -1
  45. package/dist/commonjs/tests/TimerPickerModal.test.js +0 -276
  46. package/dist/commonjs/tests/TimerPickerModal.test.js.map +0 -1
  47. package/dist/commonjs/tests/colorToRgba.test.js +0 -176
  48. package/dist/commonjs/tests/colorToRgba.test.js.map +0 -1
  49. package/dist/commonjs/tests/generateNumbers.test.js +0 -350
  50. package/dist/commonjs/tests/generateNumbers.test.js.map +0 -1
  51. package/dist/commonjs/tests/getAdjustedLimit.test.js +0 -324
  52. package/dist/commonjs/tests/getAdjustedLimit.test.js.map +0 -1
  53. package/dist/commonjs/tests/getDurationAndIndexFromScrollOffset.test.js +0 -424
  54. package/dist/commonjs/tests/getDurationAndIndexFromScrollOffset.test.js.map +0 -1
  55. package/dist/commonjs/tests/getInitialScrollIndex.test.js +0 -396
  56. package/dist/commonjs/tests/getInitialScrollIndex.test.js.map +0 -1
  57. package/dist/commonjs/tests/getSafeInitialValue.test.js +0 -497
  58. package/dist/commonjs/tests/getSafeInitialValue.test.js.map +0 -1
  59. package/dist/commonjs/tests/padNumber.test.js +0 -301
  60. package/dist/commonjs/tests/padNumber.test.js.map +0 -1
  61. package/dist/commonjs/utils/colorToRgba.js +0 -87
  62. package/dist/commonjs/utils/colorToRgba.js.map +0 -1
  63. package/dist/commonjs/utils/generateNumbers.js +0 -124
  64. package/dist/commonjs/utils/generateNumbers.js.map +0 -1
  65. package/dist/commonjs/utils/getAdjustedLimit.js +0 -58
  66. package/dist/commonjs/utils/getAdjustedLimit.js.map +0 -1
  67. package/dist/commonjs/utils/getDurationAndIndexFromScrollOffset.js +0 -62
  68. package/dist/commonjs/utils/getDurationAndIndexFromScrollOffset.js.map +0 -1
  69. package/dist/commonjs/utils/getInitialScrollIndex.js +0 -57
  70. package/dist/commonjs/utils/getInitialScrollIndex.js.map +0 -1
  71. package/dist/commonjs/utils/getSafeInitialValue.js +0 -41
  72. package/dist/commonjs/utils/getSafeInitialValue.js.map +0 -1
  73. package/dist/commonjs/utils/padNumber.js +0 -40
  74. package/dist/commonjs/utils/padNumber.js.map +0 -1
  75. package/dist/module/components/DurationScroll/DurationScroll.js +0 -395
  76. package/dist/module/components/DurationScroll/DurationScroll.js.map +0 -1
  77. package/dist/module/components/DurationScroll/index.js +0 -3
  78. package/dist/module/components/DurationScroll/index.js.map +0 -1
  79. package/dist/module/components/DurationScroll/types.js +0 -2
  80. package/dist/module/components/DurationScroll/types.js.map +0 -1
  81. package/dist/module/components/Modal/Modal.js +0 -99
  82. package/dist/module/components/Modal/Modal.js.map +0 -1
  83. package/dist/module/components/Modal/index.js +0 -3
  84. package/dist/module/components/Modal/index.js.map +0 -1
  85. package/dist/module/components/Modal/styles.js +0 -19
  86. package/dist/module/components/Modal/styles.js.map +0 -1
  87. package/dist/module/components/Modal/types.js +0 -2
  88. package/dist/module/components/Modal/types.js.map +0 -1
  89. package/dist/module/components/PickerItem/PickerItem.js +0 -38
  90. package/dist/module/components/PickerItem/PickerItem.js.map +0 -1
  91. package/dist/module/components/PickerItem/index.js +0 -2
  92. package/dist/module/components/PickerItem/index.js.map +0 -1
  93. package/dist/module/components/TimerPicker/TimerPicker.js +0 -228
  94. package/dist/module/components/TimerPicker/TimerPicker.js.map +0 -1
  95. package/dist/module/components/TimerPicker/index.js +0 -4
  96. package/dist/module/components/TimerPicker/index.js.map +0 -1
  97. package/dist/module/components/TimerPicker/styles.js +0 -114
  98. package/dist/module/components/TimerPicker/styles.js.map +0 -1
  99. package/dist/module/components/TimerPicker/types.js +0 -2
  100. package/dist/module/components/TimerPicker/types.js.map +0 -1
  101. package/dist/module/components/TimerPickerModal/TimerPickerModal.js +0 -145
  102. package/dist/module/components/TimerPickerModal/TimerPickerModal.js.map +0 -1
  103. package/dist/module/components/TimerPickerModal/index.js +0 -4
  104. package/dist/module/components/TimerPickerModal/index.js.map +0 -1
  105. package/dist/module/components/TimerPickerModal/styles.js +0 -82
  106. package/dist/module/components/TimerPickerModal/styles.js.map +0 -1
  107. package/dist/module/components/TimerPickerModal/types.js +0 -2
  108. package/dist/module/components/TimerPickerModal/types.js.map +0 -1
  109. package/dist/module/index.js +0 -3
  110. package/dist/module/index.js.map +0 -1
  111. package/dist/module/tests/DurationScroll.test.js +0 -160
  112. package/dist/module/tests/DurationScroll.test.js.map +0 -1
  113. package/dist/module/tests/Modal.test.js +0 -116
  114. package/dist/module/tests/Modal.test.js.map +0 -1
  115. package/dist/module/tests/TimerPicker.test.js +0 -166
  116. package/dist/module/tests/TimerPicker.test.js.map +0 -1
  117. package/dist/module/tests/TimerPickerModal.test.js +0 -273
  118. package/dist/module/tests/TimerPickerModal.test.js.map +0 -1
  119. package/dist/module/tests/colorToRgba.test.js +0 -174
  120. package/dist/module/tests/colorToRgba.test.js.map +0 -1
  121. package/dist/module/tests/generateNumbers.test.js +0 -348
  122. package/dist/module/tests/generateNumbers.test.js.map +0 -1
  123. package/dist/module/tests/getAdjustedLimit.test.js +0 -322
  124. package/dist/module/tests/getAdjustedLimit.test.js.map +0 -1
  125. package/dist/module/tests/getDurationAndIndexFromScrollOffset.test.js +0 -422
  126. package/dist/module/tests/getDurationAndIndexFromScrollOffset.test.js.map +0 -1
  127. package/dist/module/tests/getInitialScrollIndex.test.js +0 -394
  128. package/dist/module/tests/getInitialScrollIndex.test.js.map +0 -1
  129. package/dist/module/tests/getSafeInitialValue.test.js +0 -495
  130. package/dist/module/tests/getSafeInitialValue.test.js.map +0 -1
  131. package/dist/module/tests/padNumber.test.js +0 -299
  132. package/dist/module/tests/padNumber.test.js.map +0 -1
  133. package/dist/module/utils/colorToRgba.js +0 -80
  134. package/dist/module/utils/colorToRgba.js.map +0 -1
  135. package/dist/module/utils/generateNumbers.js +0 -117
  136. package/dist/module/utils/generateNumbers.js.map +0 -1
  137. package/dist/module/utils/getAdjustedLimit.js +0 -51
  138. package/dist/module/utils/getAdjustedLimit.js.map +0 -1
  139. package/dist/module/utils/getDurationAndIndexFromScrollOffset.js +0 -55
  140. package/dist/module/utils/getDurationAndIndexFromScrollOffset.js.map +0 -1
  141. package/dist/module/utils/getInitialScrollIndex.js +0 -50
  142. package/dist/module/utils/getInitialScrollIndex.js.map +0 -1
  143. package/dist/module/utils/getSafeInitialValue.js +0 -34
  144. package/dist/module/utils/getSafeInitialValue.js.map +0 -1
  145. package/dist/module/utils/padNumber.js +0 -33
  146. package/dist/module/utils/padNumber.js.map +0 -1
  147. package/dist/typescript/components/DurationScroll/DurationScroll.d.ts +0 -4
  148. package/dist/typescript/components/DurationScroll/index.d.ts +0 -2
  149. package/dist/typescript/components/DurationScroll/types.d.ts +0 -66
  150. package/dist/typescript/components/Modal/Modal.d.ts +0 -5
  151. package/dist/typescript/components/Modal/index.d.ts +0 -2
  152. package/dist/typescript/components/Modal/styles.d.ts +0 -17
  153. package/dist/typescript/components/Modal/types.d.ts +0 -15
  154. package/dist/typescript/components/PickerItem/PickerItem.d.ts +0 -14
  155. package/dist/typescript/components/PickerItem/index.d.ts +0 -1
  156. package/dist/typescript/components/TimerPicker/TimerPicker.d.ts +0 -4
  157. package/dist/typescript/components/TimerPicker/index.d.ts +0 -3
  158. package/dist/typescript/components/TimerPicker/styles.d.ts +0 -1451
  159. package/dist/typescript/components/TimerPicker/types.d.ts +0 -90
  160. package/dist/typescript/components/TimerPickerModal/TimerPickerModal.d.ts +0 -4
  161. package/dist/typescript/components/TimerPickerModal/index.d.ts +0 -3
  162. package/dist/typescript/components/TimerPickerModal/styles.d.ts +0 -947
  163. package/dist/typescript/components/TimerPickerModal/types.d.ts +0 -55
  164. package/dist/typescript/index.d.ts +0 -2
  165. package/dist/typescript/utils/colorToRgba.d.ts +0 -38
  166. package/dist/typescript/utils/generateNumbers.d.ts +0 -80
  167. package/dist/typescript/utils/getAdjustedLimit.d.ts +0 -30
  168. package/dist/typescript/utils/getDurationAndIndexFromScrollOffset.d.ts +0 -49
  169. package/dist/typescript/utils/getInitialScrollIndex.d.ts +0 -46
  170. package/dist/typescript/utils/getSafeInitialValue.d.ts +0 -38
  171. package/dist/typescript/utils/padNumber.d.ts +0 -28
@@ -1 +0,0 @@
1
- {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_reactNative2","_TimerPickerModal","e","__esModule","default","_extends","Object","assign","bind","n","arguments","length","t","r","hasOwnProperty","call","apply","describe","mockOnConfirm","jest","fn","mockOnCancel","beforeEach","useFakeTimers","afterEach","runOnlyPendingTimers","useRealTimers","cleanup","defaultProps","visible","setIsVisible","onConfirm","onCancel","it","getByTestId","render","createElement","component","expect","toBeDefined","getByText","confirmButton","fireEvent","press","toHaveBeenCalled","cancelButton","setIsVisibleMock","toHaveBeenCalledWith","closeOnOverlayPress","overlay","objectContaining","modal","props","toBe","confirmButtonText","cancelButtonText","modalTitle","not","queryByText","hideCancelButton","toBeNull","initialValue","hours","minutes","seconds","hourInterval","minuteInterval","secondInterval","onCancelMock","hideHours","hideSeconds","hourLabel","minuteLabel","secondLabel","hideMinutes","hideDays","CustomButton","onPress","TouchableOpacity","testID","Text","customCancelButton","customConfirmButton","CustomCancelButton","CustomConfirmButton"],"sources":["TimerPickerModal.test.tsx"],"sourcesContent":["import React from \"react\";\nimport { TouchableOpacity, Text } from \"react-native\";\n\nimport { render, fireEvent, cleanup } from \"@testing-library/react-native\";\n\nimport TimerPickerModal from \"../components/TimerPickerModal\";\n\ndescribe(\"TimerPickerModal\", () => {\n const mockOnConfirm = jest.fn();\n const mockOnCancel = jest.fn();\n\n beforeEach(() => {\n jest.useFakeTimers();\n });\n\n afterEach(() => {\n jest.runOnlyPendingTimers();\n jest.useRealTimers();\n cleanup();\n });\n\n const defaultProps = {\n visible: true,\n setIsVisible: jest.fn(),\n onConfirm: mockOnConfirm,\n onCancel: mockOnCancel,\n };\n\n it(\"renders without crashing\", () => {\n const { getByTestId } = render(<TimerPickerModal {...defaultProps} />);\n const component = getByTestId(\"timer-picker-modal\");\n expect(component).toBeDefined();\n });\n\n it(\"calls onConfirm when Confirm button is pressed\", () => {\n const { getByText } = render(<TimerPickerModal {...defaultProps} />);\n const confirmButton = getByText(\"Confirm\");\n fireEvent.press(confirmButton);\n expect(mockOnConfirm).toHaveBeenCalled();\n });\n\n it(\"calls onCancel when Cancel button is pressed\", () => {\n const { getByText } = render(<TimerPickerModal {...defaultProps} />);\n const cancelButton = getByText(\"Cancel\");\n fireEvent.press(cancelButton);\n expect(mockOnCancel).toHaveBeenCalled();\n });\n\n it(\"hides the modal when Cancel button is pressed\", () => {\n const setIsVisibleMock = jest.fn();\n const { getByText } = render(\n <TimerPickerModal\n {...defaultProps}\n setIsVisible={setIsVisibleMock}\n />\n );\n const cancelButton = getByText(\"Cancel\");\n fireEvent.press(cancelButton);\n expect(setIsVisibleMock).toHaveBeenCalledWith(false);\n });\n\n it(\"hides the modal when overlay is pressed\", () => {\n const setIsVisibleMock = jest.fn();\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n closeOnOverlayPress\n setIsVisible={setIsVisibleMock}\n />\n );\n const overlay = getByTestId(\"modal-backdrop\");\n fireEvent.press(overlay);\n expect(setIsVisibleMock).toHaveBeenCalledWith(false);\n });\n\n it(\"calls onConfirm with selected duration when Confirm button is pressed\", () => {\n const { getByText } = render(<TimerPickerModal {...defaultProps} />);\n // Select duration in TimerPicker, assuming its interaction is tested separately\n const confirmButton = getByText(\"Confirm\");\n fireEvent.press(confirmButton);\n expect(mockOnConfirm).toHaveBeenCalledWith(expect.objectContaining({}));\n });\n\n it(\"renders but is not visible when visible prop is false\", () => {\n const { getByTestId } = render(\n <TimerPickerModal {...defaultProps} visible={false} />\n );\n const modal = getByTestId(\"timer-picker-modal\");\n expect(modal).toBeDefined();\n // Modal component still renders but with visible={false}\n expect(modal.props.visible).toBe(false);\n });\n\n it(\"renders with custom button labels\", () => {\n const { getByText } = render(\n <TimerPickerModal\n {...defaultProps}\n confirmButtonText=\"OK\"\n cancelButtonText=\"Dismiss\"\n />\n );\n expect(getByText(\"OK\")).toBeDefined();\n expect(getByText(\"Dismiss\")).toBeDefined();\n });\n\n it(\"renders with custom modal title\", () => {\n const { getByText } = render(\n <TimerPickerModal {...defaultProps} modalTitle=\"Select Time\" />\n );\n expect(getByText(\"Select Time\")).toBeDefined();\n });\n\n it(\"does not close on overlay press when closeOnOverlayPress is false\", () => {\n const setIsVisibleMock = jest.fn();\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n closeOnOverlayPress={false}\n setIsVisible={setIsVisibleMock}\n />\n );\n const overlay = getByTestId(\"modal-backdrop\");\n fireEvent.press(overlay);\n expect(setIsVisibleMock).not.toHaveBeenCalled();\n });\n\n it(\"hides Cancel button when hideCancelButton is true\", () => {\n const { queryByText } = render(\n <TimerPickerModal {...defaultProps} hideCancelButton />\n );\n expect(queryByText(\"Cancel\")).toBeNull();\n });\n\n it(\"renders with initial value\", () => {\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n initialValue={{ hours: 2, minutes: 30, seconds: 0 }}\n />\n );\n expect(getByTestId(\"timer-picker-modal\")).toBeDefined();\n });\n\n it(\"renders with custom intervals\", () => {\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n hourInterval={2}\n minuteInterval={15}\n secondInterval={5}\n />\n );\n expect(getByTestId(\"timer-picker-modal\")).toBeDefined();\n });\n\n it(\"calls both onCancel and setIsVisible when Cancel is pressed\", () => {\n const setIsVisibleMock = jest.fn();\n const onCancelMock = jest.fn();\n const { getByText } = render(\n <TimerPickerModal\n {...defaultProps}\n onCancel={onCancelMock}\n setIsVisible={setIsVisibleMock}\n />\n );\n const cancelButton = getByText(\"Cancel\");\n fireEvent.press(cancelButton);\n expect(onCancelMock).toHaveBeenCalled();\n expect(setIsVisibleMock).toHaveBeenCalledWith(false);\n });\n\n it(\"hides specific time units when respective hide props are provided\", () => {\n const { getByTestId } = render(\n <TimerPickerModal {...defaultProps} hideHours hideSeconds />\n );\n expect(getByTestId(\"timer-picker-modal\")).toBeDefined();\n // Note: The specific duration scroll test IDs would be in the TimerPicker component\n });\n\n it(\"renders without crashing with all optional props\", () => {\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n modalTitle=\"Pick Duration\"\n confirmButtonText=\"Done\"\n cancelButtonText=\"Close\"\n hourLabel=\"h\"\n minuteLabel=\"m\"\n secondLabel=\"s\"\n hideHours={false}\n hideMinutes={false}\n hideSeconds={false}\n hideDays={false}\n />\n );\n expect(getByTestId(\"timer-picker-modal\")).toBeDefined();\n });\n\n it(\"renders custom cancel button when provided\", () => {\n const CustomButton = ({ onPress }: { onPress?: () => void }) => (\n <TouchableOpacity onPress={onPress} testID=\"custom-cancel-button\">\n <Text>Custom Cancel</Text>\n </TouchableOpacity>\n );\n\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n cancelButton={<CustomButton />}\n />\n );\n expect(getByTestId(\"custom-cancel-button\")).toBeDefined();\n });\n\n it(\"renders custom confirm button when provided\", () => {\n const CustomButton = ({ onPress }: { onPress?: () => void }) => (\n <TouchableOpacity onPress={onPress} testID=\"custom-confirm-button\">\n <Text>Custom Confirm</Text>\n </TouchableOpacity>\n );\n\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n confirmButton={<CustomButton />}\n />\n );\n expect(getByTestId(\"custom-confirm-button\")).toBeDefined();\n });\n\n it(\"calls onCancel when custom cancel button is pressed\", () => {\n const CustomButton = ({ onPress }: { onPress?: () => void }) => (\n <TouchableOpacity onPress={onPress} testID=\"custom-cancel-button\">\n <Text>Custom Cancel</Text>\n </TouchableOpacity>\n );\n\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n cancelButton={<CustomButton />}\n />\n );\n const customCancelButton = getByTestId(\"custom-cancel-button\");\n fireEvent.press(customCancelButton);\n expect(mockOnCancel).toHaveBeenCalled();\n });\n\n it(\"calls onConfirm when custom confirm button is pressed\", () => {\n const CustomButton = ({ onPress }: { onPress?: () => void }) => (\n <TouchableOpacity onPress={onPress} testID=\"custom-confirm-button\">\n <Text>Custom Confirm</Text>\n </TouchableOpacity>\n );\n\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n confirmButton={<CustomButton />}\n />\n );\n const customConfirmButton = getByTestId(\"custom-confirm-button\");\n fireEvent.press(customConfirmButton);\n expect(mockOnConfirm).toHaveBeenCalled();\n });\n\n it(\"renders both custom cancel and confirm buttons when provided\", () => {\n const CustomCancelButton = ({ onPress }: { onPress?: () => void }) => (\n <TouchableOpacity onPress={onPress} testID=\"custom-cancel-button\">\n <Text>Custom Cancel</Text>\n </TouchableOpacity>\n );\n const CustomConfirmButton = ({ onPress }: { onPress?: () => void }) => (\n <TouchableOpacity onPress={onPress} testID=\"custom-confirm-button\">\n <Text>Custom Confirm</Text>\n </TouchableOpacity>\n );\n\n const { getByTestId } = render(\n <TimerPickerModal\n {...defaultProps}\n cancelButton={<CustomCancelButton />}\n confirmButton={<CustomConfirmButton />}\n />\n );\n expect(getByTestId(\"custom-cancel-button\")).toBeDefined();\n expect(getByTestId(\"custom-confirm-button\")).toBeDefined();\n });\n});\n"],"mappings":";;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,a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CAAAgC,aAAA,CAACrC,YAAA,CAAAiF,IAAI,QAAC,eAAmB,CACX,CACrB;IACD,MAAMI,mBAAmB,GAAGA,CAAC;MAAEP;IAAkC,CAAC,kBAC9DjF,MAAA,CAAAQ,OAAA,CAAAgC,aAAA,CAACrC,YAAA,CAAA+E,gBAAgB;MAACD,OAAO,EAAEA,OAAQ;MAACE,MAAM,EAAC;IAAuB,gBAC9DnF,MAAA,CAAAQ,OAAA,CAAAgC,aAAA,CAACrC,YAAA,CAAAiF,IAAI,QAAC,gBAAoB,CACZ,CACrB;IAED,MAAM;MAAE9C;IAAY,CAAC,GAAG,IAAAC,oBAAM,eAC1BvC,MAAA,CAAAQ,OAAA,CAAAgC,aAAA,CAACnC,iBAAA,CAAAG,OAAgB,EAAAC,QAAA,KACTuB,YAAY;MAChBiB,YAAY,eAAEjD,MAAA,CAAAQ,OAAA,CAAAgC,aAAA,CAAC+C,kBAAkB,MAAE,CAAE;MACrC1C,aAAa,eAAE7C,MAAA,CAAAQ,OAAA,CAAAgC,aAAA,CAACgD,mBAAmB,MAAE;IAAE,EAC1C,CACL,CAAC;IACD9C,MAAM,CAACJ,WAAW,CAAC,sBAAsB,CAAC,CAAC,CAACK,WAAW,CAAC,CAAC;IACzDD,MAAM,CAACJ,WAAW,CAAC,uBAAuB,CAAC,CAAC,CAACK,WAAW,CAAC,CAAC;EAC9D,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -1,176 +0,0 @@
1
- "use strict";
2
-
3
- var _colorToRgba = require("../utils/colorToRgba");
4
- describe("colorToRgba", () => {
5
- describe("named colors", () => {
6
- it("converts 'transparent' to rgba", () => {
7
- expect((0, _colorToRgba.colorToRgba)({
8
- color: "transparent"
9
- })).toBe("rgba(0, 0, 0, 0)");
10
- });
11
- it("converts 'black' to rgba", () => {
12
- expect((0, _colorToRgba.colorToRgba)({
13
- color: "black"
14
- })).toBe("rgba(0, 0, 0, 1)");
15
- });
16
- it("converts 'white' to rgba", () => {
17
- expect((0, _colorToRgba.colorToRgba)({
18
- color: "white"
19
- })).toBe("rgba(255, 255, 255, 1)");
20
- });
21
- it("converts 'blue' to rgba", () => {
22
- expect((0, _colorToRgba.colorToRgba)({
23
- color: "blue"
24
- })).toBe("rgba(0, 0, 255, 1)");
25
- });
26
- it("converts 'green' to rgba", () => {
27
- expect((0, _colorToRgba.colorToRgba)({
28
- color: "green"
29
- })).toBe("rgba(0, 128, 0, 1)");
30
- });
31
- it("converts 'gray' to rgba", () => {
32
- expect((0, _colorToRgba.colorToRgba)({
33
- color: "gray"
34
- })).toBe("rgba(128, 128, 128, 1)");
35
- });
36
- it("converts 'red' to rgba", () => {
37
- expect((0, _colorToRgba.colorToRgba)({
38
- color: "red"
39
- })).toBe("rgba(255, 0, 0, 1)");
40
- });
41
- });
42
- describe("RGB format", () => {
43
- it("converts rgb color to rgba with default opacity", () => {
44
- expect((0, _colorToRgba.colorToRgba)({
45
- color: "rgb(255, 0, 0)"
46
- })).toBe("rgba(255, 0, 0, 1)");
47
- });
48
- it("converts rgb color to rgba with custom opacity", () => {
49
- expect((0, _colorToRgba.colorToRgba)({
50
- color: "rgb(255, 0, 0)",
51
- opacity: 0.5
52
- })).toBe("rgba(255, 0, 0, 0.5)");
53
- });
54
- it("converts rgb color with spaces", () => {
55
- expect((0, _colorToRgba.colorToRgba)({
56
- color: "rgb(128, 64, 32)"
57
- })).toBe("rgba(128, 64, 32, 1)");
58
- });
59
- it("converts rgb color with no spaces", () => {
60
- expect((0, _colorToRgba.colorToRgba)({
61
- color: "rgb(128,64,32)"
62
- })).toBe("rgba(128, 64, 32, 1)");
63
- });
64
- it("handles rgb with zero values", () => {
65
- expect((0, _colorToRgba.colorToRgba)({
66
- color: "rgb(0, 0, 0)"
67
- })).toBe("rgba(0, 0, 0, 1)");
68
- });
69
- it("handles rgb with max values", () => {
70
- expect((0, _colorToRgba.colorToRgba)({
71
- color: "rgb(255, 255, 255)"
72
- })).toBe("rgba(255, 255, 255, 1)");
73
- });
74
- });
75
- describe("hex format", () => {
76
- it("converts 6-digit hex color to rgba", () => {
77
- expect((0, _colorToRgba.colorToRgba)({
78
- color: "#FF0000"
79
- })).toBe("rgba(255, 0, 0, 1)");
80
- });
81
- it("converts 6-digit hex color with custom opacity", () => {
82
- expect((0, _colorToRgba.colorToRgba)({
83
- color: "#FF0000",
84
- opacity: 0.7
85
- })).toBe("rgba(255, 0, 0, 0.7)");
86
- });
87
- it("converts 3-digit hex color to rgba", () => {
88
- expect((0, _colorToRgba.colorToRgba)({
89
- color: "#F00"
90
- })).toBe("rgba(255, 0, 0, 1)");
91
- });
92
- it("converts 3-digit hex color with custom opacity", () => {
93
- expect((0, _colorToRgba.colorToRgba)({
94
- color: "#F00",
95
- opacity: 0.3
96
- })).toBe("rgba(255, 0, 0, 0.3)");
97
- });
98
- it("converts lowercase hex color", () => {
99
- expect((0, _colorToRgba.colorToRgba)({
100
- color: "#ff0000"
101
- })).toBe("rgba(255, 0, 0, 1)");
102
- });
103
- it("converts mixed case hex color", () => {
104
- expect((0, _colorToRgba.colorToRgba)({
105
- color: "#Ff00Aa"
106
- })).toBe("rgba(255, 0, 170, 1)");
107
- });
108
- it("converts hex black", () => {
109
- expect((0, _colorToRgba.colorToRgba)({
110
- color: "#000000"
111
- })).toBe("rgba(0, 0, 0, 1)");
112
- });
113
- it("converts hex white", () => {
114
- expect((0, _colorToRgba.colorToRgba)({
115
- color: "#FFFFFF"
116
- })).toBe("rgba(255, 255, 255, 1)");
117
- });
118
- it("converts 3-digit gray hex", () => {
119
- expect((0, _colorToRgba.colorToRgba)({
120
- color: "#888"
121
- })).toBe("rgba(136, 136, 136, 1)");
122
- });
123
- });
124
- describe("opacity handling", () => {
125
- it("uses opacity 1 when not provided", () => {
126
- expect((0, _colorToRgba.colorToRgba)({
127
- color: "#FF0000"
128
- })).toBe("rgba(255, 0, 0, 1)");
129
- });
130
- it("handles opacity 0", () => {
131
- expect((0, _colorToRgba.colorToRgba)({
132
- color: "#FF0000",
133
- opacity: 0
134
- })).toBe("rgba(255, 0, 0, 0)");
135
- });
136
- it("handles opacity 1", () => {
137
- expect((0, _colorToRgba.colorToRgba)({
138
- color: "#FF0000",
139
- opacity: 1
140
- })).toBe("rgba(255, 0, 0, 1)");
141
- });
142
- it("handles decimal opacity", () => {
143
- expect((0, _colorToRgba.colorToRgba)({
144
- color: "#FF0000",
145
- opacity: 0.42
146
- })).toBe("rgba(255, 0, 0, 0.42)");
147
- });
148
- it("ignores opacity for named color 'transparent'", () => {
149
- expect((0, _colorToRgba.colorToRgba)({
150
- color: "transparent",
151
- opacity: 0.5
152
- })).toBe("rgba(0, 0, 0, 0)");
153
- });
154
- });
155
- describe("edge cases", () => {
156
- it("returns original color for unknown format", () => {
157
- const unknownColor = "hsl(120, 100%, 50%)";
158
- expect((0, _colorToRgba.colorToRgba)({
159
- color: unknownColor
160
- })).toBe(unknownColor);
161
- });
162
- it("returns original color for invalid named color", () => {
163
- const invalidColor = "magenta";
164
- expect((0, _colorToRgba.colorToRgba)({
165
- color: invalidColor
166
- })).toBe(invalidColor);
167
- });
168
- it("returns original color for malformed hex", () => {
169
- const malformedHex = "#GG0000";
170
- expect((0, _colorToRgba.colorToRgba)({
171
- color: malformedHex
172
- })).toBe(malformedHex);
173
- });
174
- });
175
- });
176
- //# sourceMappingURL=colorToRgba.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_colorToRgba","require","describe","it","expect","colorToRgba","color","toBe","opacity","unknownColor","invalidColor","malformedHex"],"sources":["colorToRgba.test.ts"],"sourcesContent":["import { colorToRgba } from \"../utils/colorToRgba\";\n\ndescribe(\"colorToRgba\", () => {\n describe(\"named colors\", () => {\n it(\"converts 'transparent' to rgba\", () => {\n expect(colorToRgba({ color: \"transparent\" })).toBe(\"rgba(0, 0, 0, 0)\");\n });\n\n it(\"converts 'black' to rgba\", () => {\n expect(colorToRgba({ color: \"black\" })).toBe(\"rgba(0, 0, 0, 1)\");\n });\n\n it(\"converts 'white' to rgba\", () => {\n expect(colorToRgba({ color: \"white\" })).toBe(\"rgba(255, 255, 255, 1)\");\n });\n\n it(\"converts 'blue' to rgba\", () => {\n expect(colorToRgba({ color: \"blue\" })).toBe(\"rgba(0, 0, 255, 1)\");\n });\n\n it(\"converts 'green' to rgba\", () => {\n expect(colorToRgba({ color: \"green\" })).toBe(\"rgba(0, 128, 0, 1)\");\n });\n\n it(\"converts 'gray' to rgba\", () => {\n expect(colorToRgba({ color: \"gray\" })).toBe(\"rgba(128, 128, 128, 1)\");\n });\n\n it(\"converts 'red' to rgba\", () => {\n expect(colorToRgba({ color: \"red\" })).toBe(\"rgba(255, 0, 0, 1)\");\n });\n });\n\n describe(\"RGB format\", () => {\n it(\"converts rgb color to rgba with default opacity\", () => {\n expect(colorToRgba({ color: \"rgb(255, 0, 0)\" })).toBe(\"rgba(255, 0, 0, 1)\");\n });\n\n it(\"converts rgb color to rgba with custom opacity\", () => {\n expect(colorToRgba({ color: \"rgb(255, 0, 0)\", opacity: 0.5 })).toBe(\n \"rgba(255, 0, 0, 0.5)\"\n );\n });\n\n it(\"converts rgb color with spaces\", () => {\n expect(colorToRgba({ color: \"rgb(128, 64, 32)\" })).toBe(\"rgba(128, 64, 32, 1)\");\n });\n\n it(\"converts rgb color with no spaces\", () => {\n expect(colorToRgba({ color: \"rgb(128,64,32)\" })).toBe(\"rgba(128, 64, 32, 1)\");\n });\n\n it(\"handles rgb with zero values\", () => {\n expect(colorToRgba({ color: \"rgb(0, 0, 0)\" })).toBe(\"rgba(0, 0, 0, 1)\");\n });\n\n it(\"handles rgb with max values\", () => {\n expect(colorToRgba({ color: \"rgb(255, 255, 255)\" })).toBe(\"rgba(255, 255, 255, 1)\");\n });\n });\n\n describe(\"hex format\", () => {\n it(\"converts 6-digit hex color to rgba\", () => {\n expect(colorToRgba({ color: \"#FF0000\" })).toBe(\"rgba(255, 0, 0, 1)\");\n });\n\n it(\"converts 6-digit hex color with custom opacity\", () => {\n expect(colorToRgba({ color: \"#FF0000\", opacity: 0.7 })).toBe(\"rgba(255, 0, 0, 0.7)\");\n });\n\n it(\"converts 3-digit hex color to rgba\", () => {\n expect(colorToRgba({ color: \"#F00\" })).toBe(\"rgba(255, 0, 0, 1)\");\n });\n\n it(\"converts 3-digit hex color with custom opacity\", () => {\n expect(colorToRgba({ color: \"#F00\", opacity: 0.3 })).toBe(\"rgba(255, 0, 0, 0.3)\");\n });\n\n it(\"converts lowercase hex color\", () => {\n expect(colorToRgba({ color: \"#ff0000\" })).toBe(\"rgba(255, 0, 0, 1)\");\n });\n\n it(\"converts mixed case hex color\", () => {\n expect(colorToRgba({ color: \"#Ff00Aa\" })).toBe(\"rgba(255, 0, 170, 1)\");\n });\n\n it(\"converts hex black\", () => {\n expect(colorToRgba({ color: \"#000000\" })).toBe(\"rgba(0, 0, 0, 1)\");\n });\n\n it(\"converts hex white\", () => {\n expect(colorToRgba({ color: \"#FFFFFF\" })).toBe(\"rgba(255, 255, 255, 1)\");\n });\n\n it(\"converts 3-digit gray hex\", () => {\n expect(colorToRgba({ color: \"#888\" })).toBe(\"rgba(136, 136, 136, 1)\");\n });\n });\n\n describe(\"opacity handling\", () => {\n it(\"uses opacity 1 when not provided\", () => {\n expect(colorToRgba({ color: \"#FF0000\" })).toBe(\"rgba(255, 0, 0, 1)\");\n });\n\n it(\"handles opacity 0\", () => {\n expect(colorToRgba({ color: \"#FF0000\", opacity: 0 })).toBe(\"rgba(255, 0, 0, 0)\");\n });\n\n it(\"handles opacity 1\", () => {\n expect(colorToRgba({ color: \"#FF0000\", opacity: 1 })).toBe(\"rgba(255, 0, 0, 1)\");\n });\n\n it(\"handles decimal opacity\", () => {\n expect(colorToRgba({ color: \"#FF0000\", opacity: 0.42 })).toBe(\"rgba(255, 0, 0, 0.42)\");\n });\n\n it(\"ignores opacity for named color 'transparent'\", () => {\n expect(colorToRgba({ color: \"transparent\", opacity: 0.5 })).toBe(\"rgba(0, 0, 0, 0)\");\n });\n });\n\n describe(\"edge cases\", () => {\n it(\"returns original color for unknown format\", () => {\n const unknownColor = \"hsl(120, 100%, 50%)\";\n expect(colorToRgba({ color: unknownColor })).toBe(unknownColor);\n });\n\n it(\"returns original color for invalid named color\", () => {\n const invalidColor = \"magenta\";\n expect(colorToRgba({ color: invalidColor })).toBe(invalidColor);\n });\n\n it(\"returns original color for malformed hex\", () => {\n const malformedHex = \"#GG0000\";\n expect(colorToRgba({ color: malformedHex })).toBe(malformedHex);\n });\n });\n});\n"],"mappings":";;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEAC,QAAQ,CAAC,aAAa,EAAE,MAAM;EAC1BA,QAAQ,CAAC,cAAc,EAAE,MAAM;IAC3BC,EAAE,CAAC,gCAAgC,EAAE,MAAM;MACvCC,MAAM,CAAC,IAAAC,wBAAW,EAAC;QAAEC,KAAK,EAAE;MAAc,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,kBAAkB,CAAC;IAC1E,CAAC,CAAC;IAEFJ,EAAE,CAAC,0BAA0B,EAAE,MAAM;MACjCC,MAAM,CAAC,IAAAC,wBAAW,EAAC;QAAEC,KAAK,EAAE;MAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,kBAAkB,CAAC;IACpE,CAAC,CAAC;IAEFJ,EAAE,CAAC,0BAA0B,EAAE,MAAM;MACjCC,MAAM,CAAC,IAAAC,wBAAW,EAAC;QAAEC,KAAK,EAAE;MAAQ,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,wBAAwB,CAAC;IAC1E,CAAC,CAAC;IAEFJ,EAAE,CAAC,yBAAyB,EAAE,MAAM;MAChCC,MAAM,CAAC,IAAAC,wBAAW,EAAC;QAAEC,KAAK,EAAE;MAAO,CAAC,CAAC,CAAC,CAACC,IAAI,CAAC,oBAAoB,CAAC;IACrE,CAAC,CAAC;IAEFJ,EAAE,CAAC,0BAA0B,EAAE,MAAM;MACjCC,MAAM,CAAC,IAAAC,wBAAW,EAAC;QAAEC,KAAK,EAAE;MAAQ,CAAC,CAAC,CAAC,CAACC,IAAI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AAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -1,350 +0,0 @@
1
- "use strict";
2
-
3
- var _generateNumbers = require("../utils/generateNumbers");
4
- describe("generateNumbers", () => {
5
- describe("basic functionality", () => {
6
- it("generates correct number of items", () => {
7
- const result = (0, _generateNumbers.generateNumbers)(10, {
8
- interval: 1,
9
- padWithNItems: 0,
10
- repeatNTimes: 1,
11
- disableInfiniteScroll: true
12
- });
13
- expect(result).toHaveLength(10);
14
- });
15
- it("generates numbers with correct interval", () => {
16
- const result = (0, _generateNumbers.generateNumbers)(5, {
17
- interval: 2,
18
- padWithNItems: 0,
19
- repeatNTimes: 1,
20
- disableInfiniteScroll: true
21
- });
22
- expect(result).toEqual(["\u20070", "\u20072", "\u20074", "\u20076", "\u20078"]);
23
- });
24
- it("generates numbers with interval of 5", () => {
25
- const result = (0, _generateNumbers.generateNumbers)(4, {
26
- interval: 5,
27
- padWithNItems: 0,
28
- repeatNTimes: 1,
29
- disableInfiniteScroll: true
30
- });
31
- expect(result).toEqual(["\u20070", "\u20075", "10", "15"]);
32
- });
33
- it("returns empty array when numberOfItems is 0", () => {
34
- const result = (0, _generateNumbers.generateNumbers)(0, {
35
- interval: 1,
36
- padWithNItems: 0,
37
- repeatNTimes: 1
38
- });
39
- expect(result).toEqual([]);
40
- });
41
- it("returns empty array when numberOfItems is negative", () => {
42
- const result = (0, _generateNumbers.generateNumbers)(-5, {
43
- interval: 1,
44
- padWithNItems: 0,
45
- repeatNTimes: 1
46
- });
47
- expect(result).toEqual([]);
48
- });
49
- });
50
- describe("padding with zeros", () => {
51
- it("pads single-digit numbers with zeros", () => {
52
- const result = (0, _generateNumbers.generateNumbers)(5, {
53
- interval: 1,
54
- padWithNItems: 0,
55
- repeatNTimes: 1,
56
- padNumbersWithZero: true,
57
- disableInfiniteScroll: true
58
- });
59
- expect(result).toEqual(["00", "01", "02", "03", "04"]);
60
- });
61
- it("does not pad double-digit numbers", () => {
62
- const result = (0, _generateNumbers.generateNumbers)(15, {
63
- interval: 1,
64
- padWithNItems: 0,
65
- repeatNTimes: 1,
66
- padNumbersWithZero: true,
67
- disableInfiniteScroll: true
68
- });
69
- expect(result[0]).toBe("00");
70
- expect(result[9]).toBe("09");
71
- expect(result[10]).toBe("10");
72
- expect(result[14]).toBe("14");
73
- });
74
- it("pads with space when padNumbersWithZero is false", () => {
75
- const result = (0, _generateNumbers.generateNumbers)(5, {
76
- interval: 1,
77
- padWithNItems: 0,
78
- repeatNTimes: 1,
79
- padNumbersWithZero: false,
80
- disableInfiniteScroll: true
81
- });
82
- expect(result).toEqual(["\u20070", "\u20071", "\u20072", "\u20073", "\u20074"]);
83
- });
84
- });
85
- describe("padding with empty items", () => {
86
- it("adds padding items at start and end when infinite scroll is disabled", () => {
87
- const result = (0, _generateNumbers.generateNumbers)(3, {
88
- interval: 1,
89
- padWithNItems: 2,
90
- repeatNTimes: 1,
91
- disableInfiniteScroll: true
92
- });
93
- expect(result).toEqual(["", "", "\u20070", "\u20071", "\u20072", "", ""]);
94
- expect(result).toHaveLength(7);
95
- });
96
- it("adds padding with 1 item", () => {
97
- const result = (0, _generateNumbers.generateNumbers)(3, {
98
- interval: 1,
99
- padWithNItems: 1,
100
- repeatNTimes: 1,
101
- disableInfiniteScroll: true
102
- });
103
- expect(result).toEqual(["", "\u20070", "\u20071", "\u20072", ""]);
104
- });
105
- it("adds padding with 3 items", () => {
106
- const result = (0, _generateNumbers.generateNumbers)(2, {
107
- interval: 1,
108
- padWithNItems: 3,
109
- repeatNTimes: 1,
110
- disableInfiniteScroll: true
111
- });
112
- expect(result).toEqual(["", "", "", "\u20070", "\u20071", "", "", ""]);
113
- });
114
- });
115
- describe("number repetition", () => {
116
- it("repeats numbers when repeatNTimes is 2", () => {
117
- const result = (0, _generateNumbers.generateNumbers)(3, {
118
- interval: 1,
119
- padWithNItems: 0,
120
- repeatNTimes: 2,
121
- disableInfiniteScroll: false
122
- });
123
- expect(result).toEqual(["\u20070", "\u20071", "\u20072", "\u20070", "\u20071", "\u20072"]);
124
- });
125
- it("repeats numbers when repeatNTimes is 3", () => {
126
- const result = (0, _generateNumbers.generateNumbers)(2, {
127
- interval: 1,
128
- padWithNItems: 0,
129
- repeatNTimes: 3,
130
- disableInfiniteScroll: false
131
- });
132
- expect(result).toEqual(["\u20070", "\u20071", "\u20070", "\u20071", "\u20070", "\u20071"]);
133
- });
134
- });
135
- describe("combined options", () => {
136
- it("combines padding with zeros and empty items", () => {
137
- const result = (0, _generateNumbers.generateNumbers)(3, {
138
- interval: 1,
139
- padWithNItems: 1,
140
- repeatNTimes: 1,
141
- padNumbersWithZero: true,
142
- disableInfiniteScroll: true
143
- });
144
- expect(result).toEqual(["", "00", "01", "02", ""]);
145
- });
146
- it("combines interval, padding with zeros, and repetition", () => {
147
- const result = (0, _generateNumbers.generateNumbers)(3, {
148
- interval: 5,
149
- padWithNItems: 0,
150
- repeatNTimes: 2,
151
- padNumbersWithZero: true,
152
- disableInfiniteScroll: false
153
- });
154
- expect(result).toEqual(["00", "05", "10", "00", "05", "10"]);
155
- });
156
- it("handles all options together", () => {
157
- const result = (0, _generateNumbers.generateNumbers)(3, {
158
- interval: 2,
159
- padWithNItems: 1,
160
- repeatNTimes: 2,
161
- padNumbersWithZero: true,
162
- disableInfiniteScroll: false
163
- });
164
- expect(result).toEqual(["00", "02", "04", "00", "02", "04"]);
165
- });
166
- });
167
- });
168
- describe("generate12HourNumbers", () => {
169
- describe("basic functionality", () => {
170
- it("generates all 24 hours with 1-hour interval", () => {
171
- const result = (0, _generateNumbers.generate12HourNumbers)({
172
- interval: 1,
173
- padWithNItems: 0,
174
- disableInfiniteScroll: false
175
- });
176
- expect(result).toHaveLength(24);
177
- expect(result[0]).toBe("12 AM");
178
- expect(result[11]).toBe("11 AM");
179
- expect(result[12]).toBe("12 PM");
180
- expect(result[23]).toBe("11 PM");
181
- });
182
- it("generates hours with 2-hour interval", () => {
183
- const result = (0, _generateNumbers.generate12HourNumbers)({
184
- interval: 2,
185
- padWithNItems: 0,
186
- disableInfiniteScroll: false
187
- });
188
- expect(result).toHaveLength(12);
189
- expect(result[0]).toBe("12 AM");
190
- expect(result[5]).toBe("10 AM");
191
- expect(result[6]).toBe("12 PM");
192
- expect(result[11]).toBe("10 PM");
193
- });
194
- it("generates hours with 3-hour interval", () => {
195
- const result = (0, _generateNumbers.generate12HourNumbers)({
196
- interval: 3,
197
- padWithNItems: 0,
198
- disableInfiniteScroll: false
199
- });
200
- expect(result).toHaveLength(8);
201
- expect(result[0]).toBe("12 AM");
202
- expect(result[3]).toBe("\u20079 AM");
203
- expect(result[4]).toBe("12 PM");
204
- expect(result[7]).toBe("\u20079 PM");
205
- });
206
- it("generates hours with 4-hour interval", () => {
207
- const result = (0, _generateNumbers.generate12HourNumbers)({
208
- interval: 4,
209
- padWithNItems: 0,
210
- disableInfiniteScroll: false
211
- });
212
- expect(result).toHaveLength(6);
213
- expect(result[0]).toBe("12 AM");
214
- expect(result[2]).toBe("\u20078 AM");
215
- expect(result[3]).toBe("12 PM");
216
- expect(result[5]).toBe("\u20078 PM");
217
- });
218
- it("generates hours with 6-hour interval", () => {
219
- const result = (0, _generateNumbers.generate12HourNumbers)({
220
- interval: 6,
221
- padWithNItems: 0,
222
- disableInfiniteScroll: false
223
- });
224
- expect(result).toHaveLength(4);
225
- expect(result[0]).toBe("12 AM");
226
- expect(result[1]).toBe("\u20076 AM");
227
- expect(result[2]).toBe("12 PM");
228
- expect(result[3]).toBe("\u20076 PM");
229
- });
230
- });
231
- describe("padding with zeros", () => {
232
- it("pads hours with zeros", () => {
233
- const result = (0, _generateNumbers.generate12HourNumbers)({
234
- interval: 1,
235
- padWithNItems: 0,
236
- padNumbersWithZero: true,
237
- disableInfiniteScroll: false
238
- });
239
- expect(result[0]).toBe("12 AM");
240
- expect(result[1]).toBe("01 AM");
241
- expect(result[9]).toBe("09 AM");
242
- expect(result[10]).toBe("10 AM");
243
- expect(result[12]).toBe("12 PM");
244
- });
245
- it("handles 12-hour format correctly with zero padding", () => {
246
- const result = (0, _generateNumbers.generate12HourNumbers)({
247
- interval: 1,
248
- padWithNItems: 0,
249
- padNumbersWithZero: true,
250
- disableInfiniteScroll: false
251
- });
252
- expect(result[12]).toBe("12 PM"); // 12 PM should not be 00 PM
253
- expect(result[13]).toBe("01 PM");
254
- });
255
- });
256
- describe("padding with empty items", () => {
257
- it("adds padding at start and end when infinite scroll is disabled", () => {
258
- const result = (0, _generateNumbers.generate12HourNumbers)({
259
- interval: 6,
260
- padWithNItems: 2,
261
- disableInfiniteScroll: true
262
- });
263
- expect(result[0]).toBe("");
264
- expect(result[1]).toBe("");
265
- expect(result[2]).toBe("12 AM");
266
- expect(result[3]).toBe("\u20076 AM");
267
- expect(result[4]).toBe("12 PM");
268
- expect(result[5]).toBe("\u20076 PM");
269
- expect(result[6]).toBe("");
270
- expect(result[7]).toBe("");
271
- expect(result).toHaveLength(8);
272
- });
273
- it("does not add padding when infinite scroll is enabled", () => {
274
- const result = (0, _generateNumbers.generate12HourNumbers)({
275
- interval: 6,
276
- padWithNItems: 2,
277
- disableInfiniteScroll: false
278
- });
279
- expect(result[0]).toBe("12 AM");
280
- expect(result[3]).toBe("\u20076 PM");
281
- expect(result).toHaveLength(4);
282
- });
283
- });
284
- describe("number repetition", () => {
285
- it("repeats hours when repeatNTimes is 2", () => {
286
- const result = (0, _generateNumbers.generate12HourNumbers)({
287
- interval: 6,
288
- padWithNItems: 0,
289
- repeatNTimes: 2,
290
- disableInfiniteScroll: false
291
- });
292
- expect(result).toHaveLength(8);
293
- expect(result[0]).toBe("12 AM");
294
- expect(result[3]).toBe("\u20076 PM");
295
- expect(result[4]).toBe("12 AM");
296
- expect(result[7]).toBe("\u20076 PM");
297
- });
298
- it("repeats hours when repeatNTimes is 3", () => {
299
- const result = (0, _generateNumbers.generate12HourNumbers)({
300
- interval: 12,
301
- padWithNItems: 0,
302
- repeatNTimes: 3,
303
- disableInfiniteScroll: false
304
- });
305
- expect(result).toHaveLength(6);
306
- expect(result[0]).toBe("12 AM");
307
- expect(result[1]).toBe("12 PM");
308
- expect(result[2]).toBe("12 AM");
309
- expect(result[3]).toBe("12 PM");
310
- expect(result[4]).toBe("12 AM");
311
- expect(result[5]).toBe("12 PM");
312
- });
313
- it("defaults to repeatNTimes of 1 when not provided", () => {
314
- const result = (0, _generateNumbers.generate12HourNumbers)({
315
- interval: 12,
316
- padWithNItems: 0,
317
- disableInfiniteScroll: false
318
- });
319
- expect(result).toHaveLength(2);
320
- });
321
- });
322
- describe("combined options", () => {
323
- it("combines padding with zeros and empty items", () => {
324
- const result = (0, _generateNumbers.generate12HourNumbers)({
325
- interval: 12,
326
- padWithNItems: 1,
327
- padNumbersWithZero: true,
328
- disableInfiniteScroll: true
329
- });
330
- expect(result).toEqual(["", "12 AM", "12 PM", ""]);
331
- });
332
- it("combines all options", () => {
333
- const result = (0, _generateNumbers.generate12HourNumbers)({
334
- interval: 6,
335
- padWithNItems: 1,
336
- padNumbersWithZero: true,
337
- repeatNTimes: 2,
338
- disableInfiniteScroll: false
339
- });
340
- expect(result).toHaveLength(8);
341
- expect(result[0]).toBe("12 AM");
342
- expect(result[1]).toBe("06 AM");
343
- expect(result[2]).toBe("12 PM");
344
- expect(result[3]).toBe("06 PM");
345
- expect(result[4]).toBe("12 AM");
346
- expect(result[7]).toBe("06 PM");
347
- });
348
- });
349
- });
350
- //# sourceMappingURL=generateNumbers.test.js.map