Skip to content

Commit

Permalink
test(Mobile): inline snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
mainframev committed Apr 7, 2021
1 parent a6d7fc6 commit 3c4fcd5
Showing 1 changed file with 35 additions and 17 deletions.
52 changes: 35 additions & 17 deletions packages/orbit-components/src/Mobile/__tests__/index.test.js
@@ -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>
`);
});
});

0 comments on commit 3c4fcd5

Please sign in to comment.