Skip to content

Commit 157c5a0

Browse files
authored
Remove Redux from React Vanilla tests
Refactors Redux based React Vanilla tests to use the standalone component. Also removes unnecessary Redux dependencies in Angular packages.
1 parent a4a440a commit 157c5a0

25 files changed

+1895
-3011
lines changed

package-lock.json

Lines changed: 250 additions & 241 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/angular-material/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
"@jsonforms/core": "^3.0.0-alpha.1",
9191
"@jsonforms/examples": "^3.0.0-alpha.1",
9292
"@types/node": "^10.10.0",
93-
"@types/redux-logger": "3.0.6",
9493
"angular2-template-loader": "^0.6.2",
9594
"copy-webpack-plugin": "^5.0.5",
9695
"core-js": "^2.5.3",

packages/angular-test/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
"main": "./lib/index.js",
66
"dependencies": {
77
"@jsonforms/angular": "^3.0.0-alpha.1",
8-
"@jsonforms/core": "^3.0.0-alpha.1",
9-
"redux": "^4.0.4"
8+
"@jsonforms/core": "^3.0.0-alpha.1"
109
},
1110
"devDependencies": {
1211
"jasmine": "^3.2.0",

packages/vanilla/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@
5353
"jsdom-global": "^3.0.2",
5454
"nyc": "^14.1.1",
5555
"react-dom": "^16.12.0",
56-
"react-redux": "^7.1.3",
5756
"rimraf": "^3.0.2",
5857
"source-map-loader": "^0.2.4",
5958
"source-map-support": "0.5.16",

packages/vanilla/src/styles/styles.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/*
22
The MIT License
3-
3+
44
Copyright (c) 2017-2021 EclipseSource Munich
55
https://github.com/eclipsesource/jsonforms
6-
6+
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
99
in the Software without restriction, including without limitation the rights
1010
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1111
copies of the Software, and to permit persons to whom the Software is
1212
furnished to do so, subject to the following conditions:
13-
13+
1414
The above copyright notice and this permission notice shall be included in
1515
all copies or substantial portions of the Software.
16-
16+
1717
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1818
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1919
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -77,6 +77,10 @@ export const vanillaStyles: StyleDef[] = [
7777
name: 'category.group',
7878
classNames: ['category-group']
7979
},
80+
{
81+
name: 'category.subcategories',
82+
classNames: ['category-subcategories']
83+
},
8084
{
8185
name: 'array.layout',
8286
classNames: ['array-layout']

packages/vanilla/test/renderers/ArrayControl.test.tsx

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
/*
22
The MIT License
3-
3+
44
Copyright (c) 2017-2019 EclipseSource Munich
55
https://github.com/eclipsesource/jsonforms
6-
6+
77
Permission is hereby granted, free of charge, to any person obtaining a copy
88
of this software and associated documentation files (the "Software"), to deal
99
in the Software without restriction, including without limitation the rights
1010
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1111
copies of the Software, and to permit persons to whom the Software is
1212
furnished to do so, subject to the following conditions:
13-
13+
1414
The above copyright notice and this permission notice shall be included in
1515
all copies or substantial portions of the Software.
16-
16+
1717
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1818
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1919
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@@ -22,12 +22,11 @@
2222
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2323
THE SOFTWARE.
2424
*/
25-
import { JsonFormsReduxContext } from '@jsonforms/react/lib/redux';
2625
import * as React from 'react';
27-
import { Provider } from 'react-redux';
26+
import { JsonFormsStateProvider } from '@jsonforms/react';
2827
import ArrayControl from '../../src/complex/array/ArrayControlRenderer';
2928
import { vanillaRenderers } from '../../src/index';
30-
import { initJsonFormsVanillaStore } from '../vanillaStore';
29+
import { initCore } from '../util';
3130
import IntegerCell, { integerCellTester } from '../../src/cells/IntegerCell';
3231

3332
import Adapter from 'enzyme-adapter-react-16';
@@ -62,26 +61,15 @@ const fixture = {
6261

6362
describe('Array control renderer', () => {
6463
test('render two children', () => {
65-
const store = initJsonFormsVanillaStore({
66-
data: fixture.data,
67-
schema: fixture.schema,
68-
uischema: fixture.uischema,
69-
renderers: vanillaRenderers,
70-
cells: [
71-
{
72-
tester: integerCellTester, cell: IntegerCell
73-
}
74-
]
75-
});
64+
const core = initCore(fixture.schema, fixture.uischema, fixture.data);
65+
const cells = [{ tester: integerCellTester, cell: IntegerCell }];
7666
const wrapper = mount(
77-
<Provider store={store}>
78-
<JsonFormsReduxContext>
79-
<ArrayControl
80-
schema={fixture.schema}
81-
uischema={fixture.uischema}
82-
/>
83-
</JsonFormsReduxContext>
84-
</Provider>
67+
<JsonFormsStateProvider initState={{ renderers: vanillaRenderers, cells, core }}>
68+
<ArrayControl
69+
schema={fixture.schema}
70+
uischema={fixture.uischema}
71+
/>
72+
</JsonFormsStateProvider>
8573
);
8674

8775
const controls = wrapper.find('.control');

0 commit comments

Comments
 (0)