@common-stack/client-react 0.6.1-alpha.3 → 1.0.1-alpha.0
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/lib/__tests__/fill-register-test.js +16 -41
- package/lib/__tests__/fill-register-test.js.map +1 -1
- package/lib/__tests__/helpers/sample-menu.js +1 -4
- package/lib/__tests__/helpers/sample-menu.js.map +1 -1
- package/lib/__tests__/integrated-routes.test.js +17 -44
- package/lib/__tests__/integrated-routes.test.js.map +1 -1
- package/lib/__tests__/router-render.test.js +14 -57
- package/lib/__tests__/router-render.test.js.map +1 -1
- package/lib/connector/base-connector.d.ts +53 -0
- package/lib/connector/base-connector.js +129 -0
- package/lib/connector/base-connector.js.map +1 -0
- package/lib/connector/connector.d.ts +9 -0
- package/lib/connector/connector.js +14 -0
- package/lib/connector/connector.js.map +1 -0
- package/lib/connector/connector.native.d.ts +9 -0
- package/lib/connector/connector.native.js +15 -0
- package/lib/connector/connector.native.js.map +1 -0
- package/lib/connector/connector.test.js +11 -0
- package/lib/connector/connector.test.js.map +1 -0
- package/lib/connector/index.d.ts +1 -0
- package/lib/connector/index.js +2 -0
- package/lib/connector/index.js.map +1 -0
- package/lib/index.d.ts +1 -2
- package/lib/index.js +10 -29
- package/lib/index.js.map +1 -1
- package/lib/index.native.d.ts +1 -1
- package/lib/index.native.js +10 -28
- package/lib/index.native.js.map +1 -1
- package/lib/interfaces/extended-feature.d.ts +50 -0
- package/lib/interfaces/extended-feature.js +1 -56
- package/lib/interfaces/extended-feature.js.map +1 -1
- package/lib/interfaces/feature.d.ts +13 -0
- package/lib/interfaces/feature.js +2 -0
- package/lib/interfaces/feature.js.map +1 -0
- package/lib/interfaces/index.d.ts +2 -0
- package/lib/interfaces/index.js +5 -20
- package/lib/interfaces/index.js.map +1 -1
- package/lib/interfaces/menu.js +2 -5
- package/lib/interfaces/menu.js.map +1 -1
- package/lib/interfaces/new-router.js +1 -2
- package/lib/interfaces/router.js +1 -2
- package/lib/inversify/InversifyContext.d.ts +4 -4
- package/lib/inversify/InversifyContext.js +6 -34
- package/lib/inversify/InversifyContext.js.map +1 -1
- package/lib/inversify/index.js +1 -17
- package/lib/inversify/index.js.map +1 -1
- package/lib/plugin-area/__tests__/higher-order-component-util.test.js +13 -38
- package/lib/plugin-area/__tests__/higher-order-component-util.test.js.map +1 -1
- package/lib/plugin-area/__tests__/plugin-api.test.js +11 -13
- package/lib/plugin-area/__tests__/plugin-api.test.js.map +1 -1
- package/lib/plugin-area/base-plugin-area.d.ts +1 -1
- package/lib/plugin-area/base-plugin-area.js +18 -39
- package/lib/plugin-area/base-plugin-area.js.map +1 -1
- package/lib/plugin-area/higher-order-component-util.js +3 -7
- package/lib/plugin-area/higher-order-component-util.js.map +1 -1
- package/lib/plugin-area/index.d.ts +2 -2
- package/lib/plugin-area/index.js +5 -35
- package/lib/plugin-area/index.js.map +1 -1
- package/lib/plugin-area/index.native.d.ts +2 -2
- package/lib/plugin-area/index.native.js +7 -37
- package/lib/plugin-area/index.native.js.map +1 -1
- package/lib/plugin-area/plugin-api.js +15 -18
- package/lib/plugin-area/plugin-api.js.map +1 -1
- package/lib/plugin-area/plugin-context.js +5 -32
- package/lib/plugin-area/plugin-context.js.map +1 -1
- package/lib/route/__tests__/admin-new-routes.test.js +11 -45
- package/lib/route/__tests__/admin-new-routes.test.js.map +1 -1
- package/lib/route/__tests__/getFlatMenus.test.js +5 -7
- package/lib/route/__tests__/getFlatMenus.test.js.map +1 -1
- package/lib/route/__tests__/render-routes-config.test.js +6 -18
- package/lib/route/__tests__/render-routes-config.test.js.map +1 -1
- package/lib/route/__tests__/route-type.test.js +1 -2
- package/lib/route/__tests__/route-type.test.js.map +1 -1
- package/lib/route/get-routes.js +22 -29
- package/lib/route/get-routes.js.map +1 -1
- package/lib/route/get-routes.test.js +6 -17
- package/lib/route/get-routes.test.js.map +1 -1
- package/lib/route/index.js +2 -18
- package/lib/route/index.js.map +1 -1
- package/lib/route/index.native.js +1 -17
- package/lib/route/index.native.js.map +1 -1
- package/lib/route/old/__tests__/config-sidebar-menu.test.d.ts +1 -0
- package/lib/route/old/__tests__/config-sidebar-menu.test.js +199 -198
- package/lib/route/old/__tests__/config-sidebar-menu.test.js.map +1 -1
- package/lib/route/old/get-menus.js +14 -21
- package/lib/route/old/get-menus.js.map +1 -1
- package/lib/route/old/get-routes-notused.js +14 -12
- package/lib/route/old/get-routes-notused.js.map +1 -1
- package/lib/route/old/render.d.ts +2 -2
- package/lib/route/old/render.js +4 -31
- package/lib/route/old/render.js.map +1 -1
- package/lib/route/react-navigation/get-navigation-utils.js +35 -40
- package/lib/route/react-navigation/get-navigation-utils.js.map +1 -1
- package/lib/route/react-navigation/get-navigation-utils.test.js +43 -26
- package/lib/route/react-navigation/get-navigation-utils.test.js.map +1 -1
- package/lib/route/react-navigation/index.js +2 -18
- package/lib/route/react-navigation/index.js.map +1 -1
- package/lib/route/react-navigation/react-native.sample.test.js +8 -22
- package/lib/route/react-navigation/react-native.sample.test.js.map +1 -1
- package/lib/route/react-navigation/react-native.sample1.test.js +14 -48
- package/lib/route/react-navigation/react-native.sample1.test.js.map +1 -1
- package/lib/route/react-navigation/react-navigation-render.d.ts +2 -2
- package/lib/route/react-navigation/react-navigation-render.js +17 -32
- package/lib/route/react-navigation/react-navigation-render.js.map +1 -1
- package/lib/route/react-navigation/react-navigation-render.test.js +23 -37
- package/lib/route/react-navigation/react-navigation-render.test.js.map +1 -1
- package/lib/route/react-navigation/root-navigation.js +5 -9
- package/lib/route/react-navigation/root-navigation.js.map +1 -1
- package/lib/route/react-navigation/routes.js +1 -2
- package/lib/route/react-navigation/types.d.ts +4 -4
- package/lib/route/react-navigation/types.js +1 -5
- package/lib/route/react-navigation/types.js.map +1 -1
- package/lib/route/render-routes.d.ts +2 -2
- package/lib/route/render-routes.js +33 -66
- package/lib/route/render-routes.js.map +1 -1
- package/lib/route/render-routes.native.d.ts +2 -2
- package/lib/route/render-routes.native.js +33 -66
- package/lib/route/render-routes.native.js.map +1 -1
- package/lib/route/render-routes.test.js +112 -126
- package/lib/route/render-routes.test.js.map +1 -1
- package/lib/route/root-navigation.js +3 -7
- package/lib/route/root-navigation.js.map +1 -1
- package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js +13 -38
- package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js.map +1 -1
- package/lib/route-based-plugin-area/__tests__/plugin-api.test.js +11 -13
- package/lib/route-based-plugin-area/__tests__/plugin-api.test.js.map +1 -1
- package/lib/route-based-plugin-area/higher-order-component-util.js +3 -7
- package/lib/route-based-plugin-area/higher-order-component-util.js.map +1 -1
- package/lib/route-based-plugin-area/index.js +2 -18
- package/lib/route-based-plugin-area/index.js.map +1 -1
- package/lib/route-based-plugin-area/plugin-api.js +15 -18
- package/lib/route-based-plugin-area/plugin-api.js.map +1 -1
- package/lib/route-based-plugin-area/plugin-context.js +5 -32
- package/lib/route-based-plugin-area/plugin-context.js.map +1 -1
- package/lib/route-based-plugin-area/route-based-plugin-area.d.ts +1 -1
- package/lib/route-based-plugin-area/route-based-plugin-area.js +12 -39
- package/lib/route-based-plugin-area/route-based-plugin-area.js.map +1 -1
- package/lib/router-factory/index.d.ts +1 -1
- package/lib/router-factory/index.js +6 -32
- package/lib/router-factory/index.js.map +1 -1
- package/lib/router-factory/index.native.d.ts +1 -1
- package/lib/router-factory/index.native.js +6 -32
- package/lib/router-factory/index.native.js.map +1 -1
- package/lib/utils/before-ssr.d.ts +5 -0
- package/lib/utils/before-ssr.js +9 -0
- package/lib/utils/before-ssr.js.map +1 -0
- package/lib/utils/combine.d.ts +1 -0
- package/lib/utils/combine.js +3 -0
- package/lib/utils/combine.js.map +1 -0
- package/lib/utils/hydrate.d.ts +4 -0
- package/lib/utils/hydrate.js +14 -0
- package/lib/utils/hydrate.js.map +1 -0
- package/lib/utils/index.d.ts +3 -0
- package/lib/utils/index.js +5 -18
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/sort-keys.js +3 -10
- package/lib/utils/sort-keys.js.map +1 -1
- package/lib/utils/sort-keys.test.js +2 -4
- package/lib/utils/sort-keys.test.js.map +1 -1
- package/lib/utils/utils.js +1 -5
- package/lib/utils/utils.js.map +1 -1
- package/package.json +6 -5
- package/lib/application/__tests__/react-client.test.d.ts +0 -1
- package/lib/application/__tests__/react-client.test.js +0 -23
- package/lib/application/__tests__/react-client.test.js.map +0 -1
- package/lib/application/base-apollo-client.d.ts +0 -21
- package/lib/application/base-apollo-client.js +0 -161
- package/lib/application/base-apollo-client.js.map +0 -1
- package/lib/application/base-redux-config.d.ts +0 -22
- package/lib/application/base-redux-config.js +0 -58
- package/lib/application/base-redux-config.js.map +0 -1
- package/lib/application/config.d.ts +0 -4
- package/lib/application/config.js +0 -38
- package/lib/application/config.js.map +0 -1
- package/lib/application/react-client.d.ts +0 -7
- package/lib/application/react-client.js +0 -152
- package/lib/application/react-client.js.map +0 -1
- package/lib/connector/base-react-client-feature.d.ts +0 -31
- package/lib/connector/base-react-client-feature.js +0 -102
- package/lib/connector/base-react-client-feature.js.map +0 -1
- package/lib/connector/monaco-connector.d.ts +0 -19
- package/lib/connector/monaco-connector.js +0 -76
- package/lib/connector/monaco-connector.js.map +0 -1
- package/lib/connector/react-client-feature.d.ts +0 -7
- package/lib/connector/react-client-feature.js +0 -15
- package/lib/connector/react-client-feature.js.map +0 -1
- package/lib/connector/react-client-feature.native.d.ts +0 -7
- package/lib/connector/react-client-feature.native.js +0 -18
- package/lib/connector/react-client-feature.native.js.map +0 -1
- package/lib/connector/react-client-feature.test.js +0 -10
- package/lib/connector/react-client-feature.test.js.map +0 -1
- package/lib/interfaces/monaco-feature.d.ts +0 -46
- package/lib/interfaces/monaco-feature.js +0 -3
- package/lib/interfaces/monaco-feature.js.map +0 -1
- package/lib/interfaces/react-client-feature.d.ts +0 -77
- package/lib/interfaces/react-client-feature.js +0 -3
- package/lib/interfaces/react-client-feature.js.map +0 -1
- /package/lib/connector/{react-client-feature.test.d.ts → connector.test.d.ts} +0 -0
|
@@ -1,46 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const react_1 = require("@testing-library/react");
|
|
16
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
17
|
-
const react_2 = __importDefault(require("react"));
|
|
18
|
-
const render_routes_1 = require("./render-routes");
|
|
1
|
+
import { cleanup, getByText, render, screen, waitFor, } from '@testing-library/react';
|
|
2
|
+
import { Link, MemoryRouter } from 'react-router-dom';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { renderRoutes2 as renderRoutes } from './render-routes';
|
|
19
5
|
function TestInitialProps({ foo }) {
|
|
20
|
-
return
|
|
6
|
+
return React.createElement("h1", { "data-testid": "test" }, foo);
|
|
21
7
|
}
|
|
22
8
|
let mountCount = 0;
|
|
23
9
|
let renderCount = 0;
|
|
24
10
|
function TestInitialPropsWithoutUnmount({ foo }) {
|
|
25
|
-
|
|
11
|
+
React.useEffect(() => {
|
|
26
12
|
return () => {
|
|
27
13
|
mountCount++;
|
|
28
14
|
};
|
|
29
15
|
}, []);
|
|
30
|
-
return (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
return (React.createElement("div", null,
|
|
17
|
+
React.createElement("h1", { "data-testid": "test2" }, foo),
|
|
18
|
+
React.createElement("a", { href: "#bar" }, "link-bar"),
|
|
19
|
+
React.createElement(Link, { to: "/get-initial-props" }, "change-route"),
|
|
20
|
+
React.createElement("h2", { id: "bar" }, "h2-bar")));
|
|
35
21
|
}
|
|
36
22
|
function TestInitialPropsWithMount({ foo }) {
|
|
37
|
-
|
|
23
|
+
React.useEffect(() => {
|
|
38
24
|
mountCount++;
|
|
39
25
|
}, []);
|
|
40
26
|
renderCount++;
|
|
41
|
-
return
|
|
27
|
+
return React.createElement("h1", { "data-testid": "test" }, foo);
|
|
42
28
|
}
|
|
43
|
-
const getInitialProps = () =>
|
|
29
|
+
const getInitialProps = async () => {
|
|
44
30
|
return new Promise((resolve) => {
|
|
45
31
|
setTimeout(() => {
|
|
46
32
|
resolve({
|
|
@@ -48,16 +34,16 @@ const getInitialProps = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
48
34
|
});
|
|
49
35
|
}, 100);
|
|
50
36
|
});
|
|
51
|
-
}
|
|
37
|
+
};
|
|
52
38
|
TestInitialProps.getInitialProps = getInitialProps;
|
|
53
39
|
TestInitialPropsWithoutUnmount.getInitialProps = getInitialProps;
|
|
54
40
|
TestInitialPropsWithMount.getInitialProps = getInitialProps;
|
|
55
41
|
function TestInitialPropsParent({ foo, children, }) {
|
|
56
|
-
return (
|
|
57
|
-
|
|
42
|
+
return (React.createElement(React.Fragment, null,
|
|
43
|
+
React.createElement("h1", { "data-testid": "test-parent" }, foo),
|
|
58
44
|
children));
|
|
59
45
|
}
|
|
60
|
-
TestInitialPropsParent.getInitialProps = () =>
|
|
46
|
+
TestInitialPropsParent.getInitialProps = async () => {
|
|
61
47
|
return new Promise((resolve) => {
|
|
62
48
|
setTimeout(() => {
|
|
63
49
|
resolve({
|
|
@@ -65,22 +51,22 @@ TestInitialPropsParent.getInitialProps = () => __awaiter(void 0, void 0, void 0,
|
|
|
65
51
|
});
|
|
66
52
|
}, 100);
|
|
67
53
|
});
|
|
68
|
-
}
|
|
54
|
+
};
|
|
69
55
|
const routerConfig = {
|
|
70
56
|
ssrProps: {},
|
|
71
57
|
routes: [
|
|
72
58
|
{
|
|
73
59
|
path: '/layout',
|
|
74
|
-
component: (props) => (
|
|
75
|
-
|
|
76
|
-
|
|
60
|
+
component: (props) => (React.createElement(React.Fragment, null,
|
|
61
|
+
React.createElement("h1", { "data-testid": "layout" }, "Layout"),
|
|
62
|
+
React.createElement("h2", { "data-testid": "routes" }, props.routes.map((r) => r.path).join(',')),
|
|
77
63
|
props.children)),
|
|
78
64
|
routes: [
|
|
79
65
|
{
|
|
80
66
|
path: '/layout',
|
|
81
|
-
component: (props) => (
|
|
82
|
-
|
|
83
|
-
|
|
67
|
+
component: (props) => (React.createElement(React.Fragment, null,
|
|
68
|
+
React.createElement("h1", { "data-testid": "test" }, "Foo"),
|
|
69
|
+
React.createElement("h2", { "data-testid": "routes-embed" }, props.routes.map((r) => r.path).join(',')))),
|
|
84
70
|
},
|
|
85
71
|
],
|
|
86
72
|
},
|
|
@@ -89,34 +75,34 @@ const routerConfig = {
|
|
|
89
75
|
routes: [
|
|
90
76
|
{
|
|
91
77
|
path: '/layout-without-component/foo',
|
|
92
|
-
component: () =>
|
|
78
|
+
component: () => React.createElement("h1", { "data-testid": "test" }, "Foo"),
|
|
93
79
|
},
|
|
94
80
|
],
|
|
95
81
|
},
|
|
96
82
|
{
|
|
97
83
|
path: '/users/:id',
|
|
98
84
|
component: (props) => {
|
|
99
|
-
return
|
|
85
|
+
return React.createElement("h1", { "data-testid": "test" }, props.match.params.id);
|
|
100
86
|
},
|
|
101
87
|
},
|
|
102
|
-
{ path: '/bar', component: () =>
|
|
88
|
+
{ path: '/bar', component: () => React.createElement("h1", { "data-testid": "test" }, "Bar") },
|
|
103
89
|
{
|
|
104
90
|
path: '/bar-exact',
|
|
105
91
|
exact: true,
|
|
106
|
-
component: () =>
|
|
92
|
+
component: () => React.createElement("h1", { "data-testid": "test" }, "Bar Exact"),
|
|
107
93
|
},
|
|
108
94
|
{
|
|
109
95
|
path: '/bar-strict/',
|
|
110
96
|
strict: true,
|
|
111
|
-
component: () =>
|
|
97
|
+
component: () => React.createElement("h1", { "data-testid": "test" }, "Bar Strict"),
|
|
112
98
|
},
|
|
113
99
|
{
|
|
114
100
|
path: '/bar-sensitive',
|
|
115
101
|
sensitive: true,
|
|
116
|
-
component: () =>
|
|
102
|
+
component: () => React.createElement("h1", { "data-testid": "test" }, "Bar Sensitive"),
|
|
117
103
|
},
|
|
118
104
|
{ path: '/redirect', redirect: '/d' },
|
|
119
|
-
{ path: '/d', component: () =>
|
|
105
|
+
{ path: '/d', component: () => React.createElement("h1", { "data-testid": "test" }, "Redirect") },
|
|
120
106
|
{ path: '/get-initial-props', component: TestInitialProps },
|
|
121
107
|
{
|
|
122
108
|
path: '/get-initial-props-without-unmount',
|
|
@@ -139,124 +125,124 @@ const routerConfig = {
|
|
|
139
125
|
{
|
|
140
126
|
path: '/props-route',
|
|
141
127
|
foo: 'bar',
|
|
142
|
-
component: (props) => (
|
|
128
|
+
component: (props) => (React.createElement("h1", { "data-testid": "test" }, `${props.route.path} ${props.route.foo}`)),
|
|
143
129
|
},
|
|
144
130
|
{
|
|
145
131
|
path: '/pass-props',
|
|
146
132
|
component: (props) => {
|
|
147
|
-
return
|
|
148
|
-
return
|
|
133
|
+
return React.Children.map(props.children, (child) => {
|
|
134
|
+
return React.cloneElement(child, { foo: 'bar' });
|
|
149
135
|
});
|
|
150
136
|
},
|
|
151
137
|
routes: [
|
|
152
138
|
{
|
|
153
139
|
path: '/pass-props',
|
|
154
|
-
component: (props) =>
|
|
140
|
+
component: (props) => React.createElement("h1", { "data-testid": "test" }, props.foo),
|
|
155
141
|
},
|
|
156
142
|
],
|
|
157
143
|
},
|
|
158
144
|
{
|
|
159
145
|
path: '/wrappers',
|
|
160
|
-
component: () =>
|
|
146
|
+
component: () => React.createElement("h1", null, "foo"),
|
|
161
147
|
wrappers: [
|
|
162
|
-
(props) => (
|
|
163
|
-
|
|
148
|
+
(props) => (React.createElement(React.Fragment, null,
|
|
149
|
+
React.createElement("h1", null,
|
|
164
150
|
"wrapper 1 ",
|
|
165
151
|
props.route.path),
|
|
166
152
|
props.children)),
|
|
167
|
-
(props) => (
|
|
168
|
-
|
|
153
|
+
(props) => (React.createElement(React.Fragment, null,
|
|
154
|
+
React.createElement("h1", null, "wrapper 2"),
|
|
169
155
|
props.children)),
|
|
170
156
|
],
|
|
171
157
|
},
|
|
172
|
-
{ component: () =>
|
|
158
|
+
{ component: () => React.createElement("h1", { "data-testid": "test" }, "Fallback") },
|
|
173
159
|
],
|
|
174
160
|
// plugin: new Plugin(),
|
|
175
161
|
};
|
|
176
|
-
let routes = (
|
|
162
|
+
let routes = renderRoutes(routerConfig);
|
|
177
163
|
beforeEach(() => {
|
|
178
164
|
window.g_useSSR = true;
|
|
179
165
|
window.g_initialProps = null;
|
|
180
166
|
mountCount = 0;
|
|
181
167
|
renderCount = 0;
|
|
182
168
|
});
|
|
183
|
-
afterEach(() =>
|
|
169
|
+
afterEach(async () => {
|
|
184
170
|
delete window.g_useSSR;
|
|
185
171
|
delete window.g_initialProps;
|
|
186
|
-
|
|
187
|
-
})
|
|
188
|
-
test('/layout', () =>
|
|
189
|
-
const { container } =
|
|
172
|
+
await cleanup();
|
|
173
|
+
});
|
|
174
|
+
test('/layout', async () => {
|
|
175
|
+
const { container } = render(React.createElement(MemoryRouter, { initialEntries: ['/layout'] }, routes));
|
|
190
176
|
expect(container).toMatchSnapshot();
|
|
191
|
-
expect((
|
|
192
|
-
expect((
|
|
193
|
-
expect((
|
|
194
|
-
expect((
|
|
195
|
-
})
|
|
196
|
-
test('/layout-without-component', () =>
|
|
197
|
-
|
|
198
|
-
expect((
|
|
199
|
-
})
|
|
200
|
-
test('/bar', () =>
|
|
201
|
-
|
|
202
|
-
expect((
|
|
203
|
-
})
|
|
204
|
-
test('/BAR', () =>
|
|
205
|
-
|
|
206
|
-
expect((
|
|
207
|
-
})
|
|
208
|
-
test('/bar-exact/foo', () =>
|
|
209
|
-
|
|
210
|
-
expect((
|
|
211
|
-
})
|
|
212
|
-
test('/bar-strict', () =>
|
|
213
|
-
|
|
214
|
-
expect((
|
|
215
|
-
})
|
|
216
|
-
test('/BAR-sensitive', () =>
|
|
217
|
-
|
|
218
|
-
expect((
|
|
219
|
-
})
|
|
220
|
-
test('/users/123', () =>
|
|
221
|
-
|
|
222
|
-
expect((
|
|
223
|
-
})
|
|
224
|
-
test('/redirect', () =>
|
|
225
|
-
|
|
226
|
-
expect((
|
|
227
|
-
})
|
|
228
|
-
test('/props-route', () =>
|
|
229
|
-
|
|
230
|
-
expect((
|
|
231
|
-
})
|
|
232
|
-
test('/pass-props', () =>
|
|
233
|
-
const { container } =
|
|
234
|
-
|
|
235
|
-
expect((
|
|
236
|
-
})
|
|
237
|
-
test('/get-initial-props-with-mount', () =>
|
|
238
|
-
const newRoutes = (
|
|
177
|
+
expect((await screen.findByTestId('layout')).innerHTML).toEqual('Layout');
|
|
178
|
+
expect((await screen.findByTestId('routes')).innerHTML).toContain('/layout,/layout-without-component,/users/:id');
|
|
179
|
+
expect((await screen.findByTestId('routes-embed')).innerHTML).toContain('/layout,/layout-without-component,/users/:id');
|
|
180
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Foo');
|
|
181
|
+
});
|
|
182
|
+
test('/layout-without-component', async () => {
|
|
183
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/layout-without-component/foo'] }, routes));
|
|
184
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Foo');
|
|
185
|
+
});
|
|
186
|
+
test('/bar', async () => {
|
|
187
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/bar'] }, routes));
|
|
188
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Bar');
|
|
189
|
+
});
|
|
190
|
+
test('/BAR', async () => {
|
|
191
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/BAR'] }, routes));
|
|
192
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Bar');
|
|
193
|
+
});
|
|
194
|
+
test('/bar-exact/foo', async () => {
|
|
195
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/bar-exact/foo'] }, routes));
|
|
196
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Fallback');
|
|
197
|
+
});
|
|
198
|
+
test('/bar-strict', async () => {
|
|
199
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/bar-strict'] }, routes));
|
|
200
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Fallback');
|
|
201
|
+
});
|
|
202
|
+
test('/BAR-sensitive', async () => {
|
|
203
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/BAR-sensitive'] }, routes));
|
|
204
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Fallback');
|
|
205
|
+
});
|
|
206
|
+
test('/users/123', async () => {
|
|
207
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/users/123'] }, routes));
|
|
208
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('123');
|
|
209
|
+
});
|
|
210
|
+
test('/redirect', async () => {
|
|
211
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/redirect'] }, routes));
|
|
212
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Redirect');
|
|
213
|
+
});
|
|
214
|
+
test('/props-route', async () => {
|
|
215
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/props-route'] }, routes));
|
|
216
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('/props-route bar');
|
|
217
|
+
});
|
|
218
|
+
test('/pass-props', async () => {
|
|
219
|
+
const { container } = render(React.createElement(MemoryRouter, { initialEntries: ['/pass-props'] }, routes));
|
|
220
|
+
await waitFor(() => getByText(container, 'bar'));
|
|
221
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('bar');
|
|
222
|
+
});
|
|
223
|
+
test('/get-initial-props-with-mount', async () => {
|
|
224
|
+
const newRoutes = renderRoutes(routerConfig);
|
|
239
225
|
expect(mountCount).toEqual(0);
|
|
240
226
|
expect(renderCount).toEqual(0);
|
|
241
|
-
const { container } =
|
|
242
|
-
|
|
227
|
+
const { container } = render(React.createElement(MemoryRouter, { initialEntries: ['/get-initial-props-with-mount'] }, newRoutes));
|
|
228
|
+
await waitFor(() => getByText(container, 'bar'));
|
|
243
229
|
expect(mountCount).toEqual(1);
|
|
244
230
|
expect(renderCount).toEqual(2);
|
|
245
|
-
})
|
|
246
|
-
test('/get-initial-props-embed', () =>
|
|
247
|
-
const newRoutes = (
|
|
248
|
-
const { container } =
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
expect((
|
|
252
|
-
expect((
|
|
253
|
-
})
|
|
231
|
+
});
|
|
232
|
+
test('/get-initial-props-embed', async () => {
|
|
233
|
+
const newRoutes = renderRoutes(routerConfig);
|
|
234
|
+
const { container } = render(React.createElement(MemoryRouter, { initialEntries: ['/get-initial-props-embed'] }, newRoutes));
|
|
235
|
+
await waitFor(() => getByText(container, 'bar'));
|
|
236
|
+
await waitFor(() => getByText(container, 'parent'));
|
|
237
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('bar');
|
|
238
|
+
expect((await screen.findByTestId('test-parent')).innerHTML).toEqual('parent');
|
|
239
|
+
});
|
|
254
240
|
test('/wrappers', () => {
|
|
255
|
-
const { container } =
|
|
241
|
+
const { container } = render(React.createElement(MemoryRouter, { initialEntries: ['/wrappers'] }, routes));
|
|
256
242
|
expect(container.innerHTML).toEqual('<h1>wrapper 1 /wrappers</h1><h1>wrapper 2</h1><h1>foo</h1>');
|
|
257
243
|
});
|
|
258
|
-
test('/fallback-20140924', () =>
|
|
259
|
-
|
|
260
|
-
expect((
|
|
261
|
-
})
|
|
244
|
+
test('/fallback-20140924', async () => {
|
|
245
|
+
render(React.createElement(MemoryRouter, { initialEntries: ['/fallback-20140924'] }, routes));
|
|
246
|
+
expect((await screen.findByTestId('test')).innerHTML).toEqual('Fallback');
|
|
247
|
+
});
|
|
262
248
|
//# sourceMappingURL=render-routes.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-routes.test.js","sourceRoot":"","sources":["../../src/route/render-routes.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-routes.test.js","sourceRoot":"","sources":["../../src/route/render-routes.test.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,SAAS,EACT,MAAM,EACN,MAAM,EACN,OAAO,GACR,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhE,SAAS,gBAAgB,CAAC,EAAE,GAAG,EAAmB;IAChD,OAAO,2CAAgB,MAAM,IAAE,GAAG,CAAM,CAAC;AAC3C,CAAC;AAED,IAAI,UAAU,GAAG,CAAC,CAAC;AACnB,IAAI,WAAW,GAAG,CAAC,CAAC;AACpB,SAAS,8BAA8B,CAAC,EAAE,GAAG,EAAmB;IAC9D,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,OAAO,GAAG,EAAE;YACV,UAAU,EAAE,CAAC;QACf,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,CACL;QACE,2CAAgB,OAAO,IAAE,GAAG,CAAM;QAClC,2BAAG,IAAI,EAAC,MAAM,eAAa;QAC3B,oBAAC,IAAI,IAAC,EAAE,EAAC,oBAAoB,mBAAoB;QACjD,4BAAI,EAAE,EAAC,KAAK,aAAY,CACpB,CACP,CAAC;AACJ,CAAC;AAED,SAAS,yBAAyB,CAAC,EAAE,GAAG,EAAmB;IACzD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,UAAU,EAAE,CAAC;IACf,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,WAAW,EAAE,CAAC;IACd,OAAO,2CAAgB,MAAM,IAAE,GAAG,CAAM,CAAC;AAC3C,CAAC;AAED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EAAE,CAAC,oBAAoB,CAAC,IACjD,MAAM,CACM,CAChB,CAAC;IACF,MAAM,CAAC,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAC5E,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
exports.navigationRef = (0, react_1.createRef)();
|
|
6
|
-
function navigate(name, params) {
|
|
1
|
+
import { createRef } from 'react';
|
|
2
|
+
export const navigationRef = createRef();
|
|
3
|
+
export function navigate(name, params) {
|
|
7
4
|
}
|
|
8
|
-
exports.navigate = navigate;
|
|
9
5
|
//# sourceMappingURL=root-navigation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"root-navigation.js","sourceRoot":"","sources":["../../src/route/root-navigation.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"root-navigation.js","sourceRoot":"","sources":["../../src/route/root-navigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,CAAC,MAAM,aAAa,GAAQ,SAAS,EAAE,CAAA;AAE7C,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,MAAa;AAEpD,CAAC"}
|
|
@@ -1,63 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const react_1 = __importStar(require("react"));
|
|
27
|
-
const higher_order_component_util_1 = require("../higher-order-component-util");
|
|
1
|
+
import React, { Component } from 'react';
|
|
2
|
+
import { createHigherOrderComponent } from '../higher-order-component-util';
|
|
28
3
|
describe('createHigherOrderComponent', () => {
|
|
29
4
|
it('should use default name for anonymous function', () => {
|
|
30
|
-
const TestComponent =
|
|
31
|
-
expect(TestComponent.displayName).toBe('WithTest(Component
|
|
5
|
+
const TestComponent = createHigherOrderComponent((OriginalComponent) => OriginalComponent, 'withTest')(() => React.createElement("div", null));
|
|
6
|
+
expect(TestComponent.displayName).toBe('WithTest(Component');
|
|
32
7
|
});
|
|
33
8
|
it('should use camel case starting with upper for wrapper prefix ', () => {
|
|
34
|
-
const TestComponent =
|
|
9
|
+
const TestComponent = createHigherOrderComponent((OriginalComponent) => OriginalComponent, 'with-one-two_threeFOUR')(() => React.createElement("div", null));
|
|
35
10
|
expect(TestComponent.displayName).toBe('WithOneTwoThreeFour(Component)');
|
|
36
11
|
});
|
|
37
12
|
it('should use function name', () => {
|
|
38
13
|
function SomeComponent() {
|
|
39
|
-
return
|
|
14
|
+
return React.createElement("div", null);
|
|
40
15
|
}
|
|
41
|
-
const TestComponent =
|
|
16
|
+
const TestComponent = createHigherOrderComponent((OriginalComponent) => OriginalComponent, 'withTest')(SomeComponent);
|
|
42
17
|
expect(TestComponent.displayName).toBe('WithTest(SomeComponent)');
|
|
43
18
|
});
|
|
44
19
|
it('should use component class name', () => {
|
|
45
|
-
class SomeAnotherComponent extends
|
|
20
|
+
class SomeAnotherComponent extends Component {
|
|
46
21
|
render() {
|
|
47
|
-
return
|
|
22
|
+
return React.createElement("div", null);
|
|
48
23
|
}
|
|
49
24
|
}
|
|
50
|
-
const TestComponent =
|
|
25
|
+
const TestComponent = createHigherOrderComponent((OriginalComponent) => OriginalComponent, 'withTest')(SomeAnotherComponent);
|
|
51
26
|
expect(TestComponent.displayName).toBe('WithTest(SomeAnotherComponent)');
|
|
52
27
|
});
|
|
53
28
|
it('should use displayName property', () => {
|
|
54
|
-
class SomeYetAnotherComponent extends
|
|
29
|
+
class SomeYetAnotherComponent extends Component {
|
|
55
30
|
render() {
|
|
56
|
-
return
|
|
31
|
+
return React.createElement("div", null);
|
|
57
32
|
}
|
|
58
33
|
}
|
|
59
34
|
SomeYetAnotherComponent.displayName = 'CustomDisplayName';
|
|
60
|
-
const TestComponent =
|
|
35
|
+
const TestComponent = createHigherOrderComponent((OriginalComponent) => OriginalComponent, 'withTest')(SomeYetAnotherComponent);
|
|
61
36
|
expect(TestComponent.displayName).toBe('WithTest(CustomDisplayName)');
|
|
62
37
|
});
|
|
63
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"higher-order-component-util.test.js","sourceRoot":"","sources":["../../../src/route-based-plugin-area/__tests__/higher-order-component-util.test.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"higher-order-component-util.test.js","sourceRoot":"","sources":["../../../src/route-based-plugin-area/__tests__/higher-order-component-util.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGzC,OAAO,EAAE,0BAA0B,EAA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,CAAE,CAAC;QAE1B,MAAM,CAAE,aAAa,CAAC,WAAW,CAAE,CAAC,IAAI,CACvC,gCAAgC,CAChC,CAAC;IACH,CAAC,CAAE,CAAC;IAEJ,EAAE,CAAE,iCAAiC,EAAE,GAAG,EAAE;QAC3C,MAAM,uBAAwB,SAAQ,SAAS;YAC9C,MAAM;gBACL,OAAO,gCAAO,CAAC;YAChB,CAAC;SACD;QACA,uBAA+B,CAAC,WAAW,GAAG,mBAAmB,CAAC;QACnE,MAAM,aAAa,GAAG,0BAA0B,CAC/C,CAAE,iBAAiB,EAAG,EAAE,CAAC,iBAAiB,EAC1C,UAAU,CACV,CAAE,uBAAuB,CAAE,CAAC;QAE7B,MAAM,CAAE,aAAa,CAAC,WAAW,CAAE,CAAC,IAAI,CACvC,6BAA6B,CAC7B,CAAC;IACH,CAAC,CAAE,CAAC;AACL,CAAC,CAAC,CAAA"}
|
|
@@ -1,51 +1,49 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const plugin_api_1 = require("../plugin-api");
|
|
1
|
+
import { registerRouteBasePlugin, unregisterRouteBasePlugin, getRouteBasePlugin, getRouteBasePlugins } from '../plugin-api';
|
|
4
2
|
describe('registerPlugin', () => {
|
|
5
3
|
afterEach(() => {
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
getRouteBasePlugins().forEach((plugin) => {
|
|
5
|
+
unregisterRouteBasePlugin(plugin.name);
|
|
8
6
|
});
|
|
9
7
|
});
|
|
10
8
|
it('successfully registers a plugin', () => {
|
|
11
9
|
const name = 'plugin';
|
|
12
10
|
const icon = 'smiley';
|
|
13
11
|
const Component = () => 'plugin content';
|
|
14
|
-
|
|
12
|
+
registerRouteBasePlugin(name, {
|
|
15
13
|
render: Component,
|
|
16
14
|
icon,
|
|
17
15
|
});
|
|
18
|
-
expect(
|
|
16
|
+
expect(getRouteBasePlugin(name)).toEqual({
|
|
19
17
|
name,
|
|
20
18
|
render: Component,
|
|
21
19
|
icon,
|
|
22
20
|
});
|
|
23
21
|
});
|
|
24
22
|
it('fails to register a plugin without a settings object', () => {
|
|
25
|
-
|
|
23
|
+
registerRouteBasePlugin();
|
|
26
24
|
expect(console).toThrowError('No settings object provided!');
|
|
27
25
|
});
|
|
28
26
|
it('fails to register a plugin with special character in the name', () => {
|
|
29
|
-
|
|
27
|
+
registerRouteBasePlugin('plugin/with/special/characters', {
|
|
30
28
|
render: () => { },
|
|
31
29
|
});
|
|
32
30
|
expect(console).toThrowError('Plugin names must include only lowercase alphanumeric characters or dashes, and start with a letter. Example: "my-plugin".');
|
|
33
31
|
});
|
|
34
32
|
it('fails to register a plugin with a non-string name', () => {
|
|
35
|
-
|
|
33
|
+
registerRouteBasePlugin({}, {
|
|
36
34
|
render: () => { },
|
|
37
35
|
});
|
|
38
36
|
expect(console).toThrowError('Plugin names must be strings.');
|
|
39
37
|
});
|
|
40
38
|
it('fails to register a plugin without a render function', () => {
|
|
41
|
-
|
|
39
|
+
registerRouteBasePlugin('another-plugin', {});
|
|
42
40
|
expect(console).toThrowError('The "render" property must be specified and must be a valid function.');
|
|
43
41
|
});
|
|
44
42
|
it('fails to register a plugin that was already been registered', () => {
|
|
45
|
-
|
|
43
|
+
registerRouteBasePlugin('plugin', {
|
|
46
44
|
render: () => 'plugin content',
|
|
47
45
|
});
|
|
48
|
-
|
|
46
|
+
registerRouteBasePlugin('plugin', {
|
|
49
47
|
render: () => 'plugin content',
|
|
50
48
|
});
|
|
51
49
|
expect(console).toThrowError('Plugin "plugin" is already registered.');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-api.test.js","sourceRoot":"","sources":["../../../src/route-based-plugin-area/__tests__/plugin-api.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin-api.test.js","sourceRoot":"","sources":["../../../src/route-based-plugin-area/__tests__/plugin-api.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAE,yBAAyB,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