@newskit-render/shared-components 4.7.0 → 4.8.0-alpha.2
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/dist/cjs/helpers/testHelpers.d.ts +7 -2
- package/dist/cjs/helpers/testHelpers.js +5 -4
- package/dist/cjs/helpers/testHelpers.js.map +1 -1
- package/dist/esm/helpers/testHelpers.d.ts +7 -2
- package/dist/esm/helpers/testHelpers.js +5 -4
- package/dist/esm/helpers/testHelpers.js.map +1 -1
- package/package.json +7 -6
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RenderOptions } from '@testing-library/react';
|
|
3
2
|
import { UncompiledTheme } from 'newskit';
|
|
3
|
+
import { RenderOptions, RenderResult } from '@testing-library/react';
|
|
4
|
+
import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup';
|
|
5
|
+
type RenderResultWithEvent = {
|
|
6
|
+
user: UserEvent;
|
|
7
|
+
} & RenderResult;
|
|
4
8
|
export declare const renderWithThemeTsl: <T extends {}>(Component: React.ComponentType<T>, props?: (T & {
|
|
5
9
|
children?: React.ReactNode;
|
|
6
|
-
}) | undefined, theme?: UncompiledTheme, options?: Omit<RenderOptions, 'wrapper'
|
|
10
|
+
}) | undefined, theme?: UncompiledTheme, options?: Omit<RenderOptions, 'wrapper'>, userEventOption?: Object) => RenderResultWithEvent;
|
|
11
|
+
export {};
|
|
@@ -33,14 +33,15 @@ Object.defineProperty(window, 'matchMedia', {
|
|
|
33
33
|
}); }),
|
|
34
34
|
});
|
|
35
35
|
var react_1 = __importDefault(require("react"));
|
|
36
|
-
var react_2 = require("@testing-library/react");
|
|
37
36
|
var newskit_1 = require("newskit");
|
|
38
|
-
var
|
|
37
|
+
var react_2 = require("@testing-library/react");
|
|
38
|
+
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
39
|
+
var renderWithThemeTsl = function (Component, props, theme, options, userEventOption) {
|
|
39
40
|
if (theme === void 0) { theme = newskit_1.newskitLightTheme; }
|
|
40
|
-
return (0, react_2.render)(react_1.default.createElement(Component, __assign({}, props)), __assign(__assign({}, options), { wrapper: function (_a) {
|
|
41
|
+
return __assign({ user: user_event_1.default.setup(userEventOption) }, (0, react_2.render)(react_1.default.createElement(Component, __assign({}, props)), __assign(__assign({}, options), { wrapper: function (_a) {
|
|
41
42
|
var children = _a.children;
|
|
42
43
|
return (react_1.default.createElement(newskit_1.ThemeProvider, { theme: theme }, children));
|
|
43
|
-
} }));
|
|
44
|
+
} })));
|
|
44
45
|
};
|
|
45
46
|
exports.renderWithThemeTsl = renderWithThemeTsl;
|
|
46
47
|
//# sourceMappingURL=testHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testHelpers.js","sourceRoot":"","sources":["../../../src/helpers/testHelpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oGAAoG;AACpG;;GAEG;AACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;IAC1C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC;QAC9C,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;KACzB,CAAC,EAT6C,CAS7C,CAAC;CACJ,CAAC,CAAA;AAEF,gDAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"testHelpers.js","sourceRoot":"","sources":["../../../src/helpers/testHelpers.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,oGAAoG;AACpG;;GAEG;AACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,EAAE;IAC1C,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAC,KAAK,IAAK,OAAA,CAAC;QAC9C,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,IAAI,CAAC,EAAE,EAAE;QACtB,cAAc,EAAE,IAAI,CAAC,EAAE,EAAE;QACzB,gBAAgB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC3B,mBAAmB,EAAE,IAAI,CAAC,EAAE,EAAE;QAC9B,aAAa,EAAE,IAAI,CAAC,EAAE,EAAE;KACzB,CAAC,EAT6C,CAS7C,CAAC;CACJ,CAAC,CAAA;AAEF,gDAAyB;AACzB,mCAA2E;AAC3E,gDAI+B;AAC/B,2EAAmD;AAO5C,IAAM,kBAAkB,GAAG,UAChC,SAAiC,EACjC,KAA0C,EAC1C,KAA0C,EAC1C,OAAwC,EACxC,eAAwB;IAFxB,sBAAA,EAAA,QAAyB,2BAAiB;IAI1C,kBACE,IAAI,EAAE,oBAAS,CAAC,KAAK,CAAC,eAAe,CAAC,IACnC,IAAA,cAAS,EAAC,8BAAC,SAAS,eAAM,KAAW,EAAI,wBACvC,OAAO,KACV,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAAO,OAAA,CACzB,8BAAC,uBAAa,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAiB,CACxD;QAF0B,CAE1B,IACD,EACH;AACH,CAAC,CAAA;AAhBY,QAAA,kBAAkB,sBAgB9B"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { RenderOptions } from '@testing-library/react';
|
|
3
2
|
import { UncompiledTheme } from 'newskit';
|
|
3
|
+
import { RenderOptions, RenderResult } from '@testing-library/react';
|
|
4
|
+
import { UserEvent } from '@testing-library/user-event/dist/types/setup/setup';
|
|
5
|
+
type RenderResultWithEvent = {
|
|
6
|
+
user: UserEvent;
|
|
7
|
+
} & RenderResult;
|
|
4
8
|
export declare const renderWithThemeTsl: <T extends {}>(Component: React.ComponentType<T>, props?: (T & {
|
|
5
9
|
children?: React.ReactNode;
|
|
6
|
-
}) | undefined, theme?: UncompiledTheme, options?: Omit<RenderOptions, 'wrapper'
|
|
10
|
+
}) | undefined, theme?: UncompiledTheme, options?: Omit<RenderOptions, 'wrapper'>, userEventOption?: Object) => RenderResultWithEvent;
|
|
11
|
+
export {};
|
|
@@ -27,13 +27,14 @@ Object.defineProperty(window, 'matchMedia', {
|
|
|
27
27
|
}); }),
|
|
28
28
|
});
|
|
29
29
|
import React from 'react';
|
|
30
|
-
import { render as renderTsl } from '@testing-library/react';
|
|
31
30
|
import { ThemeProvider, newskitLightTheme } from 'newskit';
|
|
32
|
-
|
|
31
|
+
import { render as renderTsl, } from '@testing-library/react';
|
|
32
|
+
import userEvent from '@testing-library/user-event';
|
|
33
|
+
export var renderWithThemeTsl = function (Component, props, theme, options, userEventOption) {
|
|
33
34
|
if (theme === void 0) { theme = newskitLightTheme; }
|
|
34
|
-
return renderTsl(React.createElement(Component, __assign({}, props)), __assign(__assign({}, options), { wrapper: function (_a) {
|
|
35
|
+
return __assign({ user: userEvent.setup(userEventOption) }, renderTsl(React.createElement(Component, __assign({}, props)), __assign(__assign({}, options), { wrapper: function (_a) {
|
|
35
36
|
var children = _a.children;
|
|
36
37
|
return (React.createElement(ThemeProvider, { theme: theme }, children));
|
|
37
|
-
} }));
|
|
38
|
+
} })));
|
|
38
39
|
};
|
|
39
40
|
//# sourceMappingURL=testHelpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testHelpers.js","sourceRoot":"","sources":["../../../src/helpers/testHelpers.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,oGAAoG;AACpG;;GAEG;AACH,MAAM,CA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,EAAmB,aAAa,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAC3E,OAAO,EACL,MAAM,IAAI,SAAS,GAGpB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,SAAS,MAAM,6BAA6B,CAAA;AAOnD,MAAM,CAAC,IAAM,kBAAkB,GAAG,UAChC,SAAiC,EACjC,KAA0C,EAC1C,KAA0C,EAC1C,OAAwC,EACxC,eAAwB;IAFxB,sBAAA,EAAA,yBAA0C;IAI1C,kBACE,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,IACnC,SAAS,CAAC,oBAAC,SAAS,eAAM,KAAW,EAAI,wBACvC,OAAO,KACV,OAAO,EAAE,UAAC,EAAY;gBAAV,QAAQ,cAAA;YAAO,OAAA,CACzB,oBAAC,aAAa,IAAC,KAAK,EAAE,KAAK,IAAG,QAAQ,CAAiB,CACxD;QAF0B,CAE1B,IACD,EACH;AACH,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@newskit-render/shared-components",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0-alpha.2",
|
|
4
4
|
"description": "Newskit Render Shared Components",
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "UNLICENSED",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@babel/polyfill": "7.12.1",
|
|
48
48
|
"@babel/register": "7.18.9",
|
|
49
49
|
"@emotion/jest": "11.10.5",
|
|
50
|
-
"@newskit-render/validation": "^1.12.1",
|
|
50
|
+
"@newskit-render/validation": "^1.12.2-alpha.1",
|
|
51
51
|
"@storybook/addon-actions": "6.5.16",
|
|
52
52
|
"@storybook/react": "6.5.16",
|
|
53
|
-
"@testing-library/jest-dom": "6.1.
|
|
53
|
+
"@testing-library/jest-dom": "6.1.3",
|
|
54
54
|
"@testing-library/react": "14.0.0",
|
|
55
55
|
"@testing-library/user-event": "14.4.3",
|
|
56
|
-
"@types/jest": "
|
|
56
|
+
"@types/jest": "29.5.5",
|
|
57
57
|
"@types/react": "18.0.26",
|
|
58
58
|
"@types/react-dates": "21.8.3",
|
|
59
59
|
"@types/react-dom": "18.0.10",
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
"eslint-plugin-cypress": "2.12.1",
|
|
68
68
|
"eslint-plugin-prettier": "4.2.1",
|
|
69
69
|
"eslint-plugin-react": "7.31.11",
|
|
70
|
-
"jest": "
|
|
70
|
+
"jest": "29.7.0",
|
|
71
|
+
"jest-environment-jsdom": "29.7.0",
|
|
71
72
|
"jest-junit": "15.0.0",
|
|
72
73
|
"jest-watch-typeahead": "2.2.1",
|
|
73
74
|
"lint-staged": "13.1.0",
|
|
@@ -76,7 +77,7 @@
|
|
|
76
77
|
"prettier": "2.8.1",
|
|
77
78
|
"react": "18.2.0",
|
|
78
79
|
"react-dom": "18.2.0",
|
|
79
|
-
"ts-jest": "
|
|
80
|
+
"ts-jest": "29.1.1",
|
|
80
81
|
"typescript": "4.9.4"
|
|
81
82
|
},
|
|
82
83
|
"peerDependencies": {
|