react-error-boundary 1.2.4 → 1.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,116 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.withErrorBoundary = undefined;
7
+
8
+ var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
9
+
10
+ var _react = require('react');
11
+
12
+ var _react2 = _interopRequireDefault(_react);
13
+
14
+ var _ErrorBoundaryFallbackComponent = require('./ErrorBoundaryFallbackComponent');
15
+
16
+ var _ErrorBoundaryFallbackComponent2 = _interopRequireDefault(_ErrorBoundaryFallbackComponent);
17
+
18
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
+
20
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
21
+
22
+ function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
23
+
24
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
25
+
26
+ var babelPluginFlowReactPropTypes_proptype_ComponentType = require('react').babelPluginFlowReactPropTypes_proptype_ComponentType || require('prop-types').any;
27
+
28
+ var ErrorBoundary = function (_Component) {
29
+ _inherits(ErrorBoundary, _Component);
30
+
31
+ function ErrorBoundary() {
32
+ var _ref;
33
+
34
+ var _temp, _this, _ret;
35
+
36
+ _classCallCheck(this, ErrorBoundary);
37
+
38
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
39
+ args[_key] = arguments[_key];
40
+ }
41
+
42
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = ErrorBoundary.__proto__ || Object.getPrototypeOf(ErrorBoundary)).call.apply(_ref, [this].concat(args))), _this), _this.state = {
43
+ error: null,
44
+ info: null
45
+ }, _temp), _possibleConstructorReturn(_this, _ret);
46
+ }
47
+
48
+ _createClass(ErrorBoundary, [{
49
+ key: 'componentDidCatch',
50
+ value: function componentDidCatch(error, info) {
51
+ var onError = this.props.onError;
52
+
53
+
54
+ if (typeof onError === 'function') {
55
+ try {
56
+ /* istanbul ignore next: Ignoring ternary; can’t reproduce missing info in test environment. */
57
+ onError.call(this, error, info ? info.componentStack : '');
58
+ } catch (ignoredError) {}
59
+ }
60
+
61
+ this.setState({ error: error, info: info });
62
+ }
63
+ }, {
64
+ key: 'render',
65
+ value: function render() {
66
+ var _props = this.props,
67
+ children = _props.children,
68
+ FallbackComponent = _props.FallbackComponent;
69
+ var _state = this.state,
70
+ error = _state.error,
71
+ info = _state.info;
72
+
73
+
74
+ if (error !== null) {
75
+ return _react2.default.createElement(FallbackComponent, {
76
+ componentStack:
77
+ // istanbul ignore next: Ignoring ternary; can’t reproduce missing info in test environment.
78
+ info ? info.componentStack : '',
79
+ error: error
80
+ });
81
+ }
82
+
83
+ return children || null;
84
+ }
85
+ }]);
86
+
87
+ return ErrorBoundary;
88
+ }(_react.Component);
89
+
90
+ ErrorBoundary.defaultProps = {
91
+ FallbackComponent: _ErrorBoundaryFallbackComponent2.default
92
+ };
93
+ ErrorBoundary.propTypes = {
94
+ error: typeof Error === 'function' ? require('prop-types').instanceOf(Error) : require('prop-types').any,
95
+ info: require('prop-types').shape({
96
+ componentStack: require('prop-types').string.isRequired
97
+ })
98
+ };
99
+ var withErrorBoundary = exports.withErrorBoundary = function withErrorBoundary(Component, FallbackComponent, onError) {
100
+ var Wrapped = function Wrapped(props) {
101
+ return _react2.default.createElement(
102
+ ErrorBoundary,
103
+ { FallbackComponent: FallbackComponent, onError: onError },
104
+ _react2.default.createElement(Component, props)
105
+ );
106
+ };
107
+
108
+ // Format for display in DevTools
109
+ var name = Component.displayName || Component.name;
110
+ Wrapped.displayName = name ? 'WithErrorBoundary(' + name + ')' : 'WithErrorBoundary';
111
+
112
+ return Wrapped;
113
+ };
114
+
115
+ withErrorBoundary.propTypes = babelPluginFlowReactPropTypes_proptype_ComponentType === require('prop-types').any ? {} : babelPluginFlowReactPropTypes_proptype_ComponentType;
116
+ exports.default = ErrorBoundary;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+
7
+ var _react = require("react");
8
+
9
+ var _react2 = _interopRequireDefault(_react);
10
+
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+
13
+ var toTitle = function toTitle(error, componentStack) {
14
+ return error.toString() + "\n\nThis is located at:" + componentStack;
15
+ };
16
+
17
+ var ErrorBoundaryFallbackComponent = function ErrorBoundaryFallbackComponent(_ref) {
18
+ var componentStack = _ref.componentStack,
19
+ error = _ref.error;
20
+ return _react2.default.createElement(
21
+ "div",
22
+ { style: style, title: toTitle(error, componentStack) },
23
+ _react2.default.createElement(
24
+ "svg",
25
+ { style: svgStyle, viewBox: "0 0 24 24", preserveAspectRatio: "xMidYMid" },
26
+ _react2.default.createElement("path", {
27
+ d: "M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,\n 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,\n 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,\n 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,\n 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,\n 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,\n 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z"
28
+ })
29
+ )
30
+ );
31
+ };
32
+
33
+ ErrorBoundaryFallbackComponent.propTypes = {
34
+ componentStack: require("prop-types").string.isRequired,
35
+ error: typeof Error === "function" ? require("prop-types").instanceOf(Error).isRequired : require("prop-types").any.isRequired
36
+ };
37
+ var style = {
38
+ height: '100%',
39
+ maxHeight: '100vh',
40
+ width: '100%',
41
+ maxWidth: '100vw',
42
+ display: 'flex',
43
+ flexDirection: 'column',
44
+ alignItems: 'center',
45
+ textAlign: 'center',
46
+ backgroundColor: '#C00',
47
+ color: '#FFF',
48
+ boxSizing: 'border-box',
49
+ cursor: 'help'
50
+ };
51
+
52
+ var svgStyle = {
53
+ fill: 'currentColor',
54
+ flex: '1 1 auto'
55
+ };
56
+
57
+ exports.default = ErrorBoundaryFallbackComponent;
@@ -0,0 +1,244 @@
1
+ 'use strict';
2
+
3
+ var _enzyme = require('enzyme');
4
+
5
+ var _react = require('react');
6
+
7
+ var _react2 = _interopRequireDefault(_react);
8
+
9
+ var _ErrorBoundary = require('../ErrorBoundary');
10
+
11
+ var _ErrorBoundary2 = _interopRequireDefault(_ErrorBoundary);
12
+
13
+ var _ErrorBoundaryFallbackComponent = require('../ErrorBoundaryFallbackComponent');
14
+
15
+ var _ErrorBoundaryFallbackComponent2 = _interopRequireDefault(_ErrorBoundaryFallbackComponent);
16
+
17
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
18
+
19
+ describe('ErrorBoundary', function () {
20
+ var consoleErrorSpy = void 0;
21
+ var mockError = void 0;
22
+
23
+ var Spell = void 0;
24
+ var Wand = void 0;
25
+
26
+ beforeAll(function () {
27
+ consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(function () {
28
+ // React error boundaries print the error to `console.error` stream even when it’s caught by our
29
+ // `ErrorBoundary` component. We suppress `console.error` to keep our test console output clean.
30
+ // @see #11098 Allow suppressing error boundary logs from intentionally thrown/caught errors
31
+ // https://github.com/facebook/react/issues/11098
32
+ });
33
+
34
+ mockError = new Error('You cast an unforgivable curse! You’ve earned a one-way ticket to Azkaban.');
35
+ Spell = function Spell(_ref) {
36
+ var incantation = _ref.incantation;
37
+
38
+ switch (incantation) {
39
+ case 'Avada Kedavra':
40
+ case 'Crucio':
41
+ case 'Imperio':
42
+ throw mockError;
43
+
44
+ default:
45
+ return _react2.default.createElement(
46
+ 'p',
47
+ null,
48
+ 'You cast the ' + incantation + ' spell!'
49
+ );
50
+ }
51
+ };
52
+
53
+ Wand = function Wand(_ref2) {
54
+ var name = _ref2.name,
55
+ incantation = _ref2.incantation;
56
+ return _react2.default.createElement(
57
+ 'div',
58
+ null,
59
+ _react2.default.createElement(
60
+ 'p',
61
+ null,
62
+ 'Casting spell with the ' + name + ' wand'
63
+ ),
64
+ _react2.default.createElement(Spell, { incantation: incantation })
65
+ );
66
+ };
67
+ });
68
+
69
+ afterAll(function () {
70
+ consoleErrorSpy.mockRestore();
71
+ });
72
+
73
+ it('Renders the child component if there is no error', function () {
74
+ var wrapper = (0, _enzyme.mount)(_react2.default.createElement(
75
+ _ErrorBoundary2.default,
76
+ null,
77
+ _react2.default.createElement(Wand, { name: 'Harry\u2019s', incantation: 'Expelliarmus' })
78
+ ));
79
+
80
+ var WandWithErrorBoundary = (0, _ErrorBoundary.withErrorBoundary)(Wand);
81
+ var wrapperWithErrorBoundary = (0, _enzyme.mount)(_react2.default.createElement(WandWithErrorBoundary, { name: 'Harry\u2019s', incantation: 'Expelliarmus' }));
82
+
83
+ expect(wrapper.state().error).toBe(null);
84
+ expect(wrapper.state().info).toBe(null);
85
+ expect(wrapper.containsMatchingElement(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, null))).toBe(false);
86
+ expect(wrapper.contains(_react2.default.createElement(Wand, { name: 'Harry\u2019s', incantation: 'Expelliarmus' }))).toBe(true);
87
+
88
+ // Note: We use `….instance().state …` instead of `….state() …` here because…
89
+ // > ReactWrapper::state() can only be called on the root
90
+ expect(wrapperWithErrorBoundary.find(_ErrorBoundary2.default).instance().state.error).toBe(null);
91
+ expect(wrapperWithErrorBoundary.find(_ErrorBoundary2.default).instance().state.info).toBe(null);
92
+ expect(wrapperWithErrorBoundary.containsMatchingElement(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, null))).toBe(false);
93
+ expect(wrapperWithErrorBoundary.contains(_react2.default.createElement(Wand, { name: 'Harry\u2019s', incantation: 'Expelliarmus' }))).toBe(true);
94
+ });
95
+
96
+ it('Sets its state to an error state and renders the default fallback component', function () {
97
+ var wrapper = (0, _enzyme.mount)(_react2.default.createElement(
98
+ _ErrorBoundary2.default,
99
+ null,
100
+ _react2.default.createElement(Wand, { name: 'Voldemort\u2019s', incantation: 'Avada Kedavra' })
101
+ ));
102
+
103
+ var WandWithErrorBoundary = (0, _ErrorBoundary.withErrorBoundary)(Wand);
104
+ var wrapperWithErrorBoundary = (0, _enzyme.mount)(_react2.default.createElement(WandWithErrorBoundary, { name: 'Voldemort\u2019s', incantation: 'Avada Kedavra' }));
105
+
106
+ expect(wrapper.state().error).toEqual(expect.objectContaining(mockError));
107
+ expect(wrapper.state().info).toEqual(expect.objectContaining({
108
+ componentStack: expect.any(String)
109
+ }));
110
+ expect(wrapper.containsMatchingElement(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, null))).toBe(true);
111
+
112
+ expect(wrapperWithErrorBoundary.find(_ErrorBoundary2.default).instance().state.error).toEqual(expect.objectContaining(mockError));
113
+ expect(wrapperWithErrorBoundary.find(_ErrorBoundary2.default).instance().state.info).toEqual(expect.objectContaining({
114
+ componentStack: expect.any(String)
115
+ }));
116
+ expect(wrapperWithErrorBoundary.containsMatchingElement(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, null))).toBe(true);
117
+ });
118
+
119
+ it('Sets its state to an error state and renders a custom fallback component', function () {
120
+ var MockFallbackComponent = function MockFallbackComponent(_ref3) {
121
+ var error = _ref3.error,
122
+ componentStack = _ref3.componentStack;
123
+ return _react2.default.createElement(
124
+ 'div',
125
+ null,
126
+ _react2.default.createElement(
127
+ 'p',
128
+ null,
129
+ _react2.default.createElement(
130
+ 'strong',
131
+ null,
132
+ 'Wand unable to perform magic!'
133
+ ),
134
+ 'Please contact Ollivanders in Diagon Alley for repairs.'
135
+ ),
136
+ _react2.default.createElement(
137
+ 'p',
138
+ null,
139
+ _react2.default.createElement(
140
+ 'strong',
141
+ null,
142
+ 'Error:'
143
+ ),
144
+ ' ',
145
+ error.toString()
146
+ ),
147
+ _react2.default.createElement(
148
+ 'p',
149
+ null,
150
+ _react2.default.createElement(
151
+ 'strong',
152
+ null,
153
+ 'Stacktrace:'
154
+ ),
155
+ _react2.default.createElement(
156
+ 'pre',
157
+ null,
158
+ componentStack
159
+ )
160
+ )
161
+ );
162
+ };
163
+
164
+ var wrapper = (0, _enzyme.mount)(_react2.default.createElement(
165
+ _ErrorBoundary2.default,
166
+ { FallbackComponent: MockFallbackComponent },
167
+ _react2.default.createElement(Wand, { name: 'Voldemort\u2019s', incantation: 'Crucio' })
168
+ ));
169
+
170
+ var WandWithErrorBoundary = (0, _ErrorBoundary.withErrorBoundary)(Wand, MockFallbackComponent);
171
+ var wrapperWithErrorBoundary = (0, _enzyme.mount)(_react2.default.createElement(WandWithErrorBoundary, { name: 'Voldemort\u2019s', incantation: 'Crucio' }));
172
+
173
+ expect(wrapper.state().error).toEqual(expect.objectContaining(mockError));
174
+ expect(wrapper.state().info).toEqual(expect.objectContaining({
175
+ componentStack: expect.any(String)
176
+ }));
177
+ expect(wrapper.containsMatchingElement(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, null))).toBe(false);
178
+ expect(wrapper.containsMatchingElement(_react2.default.createElement(MockFallbackComponent, {
179
+ error: mockError /* componentStack="ignored" */
180
+ }))).toBe(true);
181
+
182
+ expect(wrapperWithErrorBoundary.find(_ErrorBoundary2.default).instance().state.error).toEqual(expect.objectContaining(mockError));
183
+ expect(wrapperWithErrorBoundary.find(_ErrorBoundary2.default).instance().state.info).toEqual(expect.objectContaining({
184
+ componentStack: expect.any(String)
185
+ }));
186
+ expect(wrapperWithErrorBoundary.containsMatchingElement(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, null))).toBe(false);
187
+ expect(wrapperWithErrorBoundary.containsMatchingElement(_react2.default.createElement(MockFallbackComponent, {
188
+ error: mockError /* componentStack="ignored" */
189
+ }))).toBe(true);
190
+ });
191
+
192
+ it('Sets its state to an error state and invokes the onError callback prop', function () {
193
+ var mockOnError = jest.fn().mockImplementation(function (error, // eslint-disable-line no-unused-vars
194
+ info) // eslint-disable-line no-unused-vars
195
+ {});
196
+
197
+ var mockOnErrorWithErrorBoundary = jest.fn().mockImplementation(function (error, // eslint-disable-line no-unused-vars
198
+ info) // eslint-disable-line no-unused-vars
199
+ {});
200
+
201
+ var wrapper = (0, _enzyme.mount)(_react2.default.createElement(
202
+ _ErrorBoundary2.default,
203
+ { onError: mockOnError },
204
+ _react2.default.createElement(Wand, { name: 'Voldemort\u2019s', incantation: 'Imperio' })
205
+ ));
206
+ var WandWithErrorBoundary = (0, _ErrorBoundary.withErrorBoundary)(Wand, _ErrorBoundaryFallbackComponent2.default, mockOnErrorWithErrorBoundary);
207
+ var wrapperWithErrorBoundary = (0, _enzyme.mount)(_react2.default.createElement(WandWithErrorBoundary, { name: 'Voldemort\u2019s', incantation: 'Imperio' }));
208
+
209
+ expect(wrapper.state().error).toEqual(expect.objectContaining(mockError));
210
+ expect(wrapper.state().info).toEqual(expect.objectContaining({
211
+ componentStack: expect.any(String)
212
+ }));
213
+ expect(mockOnError).toHaveBeenCalledWith(mockError, expect.any(String));
214
+ expect(wrapper.containsMatchingElement(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, {
215
+ error: mockError /* componentStack="ignored" */
216
+ }))).toBe(true);
217
+
218
+ expect(wrapperWithErrorBoundary.find(_ErrorBoundary2.default).instance().state.error).toEqual(expect.objectContaining(mockError));
219
+ expect(wrapperWithErrorBoundary.find(_ErrorBoundary2.default).instance().state.info).toEqual(expect.objectContaining({
220
+ componentStack: expect.any(String)
221
+ }));
222
+ expect(mockOnErrorWithErrorBoundary).toHaveBeenCalledWith(mockError, expect.any(String));
223
+ expect(wrapperWithErrorBoundary.containsMatchingElement(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, {
224
+ error: mockError /* componentStack="ignored" */
225
+ }))).toBe(true);
226
+ });
227
+
228
+ it('sets the correct displayName for wrapped components', function () {
229
+ function NormalComponent() {
230
+ return null;
231
+ }
232
+ expect((0, _ErrorBoundary.withErrorBoundary)(NormalComponent).displayName).toBe('WithErrorBoundary(NormalComponent)');
233
+
234
+ function ComponentWithDisplayNameOverride() {
235
+ return null;
236
+ }
237
+ ComponentWithDisplayNameOverride.displayName = 'Override';
238
+
239
+ expect((0, _ErrorBoundary.withErrorBoundary)(ComponentWithDisplayNameOverride).displayName).toBe('WithErrorBoundary(Override)');
240
+ expect((0, _ErrorBoundary.withErrorBoundary)(function () {
241
+ return null;
242
+ }).displayName).toBe('WithErrorBoundary');
243
+ });
244
+ });
@@ -0,0 +1,27 @@
1
+ 'use strict';
2
+
3
+ var _react = require('react');
4
+
5
+ var _react2 = _interopRequireDefault(_react);
6
+
7
+ var _enzyme = require('enzyme');
8
+
9
+ var _ErrorBoundaryFallbackComponent = require('../ErrorBoundaryFallbackComponent');
10
+
11
+ var _ErrorBoundaryFallbackComponent2 = _interopRequireDefault(_ErrorBoundaryFallbackComponent);
12
+
13
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
14
+
15
+ describe('ErrorBoundaryFallbackComponent', function () {
16
+ var mockError = void 0;
17
+
18
+ beforeAll(function () {
19
+ mockError = new Error('You cast an unforgivable curse! You’ve earned a one-way ticket to Azkaban.');
20
+ });
21
+
22
+ it('Passes a snapshot test', function () {
23
+ var wrapper = (0, _enzyme.shallow)(_react2.default.createElement(_ErrorBoundaryFallbackComponent2.default, { error: mockError, componentStack: '' }));
24
+
25
+ expect(wrapper).toMatchSnapshot();
26
+ });
27
+ });
@@ -0,0 +1,213 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`ErrorBoundaryFallbackComponent Passes a snapshot test 1`] = `
4
+ ShallowWrapper {
5
+ Symbol(enzyme.__root__): [Circular],
6
+ Symbol(enzyme.__unrendered__): <ErrorBoundaryFallbackComponent
7
+ componentStack=""
8
+ error={[Error: You cast an unforgivable curse! You’ve earned a one-way ticket to Azkaban.]}
9
+ />,
10
+ Symbol(enzyme.__renderer__): Object {
11
+ "batchedUpdates": [Function],
12
+ "getNode": [Function],
13
+ "render": [Function],
14
+ "simulateEvent": [Function],
15
+ "unmount": [Function],
16
+ },
17
+ Symbol(enzyme.__node__): Object {
18
+ "instance": null,
19
+ "key": undefined,
20
+ "nodeType": "host",
21
+ "props": Object {
22
+ "children": <svg
23
+ preserveAspectRatio="xMidYMid"
24
+ style={
25
+ Object {
26
+ "fill": "currentColor",
27
+ "flex": "1 1 auto",
28
+ }
29
+ }
30
+ viewBox="0 0 24 24"
31
+ >
32
+ <path
33
+ d="M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,
34
+ 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,
35
+ 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,
36
+ 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,
37
+ 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,
38
+ 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,
39
+ 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z"
40
+ />
41
+ </svg>,
42
+ "style": Object {
43
+ "alignItems": "center",
44
+ "backgroundColor": "#C00",
45
+ "boxSizing": "border-box",
46
+ "color": "#FFF",
47
+ "cursor": "help",
48
+ "display": "flex",
49
+ "flexDirection": "column",
50
+ "height": "100%",
51
+ "maxHeight": "100vh",
52
+ "maxWidth": "100vw",
53
+ "textAlign": "center",
54
+ "width": "100%",
55
+ },
56
+ "title": "Error: You cast an unforgivable curse! You’ve earned a one-way ticket to Azkaban.
57
+
58
+ This is located at:",
59
+ },
60
+ "ref": null,
61
+ "rendered": Object {
62
+ "instance": null,
63
+ "key": undefined,
64
+ "nodeType": "host",
65
+ "props": Object {
66
+ "children": <path
67
+ d="M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,
68
+ 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,
69
+ 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,
70
+ 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,
71
+ 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,
72
+ 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,
73
+ 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z"
74
+ />,
75
+ "preserveAspectRatio": "xMidYMid",
76
+ "style": Object {
77
+ "fill": "currentColor",
78
+ "flex": "1 1 auto",
79
+ },
80
+ "viewBox": "0 0 24 24",
81
+ },
82
+ "ref": null,
83
+ "rendered": Object {
84
+ "instance": null,
85
+ "key": undefined,
86
+ "nodeType": "host",
87
+ "props": Object {
88
+ "d": "M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,
89
+ 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,
90
+ 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,
91
+ 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,
92
+ 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,
93
+ 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,
94
+ 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z",
95
+ },
96
+ "ref": null,
97
+ "rendered": null,
98
+ "type": "path",
99
+ },
100
+ "type": "svg",
101
+ },
102
+ "type": "div",
103
+ },
104
+ Symbol(enzyme.__nodes__): Array [
105
+ Object {
106
+ "instance": null,
107
+ "key": undefined,
108
+ "nodeType": "host",
109
+ "props": Object {
110
+ "children": <svg
111
+ preserveAspectRatio="xMidYMid"
112
+ style={
113
+ Object {
114
+ "fill": "currentColor",
115
+ "flex": "1 1 auto",
116
+ }
117
+ }
118
+ viewBox="0 0 24 24"
119
+ >
120
+ <path
121
+ d="M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,
122
+ 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,
123
+ 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,
124
+ 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,
125
+ 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,
126
+ 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,
127
+ 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z"
128
+ />
129
+ </svg>,
130
+ "style": Object {
131
+ "alignItems": "center",
132
+ "backgroundColor": "#C00",
133
+ "boxSizing": "border-box",
134
+ "color": "#FFF",
135
+ "cursor": "help",
136
+ "display": "flex",
137
+ "flexDirection": "column",
138
+ "height": "100%",
139
+ "maxHeight": "100vh",
140
+ "maxWidth": "100vw",
141
+ "textAlign": "center",
142
+ "width": "100%",
143
+ },
144
+ "title": "Error: You cast an unforgivable curse! You’ve earned a one-way ticket to Azkaban.
145
+
146
+ This is located at:",
147
+ },
148
+ "ref": null,
149
+ "rendered": Object {
150
+ "instance": null,
151
+ "key": undefined,
152
+ "nodeType": "host",
153
+ "props": Object {
154
+ "children": <path
155
+ d="M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,
156
+ 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,
157
+ 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,
158
+ 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,
159
+ 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,
160
+ 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,
161
+ 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z"
162
+ />,
163
+ "preserveAspectRatio": "xMidYMid",
164
+ "style": Object {
165
+ "fill": "currentColor",
166
+ "flex": "1 1 auto",
167
+ },
168
+ "viewBox": "0 0 24 24",
169
+ },
170
+ "ref": null,
171
+ "rendered": Object {
172
+ "instance": null,
173
+ "key": undefined,
174
+ "nodeType": "host",
175
+ "props": Object {
176
+ "d": "M20,12A8,8 0 0,0 12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20A8,8 0 0,0 20,
177
+ 12M22,12A10,10 0 0,1 12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2A10,10 0 0,1 22,
178
+ 12M15.5,8C16.3,8 17,8.7 17,9.5C17,10.3 16.3,11 15.5,11C14.7,11 14,10.3 14,
179
+ 9.5C14,8.7 14.7,8 15.5,8M10,9.5C10,10.3 9.3,11 8.5,11C7.7,11 7,10.3 7,9.5C7,
180
+ 8.7 7.7,8 8.5,8C9.3,8 10,8.7 10,9.5M12,14C13.75,14 15.29,14.72 16.19,
181
+ 15.81L14.77,17.23C14.32,16.5 13.25,16 12,16C10.75,16 9.68,16.5 9.23,
182
+ 17.23L7.81,15.81C8.71,14.72 10.25,14 12,14Z",
183
+ },
184
+ "ref": null,
185
+ "rendered": null,
186
+ "type": "path",
187
+ },
188
+ "type": "svg",
189
+ },
190
+ "type": "div",
191
+ },
192
+ ],
193
+ Symbol(enzyme.__options__): Object {
194
+ "adapter": ReactSixteenAdapter {
195
+ "options": Object {
196
+ "enableComponentDidUpdateOnSetState": true,
197
+ "lifecycles": Object {
198
+ "componentDidUpdate": Object {
199
+ "onSetState": true,
200
+ },
201
+ "getDerivedStateFromProps": true,
202
+ "getSnapshotBeforeUpdate": true,
203
+ "setState": Object {
204
+ "skipsComponentDidUpdateOnNullish": true,
205
+ },
206
+ },
207
+ },
208
+ },
209
+ "attachTo": undefined,
210
+ "hydrateIn": undefined,
211
+ },
212
+ }
213
+ `;
@@ -0,0 +1,21 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ErrorBoundaryFallbackComponent = exports.withErrorBoundary = exports.ErrorBoundary = undefined;
7
+
8
+ var _ErrorBoundaryFallbackComponent = require('./ErrorBoundaryFallbackComponent');
9
+
10
+ var _ErrorBoundaryFallbackComponent2 = _interopRequireDefault(_ErrorBoundaryFallbackComponent);
11
+
12
+ var _ErrorBoundary = require('./ErrorBoundary');
13
+
14
+ var _ErrorBoundary2 = _interopRequireDefault(_ErrorBoundary);
15
+
16
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
+
18
+ exports.default = _ErrorBoundary2.default;
19
+ exports.ErrorBoundary = _ErrorBoundary2.default;
20
+ exports.withErrorBoundary = _ErrorBoundary.withErrorBoundary;
21
+ exports.ErrorBoundaryFallbackComponent = _ErrorBoundaryFallbackComponent2.default;