@@ -7,6 +7,7 @@ import Link from "../../src/Link.js";
77
88import add from "@ui5/webcomponents-icons/dist/add.js" ;
99import type ResponsivePopover from "../../src/ResponsivePopover.js" ;
10+ import { INPUT_SUGGESTIONS_EXPANDED , INPUT_SUGGESTIONS_COLLAPSED , INPUT_SUGGESTIONS_MORE_HITS } from "../../src/generated/i18n/i18n-defaults.js" ;
1011
1112describe ( "Input Tests" , ( ) => {
1213 it ( "test input event prevention" , ( ) => {
@@ -1364,6 +1365,71 @@ describe("Accessibility", () => {
13641365 } ) ;
13651366} ) ;
13661367
1368+ describe ( "Suggestions expanded/collapsed announcement" , ( ) => {
1369+ it ( "Should include 'Expanded' in suggestions count when popover opens" , ( ) => {
1370+ cy . mount (
1371+ < Input showSuggestions >
1372+ < SuggestionItem text = "Item 1" />
1373+ < SuggestionItem text = "Item 2" />
1374+ </ Input >
1375+ ) ;
1376+
1377+ cy . get ( "[ui5-input]" )
1378+ . as ( "input" )
1379+ . realClick ( ) ;
1380+
1381+ cy . get ( "@input" )
1382+ . shadow ( )
1383+ . find ( "input" )
1384+ . realType ( "I" ) ;
1385+
1386+ cy . get ( "@input" )
1387+ . shadow ( )
1388+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
1389+ . ui5ResponsivePopoverOpened ( ) ;
1390+
1391+ cy . get ( "@input" )
1392+ . shadow ( )
1393+ . find ( "#suggestionsCount" )
1394+ . should ( "contain.text" , INPUT_SUGGESTIONS_EXPANDED . defaultText ) ;
1395+ } ) ;
1396+
1397+ it ( "Should announce 'Collapsed' when suggestions popover closes" , ( ) => {
1398+ cy . mount (
1399+ < Input showSuggestions >
1400+ < SuggestionItem text = "Item 1" />
1401+ < SuggestionItem text = "Item 2" />
1402+ </ Input >
1403+ ) ;
1404+
1405+ cy . get ( "[ui5-input]" )
1406+ . as ( "input" )
1407+ . realClick ( ) ;
1408+
1409+ cy . get ( "@input" )
1410+ . shadow ( )
1411+ . find ( "input" )
1412+ . realType ( "I" ) ;
1413+
1414+ cy . get ( "@input" )
1415+ . shadow ( )
1416+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
1417+ . ui5ResponsivePopoverOpened ( ) ;
1418+
1419+ cy . realPress ( "Escape" ) ;
1420+
1421+ cy . get ( "@input" )
1422+ . shadow ( )
1423+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
1424+ . ui5ResponsivePopoverClosed ( ) ;
1425+
1426+ cy . get ( "@input" )
1427+ . shadow ( )
1428+ . find ( "#suggestionsCount" )
1429+ . should ( "contain.text" , INPUT_SUGGESTIONS_COLLAPSED . defaultText ) ;
1430+ } ) ;
1431+ } ) ;
1432+
13671433describe ( "Attribute propagation" , ( ) => {
13681434 it ( "Should change the placeholder of the inner input" , ( ) => {
13691435 const placeholder = "New placeholder text" ;
@@ -2134,17 +2200,17 @@ describe("Input general interaction", () => {
21342200 ) ;
21352201
21362202 cy . get ( "#inputCompact" ) . click ( ) ;
2137- cy . get ( "#inputCompact" ) . shadow ( ) . find ( "#suggestionsCount" ) . should ( "have.text" , "" ) ;
2203+ cy . get ( "#inputCompact" ) . shadow ( ) . find ( "#suggestionsCount" ) . should ( "have.text" , "Collapsed " ) ;
21382204
21392205 cy . get ( "#inputCompact" ) . shadow ( ) . find ( "input" ) . realType ( "c" ) ;
2140- cy . get ( "#inputCompact" ) . shadow ( ) . find ( "#suggestionsCount" ) . should ( "have.text" , "3 results are available" ) ;
2206+ cy . get ( "#inputCompact" ) . shadow ( ) . find ( "#suggestionsCount" ) . should ( "have.text" , "3 results are available Expanded " ) ;
21412207
21422208 cy . get ( "#inputCompact" ) . shadow ( ) . find ( "input" ) . realType ( "{backspace}" ) ;
21432209 cy . get ( "#inputCompact" ) . shadow ( ) . find ( "input" ) . realType ( "{esc}" ) ;
21442210
21452211 cy . get ( "#myInput2" ) . click ( ) ;
21462212 cy . get ( "#myInput2" ) . shadow ( ) . find ( "input" ) . realType ( "c" ) ;
2147- cy . get ( "#myInput2" ) . shadow ( ) . find ( "#suggestionsCount" ) . should ( "have.text" , "5 results are available" ) ;
2213+ cy . get ( "#myInput2" ) . shadow ( ) . find ( "#suggestionsCount" ) . should ( "have.text" , "5 results are available Expanded " ) ;
21482214 } ) ;
21492215
21502216 it ( "Should close the Popover when no suggestions are available" , ( ) => {
0 commit comments