-
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…ies-for-styled-components Jest utilities for Styled Components
- Loading branch information
Showing
31 changed files
with
724 additions
and
55 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
112 changes: 80 additions & 32 deletions
112
test/components/atoms/core/HTMLElements/inlineTextSemantics/__snapshots__/A.test.jsx.snap
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,45 +1,93 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`snapshot renders external URLs with \`href\` prop 1`] = ` | ||
<div> | ||
<a | ||
class="sc-bdVaJa jEake" | ||
href="https://nordtheme.com" | ||
> | ||
Docs | ||
</a> | ||
</div> | ||
.c0 { | ||
color: inherit; | ||
cursor: pointer; | ||
-webkit-text-decoration: none; | ||
text-decoration: none; | ||
} | ||
.c0:active, | ||
.c0:focus, | ||
.c0:hover, | ||
.c0:visited { | ||
outline: none; | ||
} | ||
<a | ||
class="c0" | ||
href="https://nordtheme.com" | ||
> | ||
Docs | ||
</a> | ||
`; | ||
|
||
exports[`snapshot renders external URLs with \`to\` prop 1`] = ` | ||
<div> | ||
<a | ||
class="sc-bdVaJa jEake" | ||
href="https://nordtheme.com" | ||
> | ||
Docs | ||
</a> | ||
</div> | ||
.c0 { | ||
color: inherit; | ||
cursor: pointer; | ||
-webkit-text-decoration: none; | ||
text-decoration: none; | ||
} | ||
.c0:active, | ||
.c0:focus, | ||
.c0:hover, | ||
.c0:visited { | ||
outline: none; | ||
} | ||
<a | ||
class="c0" | ||
href="https://nordtheme.com" | ||
> | ||
Docs | ||
</a> | ||
`; | ||
|
||
exports[`snapshot renders inernal URLs with \`href\` prop 1`] = ` | ||
<div> | ||
<a | ||
class="sc-bwzfXH lhDJTy" | ||
href="/docs" | ||
> | ||
Docs | ||
</a> | ||
</div> | ||
.c0 { | ||
color: inherit; | ||
cursor: pointer; | ||
-webkit-text-decoration: none; | ||
text-decoration: none; | ||
} | ||
.c0:active, | ||
.c0:focus, | ||
.c0:hover, | ||
.c0:visited { | ||
outline: none; | ||
} | ||
<a | ||
class="c0" | ||
href="/docs" | ||
> | ||
Docs | ||
</a> | ||
`; | ||
|
||
exports[`snapshot renders inernal URLs with \`to\` prop 1`] = ` | ||
<div> | ||
<a | ||
class="sc-bwzfXH lhDJTy" | ||
href="/docs" | ||
> | ||
Docs | ||
</a> | ||
</div> | ||
.c0 { | ||
color: inherit; | ||
cursor: pointer; | ||
-webkit-text-decoration: none; | ||
text-decoration: none; | ||
} | ||
.c0:active, | ||
.c0:focus, | ||
.c0:hover, | ||
.c0:visited { | ||
outline: none; | ||
} | ||
<a | ||
class="c0" | ||
href="/docs" | ||
> | ||
Docs | ||
</a> | ||
`; |
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
18 changes: 13 additions & 5 deletions
18
test/components/containers/core/Content/__snapshots__/Content.test.jsx.snap
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,9 +1,17 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`snapshot 1`] = ` | ||
<div> | ||
<div | ||
class="sc-bdVaJa fnJgZO" | ||
/> | ||
</div> | ||
.c0 { | ||
width: 100%; | ||
} | ||
@media (min-width:75em) { | ||
.c0 { | ||
max-width: 75em; | ||
} | ||
} | ||
<div | ||
class="c0" | ||
/> | ||
`; |
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
13 changes: 8 additions & 5 deletions
13
test/components/containers/core/Page/__snapshots__/Page.test.jsx.snap
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,9 +1,12 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`snapshot 1`] = ` | ||
<div> | ||
<main | ||
class="sc-bdVaJa fWIgbF" | ||
/> | ||
</div> | ||
.c0 { | ||
-webkit-transition: background-color 400ms ease-in-out; | ||
transition: background-color 400ms ease-in-out; | ||
} | ||
<main | ||
class="c0" | ||
/> | ||
`; |
45 changes: 45 additions & 0 deletions
45
test/components/organisms/core/Header/styled/Header.test.jsx
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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]> | ||
* Copyright (C) 2018-present Sven Greb <[email protected]> | ||
* | ||
* Project: Nord Docs | ||
* Repository: https://github.com/arcticicestudio/nord-docs | ||
* License: MIT | ||
*/ | ||
|
||
import React from "react"; | ||
import { em } from "polished"; | ||
|
||
import { renderWithTheme } from "nord-docs-test-utils"; | ||
import Header from "organisms/core/Header/styled/Header"; | ||
import { HEADER_HEIGHT, HEADER_HEIGHT_PINNED } from "organisms/core/Header"; | ||
|
||
describe("theme styles", () => { | ||
test("uses flexbox layout", () => { | ||
const { container } = renderWithTheme(<Header />); | ||
expect(container.firstChild).toHaveStyleRule("display", "flex"); | ||
}); | ||
|
||
test("has fixed position", () => { | ||
const { container } = renderWithTheme(<Header />); | ||
expect(container.firstChild).toHaveStyleRule("position", "fixed"); | ||
}); | ||
|
||
test("has correct height in unpinned mode", () => { | ||
const { container } = renderWithTheme( | ||
<Header height={HEADER_HEIGHT} heightPinned={HEADER_HEIGHT_PINNED} isPinned={false} /> | ||
); | ||
|
||
expect(container.firstChild).toHaveStyleRule("height", em(HEADER_HEIGHT)); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test("has correct height in pinned mode", () => { | ||
const { container } = renderWithTheme( | ||
<Header height={HEADER_HEIGHT} heightPinned={HEADER_HEIGHT_PINNED} isPinned /> | ||
); | ||
|
||
expect(container.firstChild).toHaveStyleRule("height", em(HEADER_HEIGHT_PINNED)); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
35 changes: 35 additions & 0 deletions
35
test/components/organisms/core/Header/styled/Logo.test.jsx
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright (C) 2018-present Arctic Ice Studio <[email protected]> | ||
* Copyright (C) 2018-present Sven Greb <[email protected]> | ||
* | ||
* Project: Nord Docs | ||
* Repository: https://github.com/arcticicestudio/nord-docs | ||
* License: MIT | ||
*/ | ||
|
||
import React from "react"; | ||
import { em } from "polished"; | ||
|
||
import { renderWithTheme } from "nord-docs-test-utils"; | ||
import Logo from "organisms/core/Header/styled/Logo"; | ||
import { HEADER_BRAND_LOGO_SHRINK_FACTOR, HEADER_HEIGHT, HEADER_HEIGHT_PINNED } from "organisms/core/Header"; | ||
|
||
describe("theme styles", () => { | ||
test("adjusts to passed header height in unpinned mode", () => { | ||
const { container } = renderWithTheme(<Logo size={HEADER_HEIGHT} />); | ||
const expectedSize = em(HEADER_HEIGHT * HEADER_BRAND_LOGO_SHRINK_FACTOR); | ||
|
||
expect(container.firstChild).toHaveStyleRule("width", expectedSize); | ||
expect(container.firstChild).toHaveStyleRule("height", expectedSize); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test("adjusts to passed header height in pinned mode", () => { | ||
const { container } = renderWithTheme(<Logo size={HEADER_HEIGHT_PINNED} />); | ||
const expectedSize = em(HEADER_HEIGHT_PINNED * HEADER_BRAND_LOGO_SHRINK_FACTOR); | ||
|
||
expect(container.firstChild).toHaveStyleRule("width", expectedSize); | ||
expect(container.firstChild).toHaveStyleRule("height", expectedSize); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.