-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a6d7fc6
commit 3c4fcd5
Showing
1 changed file
with
35 additions
and
17 deletions.
There are no files selected for viewing
52 changes: 35 additions & 17 deletions
52
packages/orbit-components/src/Mobile/__tests__/index.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,49 @@ | ||
// @flow strict | ||
|
||
import * as React from "react"; | ||
import { render, screen } from "@testing-library/react"; | ||
import { render } from "@testing-library/react"; | ||
|
||
import { getBreakpointWidth } from "../../utils/mediaQuery/index"; | ||
import { QUERIES } from "../../utils/mediaQuery/consts"; | ||
import theme from "../../defaultTheme"; | ||
import Mobile from ".."; | ||
|
||
describe("Mobile", () => { | ||
it("should be visible on smallMobile, largeMobile and tablet", () => { | ||
render(<Mobile>kek</Mobile>); | ||
const { container } = render(<Mobile>kek</Mobile>); | ||
expect(container.firstChild).toMatchInlineSnapshot(` | ||
@media (min-width:414px) { | ||
.c0 { | ||
display: inline-block; | ||
} | ||
} | ||
expect(screen.getByText("kek")).toHaveStyleRule("display", "inline-block", { | ||
media: getBreakpointWidth(QUERIES.LARGEMOBILE, theme), | ||
}); | ||
@media (min-width:576px) { | ||
.c0 { | ||
display: inline-block; | ||
} | ||
} | ||
expect(screen.getByText("kek")).toHaveStyleRule("display", "inline-block", { | ||
media: getBreakpointWidth(QUERIES.TABLET, theme), | ||
}); | ||
@media (min-width:768px) { | ||
.c0 { | ||
display: inline-block; | ||
} | ||
} | ||
expect(screen.getByText("kek")).toHaveStyleRule("display", "none", { | ||
media: getBreakpointWidth(QUERIES.LARGEDESKTOP, theme), | ||
}); | ||
@media (min-width:992px) { | ||
.c0 { | ||
display: none; | ||
} | ||
} | ||
expect(screen.getByText("kek")).toHaveStyleRule("display", "none", { | ||
media: getBreakpointWidth(QUERIES.DESKTOP, theme), | ||
}); | ||
@media (min-width:1200px) { | ||
.c0 { | ||
display: none; | ||
} | ||
} | ||
<div | ||
class="c0" | ||
> | ||
kek | ||
</div> | ||
`); | ||
}); | ||
}); |