@@ -2208,7 +2208,7 @@ describe("Input general interaction", () => {
22082208
22092209 it ( "Should open suggestions popover if open is set on focusin" , ( ) => {
22102210 cy . mount (
2211- < Input id = "openPickerInput" showSuggestions = { true } onFocus = { ( e ) => ( e . target as Input ) . open = true } >
2211+ < Input id = "openPickerInput" showSuggestions = { true } startSuggestion = { 0 } onFocus = { ( e ) => ( e . target as Input ) . open = true } >
22122212 < SuggestionItem text = "China" />
22132213 < SuggestionItem text = "Chile" />
22142214 </ Input >
@@ -2280,7 +2280,7 @@ describe("Input general interaction", () => {
22802280
22812281 it ( "Changes text if cleared in change event handler" , ( ) => {
22822282 cy . mount (
2283- < Input id = "change-event-value" showSuggestions = { true } open = { true } onChange = { e => ( e . target as Input ) . value = "" } >
2283+ < Input id = "change-event-value" showSuggestions = { true } startSuggestion = { 0 } open = { true } onChange = { e => ( e . target as Input ) . value = "" } >
22842284 < SuggestionItem text = "China" />
22852285 < SuggestionItem text = "Chile" />
22862286 </ Input >
@@ -2601,7 +2601,7 @@ describe("Selection-change event", () => {
26012601describe ( "Property open" , ( ) => {
26022602 it ( "Suggestions picker is open when attribute open is set to true" , ( ) => {
26032603 cy . mount (
2604- < Input id = "input-suggestions-open" showSuggestions open >
2604+ < Input id = "input-suggestions-open" showSuggestions startSuggestion = { 0 } open >
26052605 < SuggestionItem text = "Item 1" />
26062606 < SuggestionItem text = "Item 2" />
26072607 < SuggestionItem text = "Item 3" />
@@ -2797,3 +2797,90 @@ describe("Input Composition", () => {
27972797 . should ( "have.attr" , "value" , "谢谢" ) ;
27982798 } ) ;
27992799} ) ;
2800+
2801+ describe ( "startSuggestion threshold behavior" , ( ) => {
2802+ it ( "suggestions popover opens when startSuggestion threshold is met" , ( ) => {
2803+ cy . mount (
2804+ < Input showSuggestions startSuggestion = { 3 } >
2805+ < SuggestionItem text = "Apple" > </ SuggestionItem >
2806+ < SuggestionItem text = "Apricot" > </ SuggestionItem >
2807+ < SuggestionItem text = "Banana" > </ SuggestionItem >
2808+ </ Input >
2809+ ) ;
2810+
2811+ cy . get ( "[ui5-input]" )
2812+ . as ( "input" )
2813+ . shadow ( )
2814+ . find ( "input" )
2815+ . as ( "innerInput" ) ;
2816+
2817+ cy . get ( "@innerInput" ) . realClick ( ) ;
2818+
2819+ cy . get ( "@innerInput" ) . realType ( "App" ) ;
2820+
2821+ cy . get ( "@input" )
2822+ . shadow ( )
2823+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
2824+ . ui5ResponsivePopoverOpened ( ) ;
2825+
2826+ cy . get ( "@innerInput" ) . realPress ( "Backspace" ) ;
2827+
2828+ cy . get ( "@input" )
2829+ . shadow ( )
2830+ . find ( "[ui5-responsive-popover]" )
2831+ . should ( "not.be.visible" ) ;
2832+ } ) ;
2833+
2834+ it ( "suggestions popover remains closed when typing below startSuggestion threshold" , ( ) => {
2835+ cy . mount (
2836+ < Input showSuggestions startSuggestion = { 4 } >
2837+ < SuggestionItem text = "Apple" > </ SuggestionItem >
2838+ < SuggestionItem text = "Application" > </ SuggestionItem >
2839+ < SuggestionItem text = "Banana" > </ SuggestionItem >
2840+ </ Input >
2841+ ) ;
2842+
2843+ cy . get ( "[ui5-input]" )
2844+ . as ( "input" )
2845+ . shadow ( )
2846+ . find ( "input" )
2847+ . as ( "innerInput" ) ;
2848+
2849+ cy . get ( "@innerInput" ) . realClick ( ) ;
2850+
2851+ cy . get ( "@innerInput" ) . realType ( "A" ) ;
2852+ cy . get ( "@input" )
2853+ . shadow ( )
2854+ . find ( "[ui5-responsive-popover]" )
2855+ . should ( "not.be.visible" ) ;
2856+
2857+ cy . get ( "@innerInput" ) . realType ( "p" ) ;
2858+ cy . get ( "@input" )
2859+ . shadow ( )
2860+ . find ( "[ui5-responsive-popover]" )
2861+ . should ( "not.be.visible" ) ;
2862+ } ) ;
2863+
2864+ it ( "suggestions popover is opened when startSuggestion is not set" , ( ) => {
2865+ cy . mount (
2866+ < Input showSuggestions >
2867+ < SuggestionItem text = "Apple" > </ SuggestionItem >
2868+ < SuggestionItem text = "Banana" > </ SuggestionItem >
2869+ </ Input >
2870+ ) ;
2871+
2872+ cy . get ( "[ui5-input]" )
2873+ . as ( "input" )
2874+ . shadow ( )
2875+ . find ( "input" )
2876+ . as ( "innerInput" ) ;
2877+
2878+ cy . get ( "@innerInput" ) . realClick ( ) ;
2879+
2880+ cy . get ( "@innerInput" ) . realType ( "A" ) ;
2881+ cy . get ( "@input" )
2882+ . shadow ( )
2883+ . find < ResponsivePopover > ( "[ui5-responsive-popover]" )
2884+ . ui5ResponsivePopoverOpened ( ) ;
2885+ } ) ;
2886+ } ) ;
0 commit comments