Skip to content

Instantly share code, notes, and snippets.

Enzyme 3 Gotchas

Some things have changed with enzyme 3 that deviate from version 2, and in some cases deviate from what even the enzyme docs suggest. Here's some of the gotchas I came across in upgrading from enzyme 2 to 3.

Accessing the DOM node

React

render () {
 return (
import React, { Component } from 'react'
import PropTypes from 'prop-types'
class MessageModalBody extends Component {
render () {
return (
<TabList>
<TabPanel title="Score Range">
<MessageForm showScoreFilter={true} />
</TabPanel>

Dialog Components Refactor

The purpose of this document is to help define the components that comprise Instructure UI's dialog components. Dialog components typically render outside the context of the application and are the primary focal point when rendered.

This represents a refactor as specified by Jen Stern.

Building Blocks

These are the low-level components needed for dialogs.

Dialog Components

The purpose of this document is to help define the components that comprise Instructure UI's dialog components. Dialog components typically render outside the context of the application and are the primary focal point when rendered.

This represents the current state of things.

Building Blocks

These are the low-level components needed for dialogs.

Portal Component Refactor

Proposal for how to refactor InstUI's use of <Portal />.

The Problem

There are several issues with how <Portal /> is currently being used.

  1. We have two versions of <Portal /> in our code base. A version that we wrote ourselves and a version packaged with react-overlays. This causes unecessary overhead.
  2. There are inconsistencies with the developer facing API for how to specify the trigger and the content for components that use a ``. This makes it confusing as the usage of these components is not predictable.
@mzabriskie
mzabriskie / webpack.config.js
Last active October 14, 2016 17:07
Webpack externals for React
// Which is the best practice for React?
// This needs to be compatible with RequireJS.
module.exports = {
externals: {
'react': 'React',
'react-dom': 'ReactDOM'
},
// - OR -
@mzabriskie
mzabriskie / index.js
Last active June 23, 2016 18:13
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
'use strict';
/*
Pre Babel
import axios from 'axios'

Example use of <FormField/>:

<FormField label="Username" errors={['Cannot be left blank']}>
  <input type="text" name="username" value=""/>
</FormField>

This renders something like:

@mzabriskie
mzabriskie / .gitignore
Last active July 17, 2017 16:21
Releasing ES6 node modules to npm
build/
node_modules/