@@ -123,7 +123,7 @@ describe("ListItemCustom - _onfocusin and _onfocusout Tests", () => {
123123 cy . get ( "#li-custom-ui5" )
124124 . shadow ( )
125125 . find ( `#${ itemId } -invisibleTextContent` )
126- . should ( "have.text" , "List Item Click me Button Check option Checkbox Not checked required" ) ;
126+ . should ( "have.text" , "List Item Button Click me Checkbox Check option Not checked required" ) ;
127127
128128 // Check that aria-labelledby on the internal li element includes the invisibleTextContent span id
129129 cy . get ( "#li-custom-ui5" )
@@ -167,7 +167,7 @@ describe("ListItemCustom - _onfocusin and _onfocusout Tests", () => {
167167 cy . get ( "#li-custom-ui5-focus" )
168168 . shadow ( )
169169 . find ( `#${ itemId } -invisibleTextContent` )
170- . should ( "have.text" , "List Item Click Me Button Check Option Checkbox Not checked" ) ;
170+ . should ( "have.text" , "List Item Button Click Me Checkbox Check Option Not checked" ) ;
171171
172172 // Check that aria-labelledby on the internal li element includes the invisibleTextContent span id
173173 cy . get ( "#li-custom-ui5-focus" )
@@ -186,7 +186,7 @@ describe("ListItemCustom - _onfocusin and _onfocusout Tests", () => {
186186 cy . get ( "#li-custom-ui5-focus" )
187187 . shadow ( )
188188 . find ( `#${ itemId } -invisibleTextContent` )
189- . should ( "have.text" , "List Item Click Me Button Check Option Checkbox Not checked" ) ;
189+ . should ( "have.text" , "List Item Button Click Me Checkbox Check Option Not checked" ) ;
190190 } ) ;
191191
192192 // Click outside the list to truly remove focus
@@ -230,7 +230,7 @@ describe("ListItemCustom - _onfocusin and _onfocusout Tests", () => {
230230 cy . get ( "#li-custom-nested" )
231231 . shadow ( )
232232 . find ( `#${ itemId } -invisibleTextContent` )
233- . should ( "have.text" , "List Item Container Text Nested Button Button Paragraph outside container" ) ;
233+ . should ( "have.text" , "List Item Container Text Button Nested Button Paragraph outside container" ) ;
234234
235235 // Check that aria-labelledby on the internal li element includes the invisibleTextContent span id
236236 cy . get ( "#li-custom-nested" )
@@ -270,7 +270,7 @@ describe("ListItemCustom - _onfocusin and _onfocusout Tests", () => {
270270 cy . get ( "#li-custom-deep-nested" )
271271 . shadow ( )
272272 . find ( `#${ itemId } -invisibleTextContent` )
273- . should ( "have.text" , "List Item Deeply Nested Button Button Level 2 Text Nested Checkbox Not checked" ) ;
273+ . should ( "have.text" , "List Item Button Deeply Nested Button Level 2 Text Checkbox Nested Not checked" ) ;
274274
275275 // Check that aria-labelledby on the internal li element includes the invisibleTextContent span id
276276 cy . get ( "#li-custom-deep-nested" )
@@ -293,6 +293,64 @@ describe("ListItemCustom - _onfocusin and _onfocusout Tests", () => {
293293 } ) ;
294294 } ) ;
295295
296+ describe ( "With delete mode and custom delete button" , ( ) => {
297+ it ( "should handle ListItemCustom with delete mode and custom delete button" , ( ) => {
298+ // Mount ListItemCustom with delete mode and custom delete button
299+ cy . mount (
300+ < List selectionMode = "Delete" >
301+ < ListItemCustom id = "li-custom-delete" >
302+ < div > Delete Mode Item</ div >
303+ < Button slot = "deleteButton" id = "custom-delete-button" >
304+ Remove
305+ </ Button >
306+ </ ListItemCustom >
307+ </ List >
308+ ) ;
309+
310+ // Store the component ID
311+ cy . get ( "#li-custom-delete" ) . invoke ( "prop" , "_id" ) . as ( "itemId" ) ;
312+
313+ // Focus the list item
314+ cy . get ( "#li-custom-delete" ) . click ( ) ;
315+
316+ // Verify text content is processed and included in the invisible text
317+ cy . get ( "@itemId" ) . then ( itemId => {
318+ cy . get ( "#li-custom-delete" )
319+ . shadow ( )
320+ . find ( `#${ itemId } -invisibleTextContent` )
321+ . should ( "have.text" , "List Item Delete Mode Item Button Remove" ) ;
322+
323+ // Check that aria-labelledby on the internal li element includes the invisibleTextContent span id
324+ cy . get ( "#li-custom-delete" )
325+ . shadow ( )
326+ . find ( "li[part='native-li']" )
327+ . should ( "have.attr" , "aria-labelledby" )
328+ . and ( "include" , `${ itemId } -invisibleTextContent` ) ;
329+
330+ // Verify that the custom delete button is properly rendered in the shadow DOM
331+ cy . get ( "#li-custom-delete" )
332+ . shadow ( )
333+ . find ( "div.ui5-li-deletebtn" )
334+ . should ( "exist" )
335+ . and ( "contain" , "Remove" ) ;
336+
337+ // Check that clicking the delete button triggers the delete event
338+ cy . get ( "#custom-delete-button" ) . should ( "exist" ) ;
339+ } ) ;
340+
341+ // Remove focus
342+ cy . focused ( ) . blur ( ) ;
343+
344+ // After blur, invisible text content should be cleared
345+ cy . get ( "@itemId" ) . then ( itemId => {
346+ cy . get ( "#li-custom-delete" )
347+ . shadow ( )
348+ . find ( `#${ itemId } -invisibleTextContent` )
349+ . should ( "have.text" , "" ) ;
350+ } ) ;
351+ } ) ;
352+ } ) ;
353+
296354 describe ( "Edge cases" , ( ) => {
297355 it ( "should handle empty list item content" , ( ) => {
298356 cy . mount (
0 commit comments