Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions packages/main/cypress/specs/MultiInput.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1335,6 +1335,24 @@ describe("Keyboard handling", () => {
cy.get("[ui5-multi-input]")
.should("have.attr", "value-state", "None");
});

it("should trigger change event on enter with no suggestions", () => {
const changeSpy = cy.stub().as("changeSpy");
cy.mount(
<MultiInput onChange={changeSpy}></MultiInput>
);

cy.get("[ui5-multi-input]")
.shadow()
.find("input")
.realClick();

cy.realType("asd");
cy.realPress("Enter");

cy.get("@changeSpy")
.should("have.been.calledOnce");
});
});

describe("MultiInput Composition", () => {
Expand Down Expand Up @@ -1371,7 +1389,7 @@ describe("MultiInput Composition", () => {
cy.get("@multiinput").should("have.prop", "_isComposing", true);

cy.get("@nativeInput").trigger("compositionend", { data: "사랑" });

cy.get("@nativeInput")
.invoke("val", "사랑")
.trigger("input", { inputType: "insertCompositionText" });
Expand Down Expand Up @@ -1425,7 +1443,7 @@ describe("MultiInput Composition", () => {
cy.get("@multiinput").should("have.prop", "_isComposing", true);

cy.get("@nativeInput").trigger("compositionend", { data: "ありがとう" });

cy.get("@nativeInput")
.invoke("val", "ありがとう")
.trigger("input", { inputType: "insertCompositionText" });
Expand Down Expand Up @@ -1479,7 +1497,7 @@ describe("MultiInput Composition", () => {
cy.get("@multiinput").should("have.prop", "_isComposing", true);

cy.get("@nativeInput").trigger("compositionend", { data: "谢谢" });

cy.get("@nativeInput")
.invoke("val", "谢谢")
.trigger("input", { inputType: "insertCompositionText" });
Expand Down
2 changes: 1 addition & 1 deletion packages/main/src/MultiInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ class MultiInput extends Input implements IFormInputElement {
return this._focusFirstToken(e);
}

if (isEnter(e)) {
if (isEnter(e) && !!this._internals.form) {
e.preventDefault();
}

Expand Down
Loading