How to use the enzyme-adapter-react-16.2 function in enzyme-adapter-react-16

To help you get started, we’ve selected a few enzyme-adapter-react-16 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ihmeuw / ihme-ui / scripts / setup-jsdom.js View on Github external
import { JSDOM } from 'jsdom';
import Enzyme from 'enzyme';
import Adapter from 'enzyme-adapter-react-16.2';

import { createElementMock } from './setup-canvas-jsdom';

Enzyme.configure({ adapter: new Adapter() });

const dom = new JSDOM('', {
  useAgent: 'node.js',
});
global.window = dom.window;
global.document = dom.window.document;
global.navigator = dom.window.navigator;

// needed by elements/functions using canvas:
// <select>, , filterTickValuesByWidth
global.document.createElement = createElementMock.bind(
  null,
  document.createElement.bind(document),
);

// needed by interact.js</select>

enzyme-adapter-react-16

JavaScript Testing utilities for React

MIT
Latest version published 3 months ago

Package Health Score

89 / 100
Full package analysis