-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement missing tests for already existing style-only components
- Loading branch information
1 parent
19a21ba
commit c713544
Showing
23 changed files
with
676 additions
and
48 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
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 <development@arcticicestudio.com> | ||
* Copyright (C) 2018-present Sven Greb <development@svengreb.de> | ||
* | ||
* 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 <development@arcticicestudio.com> | ||
* Copyright (C) 2018-present Sven Greb <development@svengreb.de> | ||
* | ||
* 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(); | ||
}); | ||
}); |
27 changes: 27 additions & 0 deletions
27
test/components/organisms/core/Header/styled/LogoCaption.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,27 @@ | ||
/* | ||
* Copyright (C) 2018-present Arctic Ice Studio <development@arcticicestudio.com> | ||
* Copyright (C) 2018-present Sven Greb <development@svengreb.de> | ||
* | ||
* Project: Nord Docs | ||
* Repository: https://github.com/arcticicestudio/nord-docs | ||
* License: MIT | ||
*/ | ||
|
||
import React from "react"; | ||
|
||
import { renderWithTheme } from "nord-docs-test-utils"; | ||
import LogoCaption from "organisms/core/Header/styled/LogoCaption"; | ||
|
||
describe("behavior", () => { | ||
test("is invisible in pinned Mode", () => { | ||
const { container } = renderWithTheme(<LogoCaption isPinned />); | ||
expect(container.firstChild).not.toBeVisible(); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test("is visible in unpinned Mode", () => { | ||
const { container } = renderWithTheme(<LogoCaption isPinned={false} />); | ||
expect(container.firstChild).toBeVisible(); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
28 changes: 28 additions & 0 deletions
28
test/components/organisms/core/Header/styled/NavList.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,28 @@ | ||
/* | ||
* Copyright (C) 2018-present Arctic Ice Studio <development@arcticicestudio.com> | ||
* Copyright (C) 2018-present Sven Greb <development@svengreb.de> | ||
* | ||
* 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 NavList from "organisms/core/Header/styled/NavList"; | ||
import { media } from "styles/theme"; | ||
|
||
describe("theme styles", () => { | ||
test("has required CSS breakpoints", () => { | ||
const { container } = renderWithTheme(<NavList />); | ||
const mediaQuery = `(min-width: ${em(media.breakpoints.tabletPortraitLowerBoundary)})`; | ||
|
||
expect(container.firstChild).toHaveStyleRule("display", "none"); | ||
expect(container.firstChild).toHaveStyleRule("display", "flex", { | ||
media: mediaQuery | ||
}); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
test/components/organisms/core/Header/styled/SlideMenuBox.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,41 @@ | ||
/* | ||
* Copyright (C) 2018-present Arctic Ice Studio <development@arcticicestudio.com> | ||
* Copyright (C) 2018-present Sven Greb <development@svengreb.de> | ||
* | ||
* 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 SlideMenuBox from "organisms/core/Header/styled/SlideMenuBox"; | ||
import { HEADER_HEIGHT, HEADER_HEIGHT_PINNED } from "organisms/core/Header"; | ||
import { media } from "styles/theme"; | ||
|
||
describe("theme styles", () => { | ||
test("has required CSS breakpoints", () => { | ||
const { container } = renderWithTheme(<SlideMenuBox />); | ||
const mediaQuery = `(min-width: ${em(media.breakpoints.tabletPortraitLowerBoundary)})`; | ||
|
||
expect(container.firstChild).toHaveStyleRule("display", "none", { | ||
media: mediaQuery | ||
}); | ||
}); | ||
|
||
test("has correct top position based on header height in unpinned mode", () => { | ||
const { container } = renderWithTheme(<SlideMenuBox isPinned={false} />); | ||
|
||
expect(container.firstChild).toHaveStyleRule("top", em(HEADER_HEIGHT)); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
|
||
test("has correct top position based on the header height in pinned mode", () => { | ||
const { container } = renderWithTheme(<SlideMenuBox isPinned />); | ||
|
||
expect(container.firstChild).toHaveStyleRule("top", em(HEADER_HEIGHT_PINNED)); | ||
expect(container.firstChild).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.