Skip to content

ComboBox testers: no clear(), no custom value, and multi-select replaces instead of toggling #178

Description

@totally-not-ai

Problem. Three things a user does with a ComboBox have no tester
representation.

No clear(). ComboBox implements HasClearButton, and emptying a field
is always available to the user (#168). ComboBoxTester.selectItem(null) is the
only route, which reads as "select nothing" rather than "the user cleared it",
and MultiSelectComboBoxTester has no equivalent at all.

No custom value entry. setAllowCustomValue(true) +
addCustomValueSetListener is a core ComboBox feature — the user types
something that isn't in the list and the app decides what to do with it. There
is no way to fire CustomValueSetEvent, so that whole branch of application
code is untestable.

comboBox.setAllowCustomValue(true);
comboBox.addCustomValueSetListener(e -> items.add(e.getDetail()));
// no tester method reaches this

MultiSelect replaces instead of toggles.
MultiSelectComboBoxTester.selectItem(String...) overwrites the whole
selection, so selecting a second item silently drops the first — but in the
browser each click toggles one chip. There is also no deselectItem, and no way
to remove a single chip via its ✕. MultiSelectListBoxTester gets this right:
selectItems adds to the existing selection and deselectItems removes.

Ask.

  • clear() on both combo box testers, consistent with feat: give every value tester a uniform clear() #168.
  • setCustomValue(String) (or similar) firing CustomValueSetEvent with
    isFromClient() == true, throwing when isAllowCustomValue() is false.
  • Make MultiSelectComboBoxTester.selectItem additive and add deselectItem /
    deselectAll, matching MultiSelectListBoxTester.

The last one is a behavioural change and wants a release note.

Found while auditing the project against #153 / #168.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions