File tree Expand file tree Collapse file tree 2 files changed +29
-2
lines changed
packages/ui/src/forms/RenderFields Expand file tree Collapse file tree 2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,19 @@ export const RenderField: React.FC<Props> = ({
85
85
/>
86
86
)
87
87
} else {
88
+ if ( fieldComponentProps . field . type === 'row' ) {
89
+ for ( const field of fieldComponentProps . field . fields ) {
90
+ if ( field . admin ?. width ) {
91
+ field . admin . style = {
92
+ ...field . admin . style ,
93
+ maxWidth : field . admin . width ,
94
+ }
95
+
96
+ field . admin . width = undefined
97
+ }
98
+ }
99
+ }
100
+
88
101
RenderedField = (
89
102
< RenderComponent
90
103
Component = { fieldComponents ?. [ fieldComponentProps ?. field ?. type ] }
Original file line number Diff line number Diff line change 1
- import type { Page } from '@playwright/test'
1
+ import type { Locator , Page } from '@playwright/test'
2
2
3
3
import { expect , test } from '@playwright/test'
4
4
import path from 'path'
@@ -374,9 +374,23 @@ describe('fields', () => {
374
374
test ( 'should render row fields inline and with explicit widths' , async ( ) => {
375
375
await page . goto ( url . create )
376
376
const fieldA = page . locator ( 'input#field-field_with_width_a' )
377
- await expect ( fieldA ) . toBeVisible ( )
378
377
const fieldB = page . locator ( 'input#field-field_with_width_b' )
378
+
379
+ const fieldAGrandprent = fieldA . locator ( '..' ) . locator ( '..' )
380
+ const fieldBGrandprent = fieldB . locator ( '..' ) . locator ( '..' )
381
+
382
+ await expect ( fieldA ) . toBeVisible ( )
379
383
await expect ( fieldB ) . toBeVisible ( )
384
+
385
+ const hasCorrectCSS = async ( el : Locator ) => {
386
+ return await el . evaluate ( ( el ) => {
387
+ return el . style . width === '' && el . style . maxWidth === '50%'
388
+ } )
389
+ }
390
+
391
+ expect ( hasCorrectCSS ( fieldAGrandprent ) ) . toBeTruthy ( )
392
+ expect ( hasCorrectCSS ( fieldBGrandprent ) ) . toBeTruthy ( )
393
+
380
394
const fieldABox = await fieldA . boundingBox ( )
381
395
const fieldBBox = await fieldB . boundingBox ( )
382
396
You can’t perform that action at this time.
0 commit comments