ComboBoxTester.selectItem doesn't respect ComboBox native filtering.
We have a ComboBox that performs custom filtering
setItems(
{ item, filterText ->
... custom filtering logic removed ...
},
myRepository.findAll().toList()
)
Calling ComboBoxTester.selectItem doesn't respect this filtering and does filtering of its own
final List<Y> filtered = suggestionItems.stream().filter(
item -> selection.equals(itemLabelGenerator.apply(item)))
.collect(Collectors.toList());
When calling the selectItem API it should respect the custom filtering behavior of the ComboBox.
@nbabb I'm not sure if I'm getting the problem, so please correct me if I'm wrong.
Is your test calling ComboboxTester.setFilter before calling ComboboxTester.selectItem?
selectItem is meant to select one of the available options, potentially filtered by the setFilter call.
Let's say your service returns "Task 1", "Option 1", "Task 2", "Option 2" and your custom filter allows filters out only Options if you type for example o:1.
Initially suggested items contain all items and you can do selectItem(Task1)
The you call setFilter("o:") now only "Option 1" and "Option 2" are available and calling selectItem(Task1) fails, selectItem(Option 2) works.
So, what are your expectations? That selectItem acts also as a filter?
I had Claude make a draft PR #2036 but I am not sure it accurately represents this issue
Yeah, I took a look at the PR and what made me suspicious is the double call to setFilter in selectItem.
As said, my opinion is that selectItem should only select one of the already filtered items, so potentially no changes are needed.
But let's wait for @nbabb observations to better understand the use case.
I'm not convinced anymore this is a bug @mshabarov should we review the triage of this issue?