@@ -52,6 +52,17 @@ describe("USERCONTROL Combobox >", () => {
5252 let comboboxAppendToBody : ComboboxAtom ;
5353 let comboboxRemoveValueButton : ComboboxAtom ;
5454
55+ const applySafeType = async ( atom : ComboboxAtom , text : string ) : Promise < void > => {
56+ await atom . acceptInput ( text ) ;
57+ if ( ( await atom . getInputValue ( ) ) !== text ) {
58+ await atom . clearText ( ) ;
59+ for ( const char of text ) { // Type character by character to prevent lost spaces
60+ await atom . getInput ( ) . sendKeys ( char ) ;
61+ await browser . sleep ( 20 ) ; // Small delay to ensure stability in CI
62+ }
63+ }
64+ } ;
65+
5566 beforeAll ( ( ) => {
5667 comboboxBasic = Atom . find ( ComboboxAtom , "nui-demo-basic-combobox" ) ;
5768 comboboxDisabled = Atom . find (
@@ -135,7 +146,7 @@ describe("USERCONTROL Combobox >", () => {
135146
136147 it ( "should change the model after changing the text input" , async ( ) => {
137148 const inputText = "Some text" ;
138- await comboboxBasic . acceptInput ( inputText ) ;
149+ await applySafeType ( comboboxBasic , inputText ) ;
139150 expect ( await comboboxBasic . getInputValue ( ) ) . toEqual ( inputText ) ;
140151 } ) ;
141152
@@ -182,13 +193,13 @@ describe("USERCONTROL Combobox >", () => {
182193
183194 describe ( "clear on blur >" , ( ) => {
184195 it ( "should clear input on blur if it's value is not in source array" , async ( ) => {
185- await comboClearOnBlur . acceptInput ( "Not in a source array" ) ;
196+ await applySafeType ( comboClearOnBlur , "Not in a source array" ) ;
186197 await browser . actions ( ) . sendKeys ( protractor . Key . TAB ) . perform ( ) ;
187198 expect ( await comboClearOnBlur . getInputValue ( ) ) . toEqual ( "" ) ;
188199 } ) ;
189200
190201 it ( "should keep input value in input on blur if it's value is in source array" , async ( ) => {
191- await comboClearOnBlur . acceptInput ( "Item 1" ) ;
202+ await applySafeType ( comboClearOnBlur , "Item 1" ) ;
192203 await browser . actions ( ) . sendKeys ( protractor . Key . TAB ) . perform ( ) ;
193204 expect ( await comboClearOnBlur . getInputValue ( ) ) . toEqual (
194205 "Item 1"
@@ -376,7 +387,7 @@ describe("USERCONTROL Combobox >", () => {
376387 await comboboxSeparators . waitElementVisible ( ) ;
377388 await comboboxSeparators . toggleMenu ( ) ;
378389 expect ( await comboboxSeparators . getItemsCount ( ) ) . toEqual ( 9 ) ;
379- await comboboxSeparators . acceptInput ( "Item 1" ) ;
390+ await applySafeType ( comboboxSeparators , "Item 1" ) ;
380391 expect ( await comboboxSeparators . getItemsCount ( ) ) . toEqual ( 3 ) ;
381392 } ) ;
382393 } ) ;
@@ -385,13 +396,13 @@ describe("USERCONTROL Combobox >", () => {
385396 it ( "should highlight appropriate items in dropdown for combobox with a plain list of items" , async ( ) => {
386397 await comboboxBasic . waitElementVisible ( ) ;
387398 await comboboxBasic . toggleMenu ( ) ;
388- await comboboxBasic . acceptInput ( "Item" ) ;
399+ await applySafeType ( comboboxBasic , "Item" ) ;
389400 await comboboxBasic . toggleMenu ( ) ;
390401 expect ( await comboboxBasic . getHighlightedItemsCount ( ) ) . toEqual (
391402 15
392403 ) ;
393404 await comboboxBasic . clearText ( ) ;
394- await comboboxBasic . acceptInput ( "Item 1" ) ;
405+ await applySafeType ( comboboxBasic , "Item 1" ) ;
395406 await comboboxBasic . toggleMenu ( ) ;
396407 expect ( await comboboxBasic . getHighlightedItemsCount ( ) ) . toEqual (
397408 6
@@ -401,13 +412,13 @@ describe("USERCONTROL Combobox >", () => {
401412 it ( "should highlight appropriate items in dropdown for combobox with groups" , async ( ) => {
402413 await comboboxSeparators . waitElementVisible ( ) ;
403414 await comboboxSeparators . toggleMenu ( ) ;
404- await comboboxSeparators . acceptInput ( "Item" ) ;
415+ await applySafeType ( comboboxSeparators , "Item" ) ;
405416 await comboboxSeparators . toggleMenu ( ) ;
406417 expect (
407418 await comboboxSeparators . getHighlightedItemsCount ( )
408419 ) . toEqual ( 9 ) ;
409420 await comboboxSeparators . clearText ( ) ;
410- await comboboxSeparators . acceptInput ( "Item 1" ) ;
421+ await applySafeType ( comboboxSeparators , "Item 1" ) ;
411422 await comboboxSeparators . toggleMenu ( ) ;
412423 expect (
413424 await comboboxSeparators . getHighlightedItemsCount ( )
@@ -428,7 +439,7 @@ describe("USERCONTROL Combobox >", () => {
428439
429440 it ( "should clear value if it's not in source array and re-render dropdown" , async ( ) => {
430441 await comboboxTypeahead . waitElementVisible ( ) ;
431- await comboboxTypeahead . acceptInput ( "Not in a source array" ) ;
442+ await applySafeType ( comboboxTypeahead , "Not in a source array" ) ;
432443 await comboboxWithDisplayValue . toggleMenu ( ) ;
433444 expect (
434445 await comboboxTypeahead . getSelectedItems ( ) . count ( )
0 commit comments