0.2.3 • Published 6 years ago

@sfitzpatrick/enzyme-context-helpers v0.2.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

enzyme-context-helpers

Greenkeeper badge

💻 Installation

First include the dependency in your project as dev-dependency.

npm

$ npm i @sfitzpatrick/enzyme-context-helpers -D

Yarn

$ yarn add @sfitzpatrick/enzyme-context-helpers -D

📦 Usage

Styled Components

First you need to init once to pass your Styled Components theme.

import { init } from '@sfitzpatrick/enzyme-context-helpers';
// Change path to where your Theme is saved
import theme from '../src/theme/theme';

init({ theme });

Then when you want test your styled components, which are dependent on theme context, you can use the following helpers to test with shallow and mount. These functions will automatically inject the Theme into your components.

import {
  mountWithTheme,
  shallowWithTheme,
  renderWithTheme
} from '@sfitzpatrick/enzyme-context-helpers';

const mountedWrapper = mountWithTheme(component);
const shallowWrapper = shallowWithTheme(component);
const snapshotWrapper = renderWithTheme(component).toJSON();

👊 Author

📃 License

This project is licensed under the MIT License - see the Licence.md file for details.

📜 Change log

The change log can found on the CHANGELOG page.

✍️ Contributions

Feel free to contribute and submit pull requests.test

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.1

6 years ago