Skip to content

Commit

Permalink
Implement test render function for global theme and modes
Browse files Browse the repository at this point in the history
It renders the passed components with the global theme and modes
provided through the `Root` core container component. This is necessary
for all styled components that make use of any theme properties either
simple values or functions.

Associated epic: 38
GH-64
  • Loading branch information
arcticicestudio committed Dec 13, 2018
1 parent db3fdd1 commit 0bd1919
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/__utils__/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* 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
*/

/**
* @file Provides test utility functions and classes.
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/

import renderWithTheme from "./renderWithTheme";

/* eslint-disable-next-line import/prefer-default-export */
export { renderWithTheme };
25 changes: 25 additions & 0 deletions test/__utils__/renderWithTheme.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* 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 { render } from "react-testing-library";

import Root from "containers/core/Root";

/**
* Renders the passed components with the global theme and modes provided through the `Root` core container component.
*
* @method renderWithTheme
* @author Arctic Ice Studio <[email protected]>
* @author Sven Greb <[email protected]>
* @since 0.3.0
*/
const renderWithTheme = components => render(<Root>{components}</Root>);

export default renderWithTheme;

0 comments on commit 0bd1919

Please sign in to comment.