Skip to content

Instantly share code, notes, and snippets.

Avatar

Ian Wright IPWright83

View GitHub Profile
View README.md

mockComponent.js

This is designed as a simple React component mock to be used with Jest, that still presents enough information to be useful in a Snapshot test. It's handy when you either don't want to shallow render, or are unable to.

Usage

To use this mock, insert the following into your test file, to mock the sub-components, substituting out the names:

jest.mock("../MyComponent", () => ({ MyComponent: (props) => mockComponent("MyComponent", props) }));
@IPWright83
IPWright83 / .block
Created Jun 21, 2018 — forked from mbostock/.block
Collapsible Tree
View .block
license: gpl-3.0
@IPWright83
IPWright83 / README.md
Created Mar 23, 2018 — forked from mbostock/.block
Spline Editor
View README.md

Click to add new points. Hit the DELETE key to remove the selected point. Use the dropdown menu to change the interpolation mode.

@IPWright83
IPWright83 / .block
Last active Dec 1, 2017 — forked from mbostock/.block
Canvas Swarm
View .block
license: gpl-3.0
@IPWright83
IPWright83 / .block
Last active Dec 1, 2017 — forked from mbostock/.block
SVG Swarm
View .block
license: gpl-3.0
@IPWright83
IPWright83 / .block
Created Jul 31, 2017 — forked from mbostock/.block
Beeswarm
View .block
license: gpl-3.0
height: 200
@IPWright83
IPWright83 / README.md
Last active Sep 26, 2017 — forked from etiennecrb/README.md
d3-xyzoom demo
View README.md

This plugin is a fork of d3-zoom that adds several features by separating scaling on x and y:

Scale independently along x-axis and y-axis

Constrain scale extent on zoom out to respect translate extent constraints

Apply "scale factor ratio" on user input. For instance, with a scale ratio of 0.5 on x-axis and 1 on y-axis, when user zoom with its mouse, the increase of scale factor on x-axis will only be half of the increase on y-axis.

@IPWright83
IPWright83 / .block
Last active May 9, 2017 — forked from mbostock/.block
Bar Chart
View .block
license: gpl-3.0
@IPWright83
IPWright83 / .block
Last active Apr 19, 2017 — forked from hollasch/.block
Smooth Polygon Convex Hull
View .block
height: 960
@IPWright83
IPWright83 / .block
Created Jan 26, 2017 — forked from mbostock/.block
Circle Wave
View .block
license: gpl-3.0
border: no
You can’t perform that action at this time.