@hero-design/rn-work-uikit 1.3.0 → 1.3.1

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.
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { Platform } from 'react-native';
3
+ import renderWithTheme from '../../../../testUtils/renderWithTheme';
4
+ import DatePicker from '..';
5
+
6
+ describe('DatePicker', () => {
7
+ it('renders correctly (snapshot)', () => {
8
+ const { toJSON } = renderWithTheme(
9
+ <DatePicker
10
+ label="Start date"
11
+ value={new Date('1995-12-17T00:00:00.000Z')}
12
+ minDate={new Date('1994-12-17T00:00:00.000Z')}
13
+ maxDate={new Date('1996-12-17T00:00:00.000Z')}
14
+ confirmLabel="Confirm"
15
+ onChange={jest.fn()}
16
+ />
17
+ );
18
+ expect(toJSON()).toMatchSnapshot();
19
+ });
20
+ });
21
+
22
+ describe('Dialog', () => {
23
+ it('renders DatePickerIOS when OS is iOS', () => {
24
+ Platform.OS = 'ios';
25
+ const { getByTestId, toJSON } = renderWithTheme(
26
+ <DatePicker
27
+ label="Start date"
28
+ value={new Date('1995-12-17T00:00:00.000Z')}
29
+ minDate={new Date('1994-12-17T00:00:00.000Z')}
30
+ maxDate={new Date('1996-12-17T00:00:00.000Z')}
31
+ confirmLabel="Confirm"
32
+ onChange={jest.fn()}
33
+ />
34
+ );
35
+
36
+ expect(toJSON()).toMatchSnapshot();
37
+ expect(getByTestId('datePickerInputIOS')).toBeDefined();
38
+ });
39
+
40
+ it('renders DatePickerAndroid when OS is android', () => {
41
+ Platform.OS = 'android';
42
+ const { getByTestId, toJSON } = renderWithTheme(
43
+ <DatePicker
44
+ label="Start date"
45
+ value={new Date('1995-12-17T00:00:00.000Z')}
46
+ minDate={new Date('1994-12-17T00:00:00.000Z')}
47
+ maxDate={new Date('1996-12-17T00:00:00.000Z')}
48
+ confirmLabel="Confirm"
49
+ onChange={jest.fn()}
50
+ />
51
+ );
52
+
53
+ expect(toJSON()).toMatchSnapshot();
54
+ expect(getByTestId('datePickerInputAndroid')).toBeDefined();
55
+ });
56
+ });
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ import {
3
+ DatePicker as InternalDatePicker,
4
+ DatePickerProps,
5
+ } from '@hero-design/rn';
6
+ import TextInput from '../TextInput';
7
+
8
+ const DatePicker = (props: DatePickerProps) => {
9
+ return <InternalDatePicker {...props} TextInputComponent={TextInput} />;
10
+ };
11
+
12
+ export default Object.assign(DatePicker, { Dialog: InternalDatePicker.Dialog });