@@ -304,23 +304,36 @@ describe('SelectDialog', () => {
304304 cy . findByTestId ( 'confirmBtn' ) . should ( 'have.attr' , 'design' , 'Emphasized' ) ;
305305 } ) ;
306306
307- it ( 'invisible messaging' , ( ) => {
308- cy . mount (
309- < SelectDialog open selectionMode = { ListSelectionMode . Multiple } >
310- < ListItemStandard text = { 'ListItem 1' } data-testid = "1" />
311- < ListItemStandard text = { 'ListItem 2' } data-testid = "2" />
312- < ListItemStandard text = { 'ListItem 3' } data-testid = "3" />
313- < ListItemStandard text = { 'ListItem 4' } data-testid = "4" />
314- </ SelectDialog > ,
315- ) ;
316- cy . findByTestId ( '1' ) . click ( ) ;
317- cy . get ( 'ui5-announcement-area' ) . should ( 'contain.text' , 'Selected Items 1' ) ;
318- cy . findByTestId ( '1' ) . click ( ) ;
319- cy . get ( 'ui5-announcement-area' ) . should ( 'not.contain.text' , 'Selected Items 1' ) ;
320- cy . findByTestId ( '1' ) . click ( ) ;
321- cy . findByTestId ( '2' ) . click ( ) ;
322- cy . findByTestId ( '3' ) . click ( ) ;
323- cy . findByTestId ( '4' ) . click ( ) ;
324- cy . get ( 'ui5-announcement-area' ) . should ( 'contain.text' , 'Selected Items 4' ) ;
325- } ) ;
307+ for ( let i = 0 ; i <= 100 ; ++ i ) {
308+ it . only ( 'invisible messaging' , ( ) => {
309+ cy . mount (
310+ < SelectDialog open selectionMode = { ListSelectionMode . Multiple } >
311+ < ListItemStandard text = { 'ListItem 1' } data-testid = "1" />
312+ < ListItemStandard text = { 'ListItem 2' } data-testid = "2" />
313+ < ListItemStandard text = { 'ListItem 3' } data-testid = "3" />
314+ < ListItemStandard text = { 'ListItem 4' } data-testid = "4" />
315+ </ SelectDialog > ,
316+ ) ;
317+ // Note: announce() from @ui5/webcomponents-base sets textContent="" before setting the message,
318+ // creating a brief moment where the text is empty. cy.wait(0) yields to the event loop to let the DOM settle.
319+ cy . findByTestId ( '1' ) . click ( ) ;
320+ cy . findByTestId ( '1' ) . should ( 'have.attr' , 'selected' ) ;
321+ cy . wait ( 0 ) ;
322+ cy . get ( 'ui5-announcement-area' ) . should ( 'contain.text' , 'Selected Items 1' ) ;
323+ cy . findByTestId ( '1' ) . click ( ) ;
324+ cy . findByTestId ( '1' ) . should ( 'not.have.attr' , 'selected' ) ;
325+ cy . wait ( 0 ) ;
326+ cy . get ( 'ui5-announcement-area' ) . should ( 'not.contain.text' , 'Selected Items 1' ) ;
327+ cy . findByTestId ( '1' ) . click ( ) ;
328+ cy . findByTestId ( '1' ) . should ( 'have.attr' , 'selected' ) ;
329+ cy . findByTestId ( '2' ) . click ( ) ;
330+ cy . findByTestId ( '2' ) . should ( 'have.attr' , 'selected' ) ;
331+ cy . findByTestId ( '3' ) . click ( ) ;
332+ cy . findByTestId ( '3' ) . should ( 'have.attr' , 'selected' ) ;
333+ cy . findByTestId ( '4' ) . click ( ) ;
334+ cy . findByTestId ( '4' ) . should ( 'have.attr' , 'selected' ) ;
335+ cy . wait ( 0 ) ;
336+ cy . get ( 'ui5-announcement-area' ) . should ( 'contain.text' , 'Selected Items 4' ) ;
337+ } ) ;
338+ }
326339} ) ;
0 commit comments