File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
packages/next/src/views/API Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ export const APIViewClient: React.FC = () => {
187
187
max = { 10 }
188
188
min = { 0 }
189
189
name = "depth"
190
- onChange = { ( value ) => setDepth ( value . toString ( ) ) }
190
+ onChange = { ( value ) => setDepth ( value ? .toString ( ) ) }
191
191
path = "depth"
192
192
step = { 1 }
193
193
/>
Original file line number Diff line number Diff line change @@ -312,6 +312,15 @@ describe('admin', () => {
312
312
await expect ( page . locator ( '#field-sidebarField' ) ) . toBeDisabled ( )
313
313
} )
314
314
315
+ test ( 'collection — depth field should have value 0 when empty' , async ( ) => {
316
+ const { id } = await createPost ( )
317
+ await page . goto ( `${ postsUrl . edit ( id ) } /api` )
318
+
319
+ const depthField = page . locator ( '#field-depth' )
320
+ await depthField . fill ( '' )
321
+ await expect ( depthField ) . toHaveValue ( '0' )
322
+ } )
323
+
315
324
test ( 'global — should not show API tab when disabled in config' , async ( ) => {
316
325
await page . goto ( postsUrl . global ( noApiViewGlobalSlug ) )
317
326
await expect ( page . locator ( '.doc-tabs__tabs-container' ) ) . not . toContainText ( 'API' )
You can’t perform that action at this time.
0 commit comments