Skip to content

Commit

Permalink
feat(Popover): migrate to Tailwind
Browse files Browse the repository at this point in the history
  • Loading branch information
mainframev committed Nov 21, 2023
1 parent 5a6eaa9 commit 49a619f
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 245 deletions.
2 changes: 1 addition & 1 deletion docs/src/data/tailwind-migration-status.yaml
Expand Up @@ -65,7 +65,7 @@ NavigationBar: true
NotificationBadge: true
OrbitProvider: true
Pagination: false
Popover: false
Popover: true
Portal: true
Radio: true
NewSeatIcon: false
Expand Down
Expand Up @@ -6,7 +6,7 @@ describe("useLockScrolling", () => {
it("should listen for viewport resize", () => {
cy.viewport(breakpoint - 1, 600);
cy.visit("/lock-scrolling");
cy.findByRole("button", { name: "Open" }).click();
cy.findAllByRole("button", { name: "Open" }).eq(1).click();
cy.get("body").should("have.css", "overflow-y", "hidden");
// cy.get("body").should("have.css", "padding-right", "15px");
cy.viewport(breakpoint, 600);
Expand All @@ -20,8 +20,8 @@ describe("useLockScrolling", () => {
it("should unlock scrolling after last lock is cleared", () => {
cy.viewport(breakpoint - 1, 600);
cy.visit("/lock-scrolling");
cy.findByRole("button", { name: "Open" }).click();
cy.findByRole("button", { name: "Open nested" }).click();
cy.findAllByRole("button", { name: "Open" }).eq(1).click();
cy.findAllByRole("button", { name: "Open nested" }).eq(1).click();
cy.findByRole("button", { name: "Close nested" }).click();
cy.get("body").should("have.css", "overflow-y", "hidden");
cy.findByRole("button", { name: "Close" }).click();
Expand Down
Expand Up @@ -37,7 +37,7 @@ describe("Popover", () => {
</Popover>,
);

const openButton = screen.getByRole("button", { name: "Open" });
const openButton = screen.getAllByRole("button", { name: "Open" })[1];
await user.click(openButton);
expect(onOpen).toHaveBeenCalled();
expect(screen.getByTestId(dataTest)).toBeInTheDocument();
Expand Down Expand Up @@ -88,7 +88,7 @@ describe("Popover", () => {
);

// default is 4px
expect(screen.getByRole("tooltip")).toHaveStyle({ top: "10" });
expect(screen.getByRole("dialog")).toHaveStyle({ top: "10" });
// Needs to flush async `floating-ui` hooks
// https://github.com/floating-ui/floating-ui/issues/1520
await act(async () => {});
Expand All @@ -100,10 +100,11 @@ describe("Popover", () => {
<Button>Open popover</Button>
</Popover>,
);
await user.click(screen.getByRole("button"));

await user.click(screen.getAllByRole("button")[1]);
const overlay = (await screen.findByTestId("popover")).previousElementSibling;
expect(overlay).toBeInTheDocument();
if (overlay) await user.click(overlay);
expect(screen.queryByTestId("popover")).not.toBeInTheDocument();
expect(screen.queryByTestId("dialog")).not.toBeInTheDocument();
});
});

0 comments on commit 49a619f

Please sign in to comment.