Skip to content

test(ui5-input): failing test #11777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
49 changes: 35 additions & 14 deletions packages/main/cypress/specs/Input.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ describe("Selection-change event", () => {
});

describe("Change event behavior when selecting the same suggestion item", () => {
beforeEach(() => {
it("Change event is not fired when the same suggestion item is selected (with typeahead)", () => {
cy.mount(
<Input placeholder="Search for a country ..." showSuggestions onChange={cy.stub().as("changeEvent")}>
<SuggestionItemGroup headerText="A">
Expand All @@ -743,10 +743,6 @@ describe("Change event behavior when selecting the same suggestion item", () =>

cy.get("[ui5-input]")
.as("input")
});

it("Change event is not fired when the same suggestion item is selected (with typeahead)", () => {
cy.get("@input")
.realClick();

cy.get("@input")
Expand Down Expand Up @@ -779,7 +775,21 @@ describe("Change event behavior when selecting the same suggestion item", () =>
});

it("Change event is not fired when the same suggestion item is selected (no-typeahead)", () => {
cy.get("@input").invoke("attr", "value", "Afghanistan");
cy.mount(
<Input placeholder="Search for a country ..." showSuggestions onChange={cy.stub().as("changeEvent")}>
<SuggestionItemGroup headerText="A">
<SuggestionItem text="Afghanistan" />
<SuggestionItem text="Argentina" />
<SuggestionItem text="Albania" />
<SuggestionItem text="Armenia" />
<SuggestionItem text="Algeria" />
</SuggestionItemGroup>
</Input>
);

cy.get("[ui5-input]")
.as("input")
.invoke("attr", "value", "Afghanistan");
cy.get("@input").invoke("attr", "no-typeahead", true);

cy.get("@input")
Expand Down Expand Up @@ -809,7 +819,20 @@ describe("Change event behavior when selecting the same suggestion item", () =>
});

it("Change event is not fired when the same suggestion item is selected after focus out and selecting suggestion again", () => {
cy.get("@input")
cy.mount(
<Input placeholder="Search for a country ..." showSuggestions onChange={cy.stub().as("changeEvent")}>
<SuggestionItemGroup headerText="A">
<SuggestionItem text="Afghanistan" />
<SuggestionItem text="Argentina" />
<SuggestionItem text="Albania" />
<SuggestionItem text="Armenia" />
<SuggestionItem text="Algeria" />
</SuggestionItemGroup>
</Input>
);

cy.get("[ui5-input]")
.as("input")
.invoke("attr", "value", "Afghanistan");

cy.get("@input")
Expand Down Expand Up @@ -845,7 +868,8 @@ describe("Change event behavior when selecting the same suggestion item", () =>
it("Change event fires after typing a new value following a clear icon click", () => {
cy.mount(<Input showClearIcon={true} onChange={cy.stub().as("inputChange")} />);

cy.get("@input")
cy.get("[ui5-input]")
.as("input")
.shadow()
.find("#inner")
.as("innerInput")
Expand Down Expand Up @@ -920,8 +944,8 @@ describe("Change event behavior when selecting the same suggestion item", () =>
});

it("should not close the dialog when item is selected", () => {
cy.mount(<Dialog open>
<Input showSuggestions={true}>
cy.mount(<Dialog open initialFocus="test">
<Input showSuggestions={true} id="test">
<SuggestionItem text="First item"></SuggestionItem>
<SuggestionItem text="Second item"></SuggestionItem>
</Input>
Expand All @@ -936,9 +960,6 @@ describe("Change event behavior when selecting the same suggestion item", () =>

cy.get("[ui5-input]")
.as("input")
.realClick();

cy.get("@input")
.should("be.focused");

cy.realType("f");
Expand All @@ -954,7 +975,7 @@ describe("Change event behavior when selecting the same suggestion item", () =>

cy.get<Dialog>("@dialog")
.ui5DialogOpened();
});
})
});

describe("Accessibility", () => {
Expand Down
Loading