@@ -2201,6 +2201,43 @@ describe('List View', () => {
22012201 ) ,
22022202 )
22032203 } )
2204+
2205+ test ( 'should disable linking in ListDrawer for documents with formatDocURL returning null' , async ( ) => {
2206+ await payload . create ( {
2207+ collection : formatDocURLCollectionSlug ,
2208+ data : { title : 'no-link' , description : 'This should not be linkable in drawer' } ,
2209+ } )
2210+
2211+ await payload . create ( {
2212+ collection : formatDocURLCollectionSlug ,
2213+ data : { title : 'linkable' , description : 'This should be linkable in drawer' } ,
2214+ } )
2215+
2216+ await page . goto ( formatDocURLUrl . list )
2217+
2218+ const selectButton = page . locator ( 'button:has-text("Select format doc")' )
2219+ await selectButton . waitFor ( { state : 'visible' } )
2220+ await selectButton . click ( )
2221+
2222+ const listDrawer = page . locator ( '.list-drawer.drawer--is-open' )
2223+ await listDrawer . waitFor ( { state : 'visible' } )
2224+ await expect ( listDrawer ) . toBeVisible ( )
2225+
2226+ await expect ( listDrawer . locator ( 'table tbody tr' ) ) . toHaveCount ( 2 )
2227+
2228+ // The 'no-link' row should NOT have any clickable link-styled cell —
2229+ // formatDocURL returned null for it, so the drawer must not attach the
2230+ // underline className or the selection click handler to any cell.
2231+ const noLinkRow = listDrawer . locator ( 'table tbody tr' ) . filter ( { hasText : 'no-link' } )
2232+ await expect ( noLinkRow . locator ( 'button.default-cell__first-cell' ) ) . toHaveCount ( 0 )
2233+ await expect ( noLinkRow . locator ( 'a' ) ) . toHaveCount ( 0 )
2234+
2235+ // The 'linkable' row's linked cell should still be rendered as a
2236+ // clickable selection button (drawer overrides the link with an
2237+ // onSelect handler).
2238+ const linkableRow = listDrawer . locator ( 'table tbody tr' ) . filter ( { hasText : 'linkable' } )
2239+ await expect ( linkableRow . locator ( 'button.default-cell__first-cell' ) ) . toHaveCount ( 1 )
2240+ } )
22042241 } )
22052242} )
22062243
0 commit comments