File tree 2 files changed +33
-8
lines changed
2 files changed +33
-8
lines changed Original file line number Diff line number Diff line change @@ -327,9 +327,14 @@ class ComboBox extends UI5Element {
327
327
}
328
328
329
329
onBeforeRendering ( ) {
330
- const domValue = this . _initialRendering ? this . value : this . filterValue ;
330
+ let domValue ;
331
331
332
- this . _filteredItems = this . _filterItems ( domValue ) ;
332
+ if ( this . _initialRendering ) {
333
+ domValue = this . value ;
334
+ this . _filteredItems = this . items ;
335
+ } else {
336
+ domValue = this . filterValue ;
337
+ }
333
338
334
339
if ( this . _autocomplete && domValue !== "" ) {
335
340
this . _autoCompleteValue ( domValue ) ;
@@ -502,12 +507,6 @@ class ComboBox extends UI5Element {
502
507
this . _closeRespPopover ( ) ;
503
508
}
504
509
505
- get _filteredItems ( ) {
506
- return ! this . items . length ? [ ] : this . items . filter ( item => {
507
- return item . text . toLowerCase ( ) . startsWith ( this . value . toLowerCase ( ) ) ;
508
- } ) ;
509
- }
510
-
511
510
get _headerTitleText ( ) {
512
511
return this . i18nBundle . getText ( INPUT_SUGGESTIONS_TITLE ) ;
513
512
}
Original file line number Diff line number Diff line change @@ -17,6 +17,32 @@ describe("General interaction", () => {
17
17
assert . ok ( popover . getProperty ( "opened" ) , "Popover should be displayed" )
18
18
} ) ;
19
19
20
+ it ( "Items filtration" , ( ) => {
21
+ browser . url ( "http://localhost:8080/test-resources/pages/ComboBox.html" ) ;
22
+
23
+ const combo = $ ( "#combo" ) ;
24
+ const arrow = combo . shadow$ ( "[input-icon]" ) ;
25
+ const input = combo . shadow$ ( "#ui5-combobox-input" ) ;
26
+ const staticAreaItemClassName = browser . getStaticAreaItemClassName ( "#combo" ) ;
27
+ const popover = browser . $ ( `.${ staticAreaItemClassName } ` ) . shadow$ ( "ui5-responsive-popover" ) ;
28
+ let listItems = popover . $ ( "ui5-list" ) . $$ ( "ui5-li" ) ;
29
+
30
+ // act
31
+ arrow . click ( ) ;
32
+
33
+ // assert
34
+ assert . strictEqual ( listItems . length , 11 , "All items are shown with selected item" ) ;
35
+
36
+ // act
37
+ input . click ( ) ;
38
+ browser . keys ( "Backspace" ) ;
39
+
40
+ // assert
41
+ listItems = popover . $ ( "ui5-list" ) . $$ ( "ui5-li" ) ;
42
+ assert . strictEqual ( listItems . length , 1 , "Items are filtered on input value change" ) ;
43
+
44
+ } ) ;
45
+
20
46
it ( "Should open the popover when typing a value" , ( ) => {
21
47
browser . url ( "http://localhost:8080/test-resources/pages/ComboBox.html" ) ;
22
48
You can’t perform that action at this time.
0 commit comments