Skip to content

Commit 6ddaed4

Browse files
committed
fix(ui5-multi-combobox): remove invalid values on focusout
fix clearing of matching values
1 parent cb602aa commit 6ddaed4

2 files changed

Lines changed: 5 additions & 43 deletions

File tree

packages/main/cypress/specs/MultiComboBox.cy.tsx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2077,42 +2077,7 @@ describe("Validation & Value State", () => {
20772077
.should("have.value", "xyz");
20782078
});
20792079

2080-
it("Does not clear valid/matching values on focus out", () => {
2081-
cy.mount(
2082-
<>
2083-
<Button id="btn">Focus target</Button>
2084-
<MultiComboBox>
2085-
<MultiComboBoxItem text="Item 1"></MultiComboBoxItem>
2086-
<MultiComboBoxItem text="Item 2"></MultiComboBoxItem>
2087-
</MultiComboBox>
2088-
</>
2089-
);
2090-
2091-
cy.get("[ui5-multi-combobox]")
2092-
.as("mcb")
2093-
.realClick();
2094-
2095-
cy.get("@mcb")
2096-
.should("be.focused");
2097-
2098-
cy.realType("Item");
2099-
2100-
cy.get("@mcb")
2101-
.shadow()
2102-
.find("input")
2103-
.should("have.value", "Item 1");
2104-
2105-
cy.get("#btn")
2106-
.realClick()
2107-
.should("be.focused");
2108-
2109-
cy.get("@mcb")
2110-
.shadow()
2111-
.find("input")
2112-
.should("have.value", "Item 1");
2113-
});
2114-
2115-
it("Preserves selected tokens when clearing invalid input on focus out", () => {
2080+
it("Preserves selected tokens when clearing input on focus out", () => {
21162081
cy.mount(
21172082
<>
21182083
<Button id="btn">Focus target</Button>

packages/main/src/MultiComboBox.ts

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2037,13 +2037,10 @@ class MultiComboBox extends UI5Element implements IFormInputElement {
20372037
this.focused = false;
20382038

20392039
if (!this.noValidation && this.value) {
2040-
const hasMatchingItem = this._filterItems(this.value).length > 0;
2041-
if (!hasMatchingItem) {
2042-
this.value = "";
2043-
this._lastValue = "";
2044-
if (this.valueState === ValueState.Negative) {
2045-
this._updateValueState(this._effectiveValueState);
2046-
}
2040+
this.value = "";
2041+
this._lastValue = "";
2042+
if (this.valueState === ValueState.Negative) {
2043+
this._updateValueState(this._effectiveValueState);
20472044
}
20482045
}
20492046

0 commit comments

Comments
 (0)