@khanacademy/wonder-blocks-testing-core 1.0.0 → 1.0.1
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.
- package/CHANGELOG.md +7 -0
- package/dist/es/index.js +3 -22
- package/dist/index.js +9 -24
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @khanacademy/wonder-blocks-testing-core
|
|
2
2
|
|
|
3
|
+
## 1.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- c954464a: Fix how react-dom/server is imported in Wonder Blocks Testing Core
|
|
8
|
+
- 559e82d5: Update to build tooling, generating smaller output
|
|
9
|
+
|
|
3
10
|
## 1.0.0
|
|
4
11
|
|
|
5
12
|
### Major Changes
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { action } from '@storybook/addon-actions';
|
|
3
3
|
import { StaticRouter, MemoryRouter, Switch, Route } from 'react-router-dom';
|
|
4
|
+
import _extends from '@babel/runtime/helpers/extends';
|
|
5
|
+
import * as ReactDOMServer from 'react-dom/server';
|
|
4
6
|
|
|
5
7
|
const fixtures = Component => {
|
|
6
8
|
const templateMap = new WeakMap();
|
|
@@ -347,21 +349,6 @@ var adapters = /*#__PURE__*/Object.freeze({
|
|
|
347
349
|
DefaultConfigs: DefaultConfigs
|
|
348
350
|
});
|
|
349
351
|
|
|
350
|
-
function _extends() {
|
|
351
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
352
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
353
|
-
var source = arguments[i];
|
|
354
|
-
for (var key in source) {
|
|
355
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
356
|
-
target[key] = source[key];
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
return target;
|
|
361
|
-
};
|
|
362
|
-
return _extends.apply(this, arguments);
|
|
363
|
-
}
|
|
364
|
-
|
|
365
352
|
const componentCache = new Map();
|
|
366
353
|
const getNamedAdapterComponent = name => {
|
|
367
354
|
const existing = componentCache.get(name);
|
|
@@ -423,12 +410,6 @@ const hookHarness = makeHookHarness(DefaultAdapters, DefaultConfigs);
|
|
|
423
410
|
|
|
424
411
|
const testHarness = makeTestHarness(DefaultAdapters, DefaultConfigs);
|
|
425
412
|
|
|
426
|
-
if (process.env.NODE_ENV === 'production') {
|
|
427
|
-
module.exports = require('./cjs/react-dom-server.browser.production.min.js');
|
|
428
|
-
} else {
|
|
429
|
-
module.exports = require('./cjs/react-dom-server.browser.development.js');
|
|
430
|
-
}
|
|
431
|
-
|
|
432
413
|
const renderHookStatic = (render, {
|
|
433
414
|
wrapper,
|
|
434
415
|
initialProps
|
|
@@ -444,7 +425,7 @@ const renderHookStatic = (render, {
|
|
|
444
425
|
renderCallbackProps: initialProps
|
|
445
426
|
});
|
|
446
427
|
const componentWithWrapper = wrapper == null ? component : React.createElement(wrapper, null, component);
|
|
447
|
-
|
|
428
|
+
ReactDOMServer.renderToString(componentWithWrapper);
|
|
448
429
|
return {
|
|
449
430
|
result: {
|
|
450
431
|
current: result
|
package/dist/index.js
CHANGED
|
@@ -5,6 +5,10 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var addonActions = require('@storybook/addon-actions');
|
|
7
7
|
var reactRouterDom = require('react-router-dom');
|
|
8
|
+
var _extends = require('@babel/runtime/helpers/extends');
|
|
9
|
+
var ReactDOMServer = require('react-dom/server');
|
|
10
|
+
|
|
11
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
12
|
|
|
9
13
|
function _interopNamespace(e) {
|
|
10
14
|
if (e && e.__esModule) return e;
|
|
@@ -25,6 +29,8 @@ function _interopNamespace(e) {
|
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
32
|
+
var _extends__default = /*#__PURE__*/_interopDefaultLegacy(_extends);
|
|
33
|
+
var ReactDOMServer__namespace = /*#__PURE__*/_interopNamespace(ReactDOMServer);
|
|
28
34
|
|
|
29
35
|
const fixtures = Component => {
|
|
30
36
|
const templateMap = new WeakMap();
|
|
@@ -371,21 +377,6 @@ var adapters = /*#__PURE__*/Object.freeze({
|
|
|
371
377
|
DefaultConfigs: DefaultConfigs
|
|
372
378
|
});
|
|
373
379
|
|
|
374
|
-
function _extends() {
|
|
375
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
376
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
377
|
-
var source = arguments[i];
|
|
378
|
-
for (var key in source) {
|
|
379
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
380
|
-
target[key] = source[key];
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
return target;
|
|
385
|
-
};
|
|
386
|
-
return _extends.apply(this, arguments);
|
|
387
|
-
}
|
|
388
|
-
|
|
389
380
|
const componentCache = new Map();
|
|
390
381
|
const getNamedAdapterComponent = name => {
|
|
391
382
|
const existing = componentCache.get(name);
|
|
@@ -423,11 +414,11 @@ const Adapt = ({
|
|
|
423
414
|
|
|
424
415
|
const makeTestHarness = (adapters, defaultConfigs) => {
|
|
425
416
|
return (Component, configs) => {
|
|
426
|
-
const fullConfig =
|
|
417
|
+
const fullConfig = _extends__default["default"]({}, defaultConfigs, configs);
|
|
427
418
|
const harnessedComponent = React__namespace.forwardRef((props, ref) => React__namespace.createElement(Adapt, {
|
|
428
419
|
adapters: adapters,
|
|
429
420
|
configs: fullConfig
|
|
430
|
-
}, React__namespace.createElement(Component,
|
|
421
|
+
}, React__namespace.createElement(Component, _extends__default["default"]({}, props, {
|
|
431
422
|
ref: ref
|
|
432
423
|
}))));
|
|
433
424
|
harnessedComponent.displayName = `testHarness(${Component.displayName || Component.name || "Component"})`;
|
|
@@ -447,12 +438,6 @@ const hookHarness = makeHookHarness(DefaultAdapters, DefaultConfigs);
|
|
|
447
438
|
|
|
448
439
|
const testHarness = makeTestHarness(DefaultAdapters, DefaultConfigs);
|
|
449
440
|
|
|
450
|
-
if (process.env.NODE_ENV === 'production') {
|
|
451
|
-
module.exports = require('./cjs/react-dom-server.browser.production.min.js');
|
|
452
|
-
} else {
|
|
453
|
-
module.exports = require('./cjs/react-dom-server.browser.development.js');
|
|
454
|
-
}
|
|
455
|
-
|
|
456
441
|
const renderHookStatic = (render, {
|
|
457
442
|
wrapper,
|
|
458
443
|
initialProps
|
|
@@ -468,7 +453,7 @@ const renderHookStatic = (render, {
|
|
|
468
453
|
renderCallbackProps: initialProps
|
|
469
454
|
});
|
|
470
455
|
const componentWithWrapper = wrapper == null ? component : React__namespace.createElement(wrapper, null, component);
|
|
471
|
-
|
|
456
|
+
ReactDOMServer__namespace.renderToString(componentWithWrapper);
|
|
472
457
|
return {
|
|
473
458
|
result: {
|
|
474
459
|
current: result
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@khanacademy/wonder-blocks-testing-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"design": "v1",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"react-router-dom": "5.3.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@khanacademy/wb-dev-build-settings": "^1.0.
|
|
28
|
+
"@khanacademy/wb-dev-build-settings": "^1.0.1",
|
|
29
29
|
"@khanacademy/wonder-stuff-testing": "^3.0.1"
|
|
30
30
|
},
|
|
31
31
|
"author": "",
|