Skip to content

Commit

Permalink
added more test cases for typeahead account filter
Browse files Browse the repository at this point in the history
  • Loading branch information
rammohan-y committed Jan 6, 2025
1 parent 0d9194e commit e6a31cf
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/components/account-filter.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,28 @@ describe("<AccountFilter>", () => {
cy.mount(<AccountFilterTestWrapper defaultOption />);
cy.get("input").clear();
cy.get("input").type("cus");
cy.get("div").should("have.class", "typeahead-option active");
cy.get("div#account_filter-option-1").should("have.text", "custom account");
});
it("handles Enter key press", () => {
cy.mount(<AccountFilterTestWrapper />);

cy.get("input").clear();
cy.get("input").type("cus{enter}");
cy.get("input").should("have.value", "custom account");
});
it("navigates down and up with arrow keys", () => {
cy.mount(<AccountFilterTestWrapper />);

cy.get("input").clear();
// Press arrow down to move to the first option
cy.get("input").type("{downarrow}");
cy.get("input").type("{enter}");
cy.get("input").should("have.value", "default account");

// Press up to move to the previous option
cy.get("input").type("{uparrow}");
cy.get("input").type("{uparrow}");
cy.get("input").type("{enter}");
cy.get("input").should("have.value", "custom account");
});
});

0 comments on commit e6a31cf

Please sign in to comment.