Skip to content

Commit

Permalink
fix(ui5-combobox): correctly fire change event on item press (#5447)
Browse files Browse the repository at this point in the history
Fixes #5432
  • Loading branch information
d3xter666 authored and ilhan007 committed Jul 4, 2022
1 parent 86e94cc commit 3c0262b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/main/src/ComboBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,7 @@ class ComboBox extends UI5Element {
const sameSelectionPerformed = this.value.toLowerCase() === this.filterValue.toLowerCase();

if (sameItemSelected && sameSelectionPerformed) {
this._fireChangeEvent(); // Click on an already typed, but not memoized value shouold also trigger the change event
return this._closeRespPopover();
}

Expand Down
24 changes: 24 additions & 0 deletions packages/main/test/specs/ComboBox.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,30 @@ describe("General interaction", () => {

});

it("should fire change event after the user has typed in value, but also selects it from the popover", async () => {
await browser.url(`test/pages/ComboBox.html`);

// Setup
const changeValue = await browser.$("#change-placeholder");
const counter = await browser.$("#change-count");
const combo = await browser.$("#change-cb");
const input = await combo.shadow$("[inner-input]");


// Type something which is in the list
await input.click();
await input.keys("Bulgaria");

// Click on the item
const staticAreaItemClassName = await browser.getStaticAreaItemClassName("#change-cb");
const popover = await browser.$(`.${staticAreaItemClassName}`).shadow$("ui5-responsive-popover");
await (await popover.$("ui5-list").$$("ui5-li")[0]).click();


assert.strictEqual(await counter.getText(), "1", "Call count should be 1");
assert.strictEqual(await changeValue.getText(), "Bulgaria", "The value should be changed accordingly");
});

it ("Value should be reset on ESC key", async () => {
await browser.url(`test/pages/ComboBox.html`);

Expand Down

0 comments on commit 3c0262b

Please sign in to comment.