@transferwise/components 0.0.0-experimental-a656242 → 0.0.0-experimental-65a17ef
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.
package/package.json
CHANGED
|
@@ -11,9 +11,7 @@ describe('Date Input Component', () => {
|
|
|
11
11
|
mockResizeObserver();
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
afterEach(
|
|
15
|
-
jest.resetAllMocks();
|
|
16
|
-
});
|
|
14
|
+
afterEach(jest.clearAllMocks);
|
|
17
15
|
|
|
18
16
|
describe('when initialised without a model', () => {
|
|
19
17
|
it('sets day field to empty', () => {
|
|
@@ -99,12 +97,25 @@ describe('Date Input Component', () => {
|
|
|
99
97
|
});
|
|
100
98
|
|
|
101
99
|
it('calls the onChange callback with null when changing the month but nothing else is filled out', async () => {
|
|
100
|
+
console.time("t1");
|
|
102
101
|
render(<DateInput {...props} />);
|
|
103
102
|
const monthSelect = screen.getByLabelText(/month/i);
|
|
103
|
+
console.log(monthSelect ? '>>> monthSelect' : '>>> no monthSelect');
|
|
104
|
+
console.log('--------------------');
|
|
104
105
|
await userEvent.click(monthSelect);
|
|
105
|
-
|
|
106
|
+
|
|
107
|
+
const january = screen.getByRole('option', { name: /January/ });
|
|
108
|
+
console.log(january? '>>> january' : '>>> no january');
|
|
109
|
+
console.log('--------------------');
|
|
110
|
+
await userEvent.click(january);
|
|
111
|
+
|
|
112
|
+
// @ts-expect-error test
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
114
|
+
console.log(props.onChange?.mock?.calls);
|
|
106
115
|
expect(props.onChange).toHaveBeenCalledWith(null);
|
|
107
|
-
|
|
116
|
+
|
|
117
|
+
console.timeEnd("t1");
|
|
118
|
+
}, 10_000);
|
|
108
119
|
|
|
109
120
|
it('calls the onChange callback with null when changing the year but nothing else is filled out', async () => {
|
|
110
121
|
render(<DateInput {...props} />);
|
|
@@ -121,12 +132,24 @@ describe('Date Input Component', () => {
|
|
|
121
132
|
});
|
|
122
133
|
|
|
123
134
|
it('calls the onChange callback with the correct value when changing the month', async () => {
|
|
135
|
+
console.time("t2");
|
|
124
136
|
render(<DateInput {...props} value="2022-12-1" />);
|
|
125
137
|
const monthSelect = screen.getByRole('combobox', { name: /month/i });
|
|
138
|
+
console.log(monthSelect ? '>>> monthSelect' : '>>> no monthSelect');
|
|
139
|
+
console.log('--------------------');
|
|
126
140
|
await userEvent.click(monthSelect);
|
|
127
|
-
|
|
141
|
+
|
|
142
|
+
const january = screen.getByRole('option', { name: /January/ });
|
|
143
|
+
console.log(january? '>>> january' : '>>> no january');
|
|
144
|
+
console.log('--------------------');
|
|
145
|
+
await userEvent.click(january);
|
|
146
|
+
|
|
147
|
+
// @ts-expect-error test
|
|
148
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
149
|
+
console.log(props.onChange.mock.calls);
|
|
128
150
|
expect(props.onChange).toHaveBeenCalledWith('2022-01-01');
|
|
129
|
-
|
|
151
|
+
console.timeEnd("t2");
|
|
152
|
+
}, 10_000);
|
|
130
153
|
|
|
131
154
|
it('calls the onChange callback with the correct value when changing the year', async () => {
|
|
132
155
|
render(<DateInput {...props} value="0122-12-1" />);
|