Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enzyme-theme-utils

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enzyme-theme-utils

Enzyme Theme Utilities

  • 1.1.1
  • npm
  • Socket score

Version published
Weekly downloads
124
decreased by-10.79%
Maintainers
1
Weekly downloads
 
Created
Source

Enzyme Theme Utils

npm install enzyme-theme-utils

Motivation

Testing React components that need to be wrapped in a ThemeProvider is a pain in the butt. So after lots of trial-and-error programming I created this module to rectify this. Essentially what it does is renders the ThemeProvider and it's children inside a wrapper. Then it adds context to the wrapped ThemeProvider. Then it extracts the children and adds the context from the ThemeProvider to the child and mounts it.

Usage

mountWithTheme

import React from 'react'
import PropTypes from 'prop-types'
import { mountWithTheme } from 'enzyme-theme-utils'

const someTheme = {
  colors: {
    red: 'red',
    yellow: 'yellow'
  }
}

describe('some themed component', () => {

  it('can be mounted', () => {
    const test = mountWithTheme(
      <SomeComponent/>,
      someTheme
    )

    // Assertions

  })
})

MIT License

FAQs

Package last updated on 16 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc