Skip to content

Commit c0cb135

Browse files
Chore update grid snapshot tests to use @testing-library/react (#4845)
* Chore update grid snapshot to use @testing-library/react In order to prep for React 19, began conversion from `react-test-renderer` to `@testing-library/react` for the `gridTests.tsx` - Updated `snapshot-tests` to convert the `gridTests.tsx` to use `@testing-library/react` - Updated all snapshots accordingly * - Renamed `GridSnap.test.tsx` to `Grid.test.tsx` in all themes but `core`
1 parent ff855d7 commit c0cb135

File tree

32 files changed

+84333
-82010
lines changed

32 files changed

+84333
-82010
lines changed

packages/antd/test/Grid.test.tsx

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
import { gridTests } from '@rjsf/snapshot-tests';
2+
3+
import '../__mocks__/matchMedia.mock';
4+
import Form from '../src';
5+
6+
gridTests(Form, {
7+
ColumnWidthAll: { xs: 24 },
8+
ColumnWidth4: { xs: 8 },
9+
ColumnWidth6: { xs: 12 },
10+
ColumnWidth8: { xs: 16 },
11+
ComplexUiSchema: {
12+
'ui:field': 'LayoutGridField',
13+
'ui:layoutGrid': {
14+
'ui:row': {
15+
children: [
16+
{
17+
'ui:row': {
18+
children: [
19+
{
20+
'ui:col': {
21+
xs: 24,
22+
children: ['person'],
23+
},
24+
},
25+
],
26+
},
27+
},
28+
{
29+
'ui:row': {
30+
gutter: [6, 0],
31+
children: [
32+
{
33+
'ui:columns': {
34+
xs: 8,
35+
children: ['person.name.first', 'person.name.middle', 'person.name.last'],
36+
},
37+
},
38+
],
39+
},
40+
},
41+
{
42+
'ui:row': {
43+
gutter: [6, 0],
44+
children: [
45+
{
46+
'ui:col': {
47+
xs: 8,
48+
children: [
49+
{
50+
name: 'person.birth_date',
51+
placeholder: '$lookup=PlaceholderText',
52+
},
53+
],
54+
},
55+
},
56+
{
57+
'ui:col': {
58+
xs: 16,
59+
children: ['person.race'],
60+
},
61+
},
62+
],
63+
},
64+
},
65+
{
66+
'ui:row': {
67+
gutter: [6, 0],
68+
children: [
69+
{
70+
'ui:col': {
71+
xs: 12,
72+
children: ['person.address'],
73+
},
74+
},
75+
{
76+
'ui:col': {
77+
xs: 12,
78+
children: [
79+
{
80+
'ui:row': {
81+
children: [
82+
{
83+
'ui:col': {
84+
xs: 24,
85+
style: { margin: '44px 0 30px' },
86+
children: ['employment'],
87+
},
88+
},
89+
{
90+
'ui:condition': {
91+
field: 'employment.job_type',
92+
value: 'company',
93+
operator: 'all',
94+
children: [
95+
{
96+
'ui:columns': {
97+
xs: 24,
98+
children: ['employment.business', 'employment.title'],
99+
},
100+
},
101+
{
102+
'ui:row': {
103+
gutter: [6, 0],
104+
children: [
105+
{
106+
'ui:col': {
107+
xs: 16,
108+
children: ['employment.location.city'],
109+
},
110+
},
111+
{
112+
'ui:col': {
113+
xs: 8,
114+
children: ['employment.location.state'],
115+
},
116+
},
117+
],
118+
},
119+
},
120+
],
121+
},
122+
},
123+
{
124+
'ui:condition': {
125+
field: 'employment.job_type',
126+
value: 'education',
127+
operator: 'all',
128+
children: [
129+
{
130+
'ui:columns': {
131+
xs: 24,
132+
children: ['employment.district', 'employment.school', 'employment.title'],
133+
},
134+
},
135+
{
136+
'ui:row': {
137+
gutter: [6, 0],
138+
children: [
139+
{
140+
'ui:col': {
141+
xs: 16,
142+
children: ['employment.location.city'],
143+
},
144+
},
145+
{
146+
'ui:col': {
147+
xs: 8,
148+
children: ['employment.location.state'],
149+
},
150+
},
151+
],
152+
},
153+
},
154+
],
155+
},
156+
},
157+
{
158+
'ui:condition': {
159+
field: 'employment.job_type',
160+
value: 'other',
161+
operator: 'all',
162+
children: [
163+
{
164+
'ui:columns': {
165+
xs: 24,
166+
children: [
167+
{
168+
name: 'employment.description',
169+
rows: 6,
170+
},
171+
],
172+
},
173+
},
174+
],
175+
},
176+
},
177+
],
178+
},
179+
},
180+
],
181+
},
182+
},
183+
],
184+
},
185+
},
186+
],
187+
},
188+
},
189+
person: {
190+
'ui:field': 'LayoutHeaderField',
191+
race: {
192+
'ui:options': {
193+
widget: 'checkboxes',
194+
},
195+
},
196+
address: {
197+
'ui:field': 'LayoutGridField',
198+
'ui:layoutGrid': {
199+
'ui:row': {
200+
children: [
201+
{
202+
'ui:columns': {
203+
xs: 24,
204+
children: ['line_1', 'line_2', 'city'],
205+
},
206+
},
207+
{
208+
'ui:row': {
209+
gutter: [6, 0],
210+
children: [
211+
{
212+
'ui:columns': {
213+
xs: 12,
214+
children: ['state', 'postal_code'],
215+
},
216+
},
217+
],
218+
},
219+
},
220+
],
221+
},
222+
},
223+
},
224+
},
225+
employment: {
226+
'ui:options': {
227+
inline: true,
228+
},
229+
description: {
230+
'ui:widget': 'textarea',
231+
},
232+
},
233+
},
234+
});

0 commit comments

Comments
 (0)