Skip to content

Commit 7cdac27

Browse files
authored
fix(rna): expose validationErrors, style errors (#3063)
1 parent 5763de9 commit 7cdac27

File tree

20 files changed

+1343
-89
lines changed

20 files changed

+1343
-89
lines changed

packages/react-native/src/Authenticator/Defaults/ConfirmResetPassword/__tests__/__snapshots__/ConfirmResetPassword.spec.tsx.snap

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Array [
2626
<View
2727
style={
2828
Object {
29-
"paddingBottom": 12,
29+
"paddingBottom": 8,
3030
}
3131
}
3232
>
@@ -473,7 +473,8 @@ Array [
473473
null,
474474
null,
475475
Object {
476-
"margin": 16,
476+
"marginHorizontal": 16,
477+
"marginVertical": 12,
477478
},
478479
]
479480
}
@@ -525,7 +526,7 @@ Array [
525526
null,
526527
null,
527528
Object {
528-
"margin": 16,
529+
"marginHorizontal": 16,
529530
},
530531
]
531532
}
@@ -575,7 +576,7 @@ Array [
575576
<View
576577
style={
577578
Object {
578-
"paddingBottom": 12,
579+
"paddingBottom": 8,
579580
}
580581
}
581582
>
@@ -969,7 +970,8 @@ Array [
969970
null,
970971
null,
971972
Object {
972-
"margin": 16,
973+
"marginHorizontal": 16,
974+
"marginVertical": 12,
973975
},
974976
]
975977
}
@@ -1021,7 +1023,7 @@ Array [
10211023
null,
10221024
null,
10231025
Object {
1024-
"margin": 16,
1026+
"marginHorizontal": 16,
10251027
},
10261028
]
10271029
}

packages/react-native/src/Authenticator/Defaults/ConfirmSignIn/__tests__/__snapshots__/ConfirmSignIn.spec.tsx.snap

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Array [
2626
<View
2727
style={
2828
Object {
29-
"paddingBottom": 12,
29+
"paddingBottom": 8,
3030
}
3131
}
3232
>
@@ -195,7 +195,8 @@ Array [
195195
null,
196196
null,
197197
Object {
198-
"margin": 16,
198+
"marginHorizontal": 16,
199+
"marginVertical": 12,
199200
},
200201
]
201202
}
@@ -305,7 +306,7 @@ Array [
305306
<View
306307
style={
307308
Object {
308-
"paddingBottom": 12,
309+
"paddingBottom": 8,
309310
}
310311
}
311312
>
@@ -421,7 +422,8 @@ Array [
421422
null,
422423
null,
423424
Object {
424-
"margin": 16,
425+
"marginHorizontal": 16,
426+
"marginVertical": 12,
425427
},
426428
]
427429
}

packages/react-native/src/Authenticator/Defaults/ConfirmSignUp/__tests__/__snapshots__/ConfirmSignUp.spec.tsx.snap

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Array [
4747
<View
4848
style={
4949
Object {
50-
"paddingBottom": 12,
50+
"paddingBottom": 8,
5151
}
5252
}
5353
/>,
@@ -81,7 +81,8 @@ Array [
8181
null,
8282
null,
8383
Object {
84-
"margin": 16,
84+
"marginHorizontal": 16,
85+
"marginVertical": 12,
8586
},
8687
]
8788
}
@@ -133,7 +134,7 @@ Array [
133134
null,
134135
null,
135136
Object {
136-
"margin": 16,
137+
"marginHorizontal": 16,
137138
},
138139
]
139140
}
@@ -204,7 +205,7 @@ Array [
204205
<View
205206
style={
206207
Object {
207-
"paddingBottom": 12,
208+
"paddingBottom": 8,
208209
}
209210
}
210211
/>,
@@ -238,7 +239,8 @@ Array [
238239
null,
239240
null,
240241
Object {
241-
"margin": 16,
242+
"marginHorizontal": 16,
243+
"marginVertical": 12,
242244
},
243245
]
244246
}
@@ -290,7 +292,7 @@ Array [
290292
null,
291293
null,
292294
Object {
293-
"margin": 16,
295+
"marginHorizontal": 16,
294296
},
295297
]
296298
}
@@ -361,7 +363,7 @@ Array [
361363
<View
362364
style={
363365
Object {
364-
"paddingBottom": 12,
366+
"paddingBottom": 8,
365367
}
366368
}
367369
/>,
@@ -448,7 +450,8 @@ Array [
448450
null,
449451
null,
450452
Object {
451-
"margin": 16,
453+
"marginHorizontal": 16,
454+
"marginVertical": 12,
452455
},
453456
]
454457
}
@@ -500,7 +503,7 @@ Array [
500503
null,
501504
null,
502505
Object {
503-
"margin": 16,
506+
"marginHorizontal": 16,
504507
},
505508
]
506509
}

packages/react-native/src/Authenticator/Defaults/ConfirmVerifyUser/__tests__/__snapshots__/ConfirmVerifyUser.spec.tsx.snap

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Array [
2626
<View
2727
style={
2828
Object {
29-
"paddingBottom": 12,
29+
"paddingBottom": 8,
3030
}
3131
}
3232
/>,
@@ -60,7 +60,8 @@ Array [
6060
null,
6161
null,
6262
Object {
63-
"margin": 16,
63+
"marginHorizontal": 16,
64+
"marginVertical": 12,
6465
},
6566
]
6667
}
@@ -170,7 +171,7 @@ Array [
170171
<View
171172
style={
172173
Object {
173-
"paddingBottom": 12,
174+
"paddingBottom": 8,
174175
}
175176
}
176177
/>,
@@ -204,7 +205,8 @@ Array [
204205
null,
205206
null,
206207
Object {
207-
"margin": 16,
208+
"marginHorizontal": 16,
209+
"marginVertical": 12,
208210
},
209211
]
210212
}
@@ -314,7 +316,7 @@ Array [
314316
<View
315317
style={
316318
Object {
317-
"paddingBottom": 12,
319+
"paddingBottom": 8,
318320
}
319321
}
320322
/>,
@@ -401,7 +403,8 @@ Array [
401403
null,
402404
null,
403405
Object {
404-
"margin": 16,
406+
"marginHorizontal": 16,
407+
"marginVertical": 12,
405408
},
406409
]
407410
}

packages/react-native/src/Authenticator/Defaults/ForceNewPassword/__tests__/ForceNewPassword.spec.tsx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { fireEvent, render } from '@testing-library/react-native';
33

44
import { authenticatorTextUtil } from '@aws-amplify/ui';
55

6+
import { TextFieldOptionsType } from '../../../hooks';
67
import { ForceNewPassword } from '..';
78

89
const props = {
9-
fields: [],
10+
fields: [{ name: 'password', type: 'password' } as TextFieldOptionsType],
1011
Footer: ForceNewPassword.Footer,
1112
FormFields: ForceNewPassword.FormFields,
1213
handleBlur: jest.fn(),
@@ -59,4 +60,19 @@ describe('ForceNewPassword', () => {
5960

6061
expect(queryByText(getChangingText())).toBeTruthy();
6162
});
63+
64+
it('renders as expected with validationErrors', () => {
65+
const { toJSON, getByText } = render(
66+
<ForceNewPassword
67+
{...props}
68+
isPending
69+
validationErrors={{ password: ['error', 'another error'] }}
70+
/>
71+
);
72+
73+
expect(toJSON()).toMatchSnapshot();
74+
75+
expect(getByText('error')).toBeDefined();
76+
expect(getByText('another error')).toBeDefined();
77+
});
6278
});

0 commit comments

Comments
 (0)