@jsonforms/material-renderers 3.0.0-alpha.1 → 3.0.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/docs/assets/js/search.json +1 -1
- package/docs/classes/combinatorproperties.html +2 -5
- package/docs/classes/materialanyofstringorenumcontrol.html +6 -9
- package/docs/classes/materialtablecontrol.html +4 -7
- package/docs/globals.html +803 -213
- package/docs/index.html +63 -42
- package/docs/interfaces/ajvprops.html +1 -4
- package/docs/interfaces/arraylayouttoolbarprops.html +0 -3
- package/docs/interfaces/categorizationstate.html +0 -3
- package/docs/interfaces/categorizationstepperstate.html +0 -3
- package/docs/interfaces/combinatorpropertiesprops.html +0 -3
- package/docs/interfaces/deletedialogprops.html +0 -3
- package/docs/interfaces/dispatchpropsofexpandpanel.html +3 -6
- package/docs/interfaces/emptytableprops.html +0 -3
- package/docs/interfaces/expandpanelprops.html +19 -22
- package/docs/interfaces/jsonformstheme.html +0 -3
- package/docs/interfaces/materialcategorizationlayoutrendererprops.html +1 -4
- package/docs/interfaces/materialcategorizationstepperlayoutrendererprops.html +1 -4
- package/docs/interfaces/materiallayoutrendererprops.html +0 -3
- package/docs/interfaces/materialtabletoolbarprops.html +0 -3
- package/docs/interfaces/muitextinputprops.html +2 -5
- package/docs/interfaces/nonemptycellcomponentprops.html +266 -0
- package/docs/interfaces/nonemptycellprops.html +0 -3
- package/docs/interfaces/nonemptyrowprops.html +80 -27
- package/docs/interfaces/ownoneofprops.html +0 -3
- package/docs/interfaces/ownpropsofexpandpanel.html +14 -17
- package/docs/interfaces/ownpropsofnonemptycell.html +0 -3
- package/docs/interfaces/statepropsofexpandpanel.html +16 -19
- package/docs/interfaces/tableheadercellprops.html +0 -3
- package/docs/interfaces/tablerowsprop.html +9 -12
- package/docs/interfaces/validationprops.html +0 -3
- package/docs/interfaces/withdeletedialogsupport.html +0 -3
- package/docs/interfaces/withinput.html +1 -4
- package/docs/interfaces/withoptionlabel.html +3 -6
- package/lib/additional/ListWithDetailMasterItem.d.ts +1 -1
- package/lib/additional/ListWithDetailMasterItem.js.map +1 -1
- package/lib/additional/MaterialLabelRenderer.d.ts +1 -1
- package/lib/additional/MaterialLabelRenderer.js +3 -1
- package/lib/additional/MaterialLabelRenderer.js.map +1 -1
- package/lib/additional/MaterialListWithDetailRenderer.d.ts +1 -1
- package/lib/additional/MaterialListWithDetailRenderer.js +3 -1
- package/lib/additional/MaterialListWithDetailRenderer.js.map +1 -1
- package/lib/additional/index.js +3 -2
- package/lib/additional/index.js.map +1 -1
- package/lib/cells/CustomizableCells.js +10 -9
- package/lib/cells/CustomizableCells.js.map +1 -1
- package/lib/cells/MaterialBooleanCell.d.ts +1 -1
- package/lib/cells/MaterialBooleanCell.js +3 -1
- package/lib/cells/MaterialBooleanCell.js.map +1 -1
- package/lib/cells/MaterialBooleanToggleCell.d.ts +1 -1
- package/lib/cells/MaterialBooleanToggleCell.js +3 -1
- package/lib/cells/MaterialBooleanToggleCell.js.map +1 -1
- package/lib/cells/MaterialDateCell.d.ts +1 -1
- package/lib/cells/MaterialDateCell.js +3 -1
- package/lib/cells/MaterialDateCell.js.map +1 -1
- package/lib/cells/MaterialEnumCell.d.ts +1 -1
- package/lib/cells/MaterialEnumCell.js +3 -1
- package/lib/cells/MaterialEnumCell.js.map +1 -1
- package/lib/cells/MaterialIntegerCell.d.ts +1 -1
- package/lib/cells/MaterialIntegerCell.js +3 -1
- package/lib/cells/MaterialIntegerCell.js.map +1 -1
- package/lib/cells/MaterialNumberCell.d.ts +1 -1
- package/lib/cells/MaterialNumberCell.js +3 -1
- package/lib/cells/MaterialNumberCell.js.map +1 -1
- package/lib/cells/MaterialNumberFormatCell.d.ts +1 -1
- package/lib/cells/MaterialNumberFormatCell.js +3 -1
- package/lib/cells/MaterialNumberFormatCell.js.map +1 -1
- package/lib/cells/MaterialOneOfEnumCell.d.ts +1 -1
- package/lib/cells/MaterialOneOfEnumCell.js +3 -1
- package/lib/cells/MaterialOneOfEnumCell.js.map +1 -1
- package/lib/cells/MaterialTextCell.d.ts +1 -1
- package/lib/cells/MaterialTextCell.js +3 -1
- package/lib/cells/MaterialTextCell.js.map +1 -1
- package/lib/cells/MaterialTimeCell.d.ts +1 -1
- package/lib/cells/MaterialTimeCell.js +3 -1
- package/lib/cells/MaterialTimeCell.js.map +1 -1
- package/lib/cells/index.js +11 -10
- package/lib/cells/index.js.map +1 -1
- package/lib/complex/CombinatorProperties.js +3 -1
- package/lib/complex/CombinatorProperties.js.map +1 -1
- package/lib/complex/DeleteDialog.js +1 -0
- package/lib/complex/DeleteDialog.js.map +1 -1
- package/lib/complex/MaterialAllOfRenderer.d.ts +3 -2
- package/lib/complex/MaterialAllOfRenderer.js +3 -1
- package/lib/complex/MaterialAllOfRenderer.js.map +1 -1
- package/lib/complex/MaterialAnyOfRenderer.d.ts +3 -2
- package/lib/complex/MaterialAnyOfRenderer.js +3 -1
- package/lib/complex/MaterialAnyOfRenderer.js.map +1 -1
- package/lib/complex/MaterialArrayControlRenderer.d.ts +1 -1
- package/lib/complex/MaterialArrayControlRenderer.js +3 -1
- package/lib/complex/MaterialArrayControlRenderer.js.map +1 -1
- package/lib/complex/MaterialEnumArrayRenderer.d.ts +2 -2
- package/lib/complex/MaterialEnumArrayRenderer.js +6 -3
- package/lib/complex/MaterialEnumArrayRenderer.js.map +1 -1
- package/lib/complex/MaterialObjectRenderer.d.ts +3 -2
- package/lib/complex/MaterialObjectRenderer.js +3 -1
- package/lib/complex/MaterialObjectRenderer.js.map +1 -1
- package/lib/complex/MaterialOneOfRenderer.d.ts +2 -1
- package/lib/complex/MaterialOneOfRenderer.js +5 -4
- package/lib/complex/MaterialOneOfRenderer.js.map +1 -1
- package/lib/complex/MaterialTableControl.d.ts +16 -1
- package/lib/complex/MaterialTableControl.js +16 -8
- package/lib/complex/MaterialTableControl.js.map +1 -1
- package/lib/complex/NoBorderTableCell.js.map +1 -1
- package/lib/complex/TableToolbar.js.map +1 -1
- package/lib/complex/ValidationIcon.d.ts +5 -3
- package/lib/complex/ValidationIcon.js.map +1 -1
- package/lib/complex/index.js +6 -5
- package/lib/complex/index.js.map +1 -1
- package/lib/controls/MaterialAnyOfStringOrEnumControl.d.ts +1 -1
- package/lib/controls/MaterialAnyOfStringOrEnumControl.js +17 -12
- package/lib/controls/MaterialAnyOfStringOrEnumControl.js.map +1 -1
- package/lib/controls/MaterialBooleanControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanControl.js +3 -1
- package/lib/controls/MaterialBooleanControl.js.map +1 -1
- package/lib/controls/MaterialBooleanToggleControl.d.ts +1 -1
- package/lib/controls/MaterialBooleanToggleControl.js +3 -1
- package/lib/controls/MaterialBooleanToggleControl.js.map +1 -1
- package/lib/controls/MaterialDateControl.d.ts +3 -6
- package/lib/controls/MaterialDateControl.js +25 -29
- package/lib/controls/MaterialDateControl.js.map +1 -1
- package/lib/controls/MaterialDateTimeControl.d.ts +3 -6
- package/lib/controls/MaterialDateTimeControl.js +25 -29
- package/lib/controls/MaterialDateTimeControl.js.map +1 -1
- package/lib/controls/MaterialEnumControl.d.ts +1 -1
- package/lib/controls/MaterialEnumControl.js +3 -1
- package/lib/controls/MaterialEnumControl.js.map +1 -1
- package/lib/controls/MaterialInputControl.d.ts +2 -5
- package/lib/controls/MaterialInputControl.js +23 -28
- package/lib/controls/MaterialInputControl.js.map +1 -1
- package/lib/controls/MaterialIntegerControl.d.ts +1 -1
- package/lib/controls/MaterialIntegerControl.js +3 -1
- package/lib/controls/MaterialIntegerControl.js.map +1 -1
- package/lib/controls/MaterialNativeControl.d.ts +3 -6
- package/lib/controls/MaterialNativeControl.js +15 -19
- package/lib/controls/MaterialNativeControl.js.map +1 -1
- package/lib/controls/MaterialNumberControl.d.ts +1 -1
- package/lib/controls/MaterialNumberControl.js +3 -1
- package/lib/controls/MaterialNumberControl.js.map +1 -1
- package/lib/controls/MaterialOneOfEnumControl.d.ts +1 -1
- package/lib/controls/MaterialOneOfEnumControl.js +3 -1
- package/lib/controls/MaterialOneOfEnumControl.js.map +1 -1
- package/lib/controls/MaterialOneOfRadioGroupControl.d.ts +1 -1
- package/lib/controls/MaterialOneOfRadioGroupControl.js +3 -1
- package/lib/controls/MaterialOneOfRadioGroupControl.js.map +1 -1
- package/lib/controls/MaterialRadioGroup.d.ts +2 -5
- package/lib/controls/MaterialRadioGroup.js +15 -20
- package/lib/controls/MaterialRadioGroup.js.map +1 -1
- package/lib/controls/MaterialRadioGroupControl.d.ts +1 -1
- package/lib/controls/MaterialRadioGroupControl.js +3 -1
- package/lib/controls/MaterialRadioGroupControl.js.map +1 -1
- package/lib/controls/MaterialSliderControl.d.ts +3 -6
- package/lib/controls/MaterialSliderControl.js +35 -39
- package/lib/controls/MaterialSliderControl.js.map +1 -1
- package/lib/controls/MaterialTextControl.d.ts +1 -1
- package/lib/controls/MaterialTextControl.js +3 -1
- package/lib/controls/MaterialTextControl.js.map +1 -1
- package/lib/controls/MaterialTimeControl.d.ts +3 -6
- package/lib/controls/MaterialTimeControl.js +25 -29
- package/lib/controls/MaterialTimeControl.js.map +1 -1
- package/lib/controls/index.d.ts +10 -10
- package/lib/controls/index.js +16 -15
- package/lib/controls/index.js.map +1 -1
- package/lib/extended/MaterialAutocompleteEnumControl.d.ts +1 -1
- package/lib/extended/MaterialAutocompleteEnumControl.js +3 -1
- package/lib/extended/MaterialAutocompleteEnumControl.js.map +1 -1
- package/lib/extended/MaterialAutocompleteOneOfEnumControl.d.ts +1 -1
- package/lib/extended/MaterialAutocompleteOneOfEnumControl.js +3 -1
- package/lib/extended/MaterialAutocompleteOneOfEnumControl.js.map +1 -1
- package/lib/extended/MuiAutocomplete.d.ts +2 -2
- package/lib/extended/MuiAutocomplete.js +4 -3
- package/lib/extended/MuiAutocomplete.js.map +1 -1
- package/lib/extended/index.d.ts +2 -2
- package/lib/extended/index.js +2 -1
- package/lib/extended/index.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/jsonforms-material.js +8 -8
- package/lib/jsonforms-material.js.map +1 -1
- package/lib/layouts/ArrayToolbar.js +1 -0
- package/lib/layouts/ArrayToolbar.js.map +1 -1
- package/lib/layouts/ExpandPanelRenderer.d.ts +3 -3
- package/lib/layouts/ExpandPanelRenderer.js +16 -13
- package/lib/layouts/ExpandPanelRenderer.js.map +1 -1
- package/lib/layouts/MaterialArrayLayout.d.ts +1 -11
- package/lib/layouts/MaterialArrayLayout.js +19 -31
- package/lib/layouts/MaterialArrayLayout.js.map +1 -1
- package/lib/layouts/MaterialArrayLayoutRenderer.d.ts +1 -1
- package/lib/layouts/MaterialArrayLayoutRenderer.js +3 -1
- package/lib/layouts/MaterialArrayLayoutRenderer.js.map +1 -1
- package/lib/layouts/MaterialCategorizationLayout.d.ts +2 -10
- package/lib/layouts/MaterialCategorizationLayout.js +31 -47
- package/lib/layouts/MaterialCategorizationLayout.js.map +1 -1
- package/lib/layouts/MaterialCategorizationStepperLayout.d.ts +2 -9
- package/lib/layouts/MaterialCategorizationStepperLayout.js +42 -53
- package/lib/layouts/MaterialCategorizationStepperLayout.js.map +1 -1
- package/lib/layouts/MaterialGroupLayout.d.ts +1 -1
- package/lib/layouts/MaterialGroupLayout.js +3 -1
- package/lib/layouts/MaterialGroupLayout.js.map +1 -1
- package/lib/layouts/MaterialHorizontalLayout.d.ts +1 -1
- package/lib/layouts/MaterialHorizontalLayout.js +3 -1
- package/lib/layouts/MaterialHorizontalLayout.js.map +1 -1
- package/lib/layouts/MaterialVerticalLayout.d.ts +1 -1
- package/lib/layouts/MaterialVerticalLayout.js +3 -1
- package/lib/layouts/MaterialVerticalLayout.js.map +1 -1
- package/lib/layouts/index.js +6 -5
- package/lib/layouts/index.js.map +1 -1
- package/lib/mui-controls/MuiCheckbox.js +2 -2
- package/lib/mui-controls/MuiCheckbox.js.map +1 -1
- package/lib/mui-controls/MuiInputInteger.js +9 -6
- package/lib/mui-controls/MuiInputInteger.js.map +1 -1
- package/lib/mui-controls/MuiInputNumber.js +9 -6
- package/lib/mui-controls/MuiInputNumber.js.map +1 -1
- package/lib/mui-controls/MuiInputNumberFormat.js +7 -8
- package/lib/mui-controls/MuiInputNumberFormat.js.map +1 -1
- package/lib/mui-controls/MuiInputText.js +11 -7
- package/lib/mui-controls/MuiInputText.js.map +1 -1
- package/lib/mui-controls/MuiInputTime.js +5 -3
- package/lib/mui-controls/MuiInputTime.js.map +1 -1
- package/lib/mui-controls/MuiSelect.js +3 -3
- package/lib/mui-controls/MuiSelect.js.map +1 -1
- package/lib/mui-controls/MuiToggle.js +2 -2
- package/lib/mui-controls/MuiToggle.js.map +1 -1
- package/lib/util/datejs.d.ts +2 -2
- package/lib/util/datejs.js +5 -2
- package/lib/util/datejs.js.map +1 -1
- package/lib/util/debounce.d.ts +1 -0
- package/lib/util/debounce.js +48 -0
- package/lib/util/debounce.js.map +1 -0
- package/lib/util/focus.d.ts +1 -0
- package/lib/util/focus.js +36 -0
- package/lib/util/focus.js.map +1 -0
- package/lib/util/index.d.ts +2 -0
- package/lib/util/index.js +3 -0
- package/lib/util/index.js.map +1 -1
- package/lib/util/layout.d.ts +2 -1
- package/lib/util/layout.js +8 -4
- package/lib/util/layout.js.map +1 -1
- package/package.json +5 -5
- package/src/cells/MaterialTimeCell.tsx +1 -0
- package/src/complex/MaterialAllOfRenderer.tsx +2 -1
- package/src/complex/MaterialAnyOfRenderer.tsx +2 -1
- package/src/complex/MaterialEnumArrayRenderer.tsx +1 -0
- package/src/complex/MaterialObjectRenderer.tsx +2 -1
- package/src/complex/MaterialOneOfRenderer.tsx +6 -6
- package/src/complex/MaterialTableControl.tsx +36 -24
- package/src/controls/MaterialAnyOfStringOrEnumControl.tsx +16 -12
- package/src/controls/MaterialDateControl.tsx +80 -85
- package/src/controls/MaterialDateTimeControl.tsx +83 -86
- package/src/controls/MaterialInputControl.tsx +62 -69
- package/src/controls/MaterialNativeControl.tsx +54 -57
- package/src/controls/MaterialRadioGroup.tsx +67 -69
- package/src/controls/MaterialSliderControl.tsx +92 -87
- package/src/controls/MaterialTimeControl.tsx +77 -80
- package/src/extended/MuiAutocomplete.tsx +2 -3
- package/src/layouts/ExpandPanelRenderer.tsx +11 -17
- package/src/layouts/MaterialArrayLayout.tsx +73 -82
- package/src/layouts/MaterialCategorizationLayout.tsx +49 -65
- package/src/layouts/MaterialCategorizationStepperLayout.tsx +79 -87
- package/src/mui-controls/MuiCheckbox.tsx +1 -2
- package/src/mui-controls/MuiInputInteger.tsx +12 -9
- package/src/mui-controls/MuiInputNumber.tsx +9 -6
- package/src/mui-controls/MuiInputNumberFormat.tsx +8 -11
- package/src/mui-controls/MuiInputText.tsx +17 -15
- package/src/mui-controls/MuiInputTime.tsx +6 -4
- package/src/mui-controls/MuiSelect.tsx +2 -3
- package/src/mui-controls/MuiToggle.tsx +1 -2
- package/src/util/debounce.ts +43 -0
- package/src/util/focus.ts +32 -0
- package/src/util/index.ts +2 -0
- package/src/util/layout.tsx +5 -6
- package/test/renderers/MaterialAnyOfRenderer.test.tsx +14 -8
- package/test/renderers/MaterialArrayLayout.test.tsx +6 -6
- package/test/renderers/MaterialCategorizationLayout.test.tsx +73 -0
- package/test/renderers/MaterialCategorizationStepperLayout.test.tsx +73 -0
- package/test/renderers/MaterialInputControl.test.tsx +3 -3
- package/test/renderers/MaterialIntegerCell.test.tsx +41 -20
- package/test/renderers/MaterialNumberCell.test.tsx +45 -24
- package/test/renderers/MaterialOneOfRenderer.test.tsx +7 -4
- package/test/renderers/MaterialTextCell.test.tsx +41 -20
- package/test/renderers/MaterialTimeCell.test.tsx +41 -20
- package/test/renderers/MaterialTimeControl.test.tsx +3 -3
- package/docs/classes/materialarraylayout.html +0 -777
- package/docs/classes/materialcategorizationlayoutrenderer.html +0 -786
- package/docs/classes/materialcategorizationstepperlayoutrenderer.html +0 -762
- package/docs/classes/materialdatecontrol.html +0 -825
- package/docs/classes/materialdatetimecontrol.html +0 -825
- package/docs/classes/materialinputcontrol.html +0 -825
- package/docs/classes/materialnativecontrol.html +0 -825
- package/docs/classes/materialradiogroup.html +0 -825
- package/docs/classes/materialslidercontrol.html +0 -825
- package/docs/classes/materialtimecontrol.html +0 -825
- package/docs/interfaces/materialarraylayoutstate.html +0 -157
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
The MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2021 EclipseSource Munich
|
|
5
|
+
https://github.com/eclipsesource/jsonforms
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
23
|
+
THE SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
import {useState, useCallback} from 'react';
|
|
26
|
+
|
|
27
|
+
export const useFocus = ():[boolean, () => void, () => void] => {
|
|
28
|
+
const [focused, setFocused] = useState(false);
|
|
29
|
+
const onFocus = useCallback(() => setFocused(true), []);
|
|
30
|
+
const onBlur = useCallback(() => setFocused(false), []);
|
|
31
|
+
return [focused, onFocus, onBlur];
|
|
32
|
+
};
|
package/src/util/index.ts
CHANGED
package/src/util/layout.tsx
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
import isEmpty from 'lodash/isEmpty';
|
|
26
26
|
import React from 'react';
|
|
27
27
|
import { ComponentType } from 'react';
|
|
28
|
-
import
|
|
28
|
+
import Ajv from 'ajv';
|
|
29
29
|
import {
|
|
30
30
|
getAjv,
|
|
31
31
|
JsonFormsCellRendererRegistryEntry,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
OwnPropsOfRenderer,
|
|
35
35
|
UISchemaElement
|
|
36
36
|
} from '@jsonforms/core';
|
|
37
|
-
import {
|
|
37
|
+
import { JsonFormsDispatch, useJsonForms } from '@jsonforms/react';
|
|
38
38
|
import { Grid, Hidden } from '@material-ui/core';
|
|
39
39
|
|
|
40
40
|
export const renderLayoutElements = (
|
|
@@ -63,7 +63,7 @@ export interface MaterialLayoutRendererProps extends OwnPropsOfRenderer {
|
|
|
63
63
|
elements: UISchemaElement[];
|
|
64
64
|
direction: 'row' | 'column';
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
const MaterialLayoutRendererComponent =
|
|
67
67
|
({
|
|
68
68
|
visible,
|
|
69
69
|
elements,
|
|
@@ -96,9 +96,8 @@ export const MaterialLayoutRenderer = React.memo(
|
|
|
96
96
|
</Hidden>
|
|
97
97
|
);
|
|
98
98
|
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
);
|
|
99
|
+
};
|
|
100
|
+
export const MaterialLayoutRenderer = React.memo(MaterialLayoutRendererComponent);
|
|
102
101
|
|
|
103
102
|
export interface AjvProps {
|
|
104
103
|
ajv: Ajv;
|
|
@@ -62,7 +62,7 @@ describe('Material anyOf renderer', () => {
|
|
|
62
62
|
|
|
63
63
|
afterEach(() => wrapper.unmount());
|
|
64
64
|
|
|
65
|
-
it('should add an item at correct path', () => {
|
|
65
|
+
it('should add an item at correct path', (done) => {
|
|
66
66
|
const schema = {
|
|
67
67
|
type: 'object',
|
|
68
68
|
properties: {
|
|
@@ -103,9 +103,12 @@ describe('Material anyOf renderer', () => {
|
|
|
103
103
|
const input = wrapper.find('input').first();
|
|
104
104
|
input.simulate('change', { target: { value: 'test' } });
|
|
105
105
|
wrapper.update();
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
expect(onChangeData.data).toEqual({
|
|
108
|
+
value: 'test'
|
|
109
|
+
});
|
|
110
|
+
done();
|
|
111
|
+
}, 1000);
|
|
109
112
|
});
|
|
110
113
|
|
|
111
114
|
it('should add a "mything"', async () => {
|
|
@@ -179,7 +182,7 @@ describe('Material anyOf renderer', () => {
|
|
|
179
182
|
expect(nrOfRowsAfterAdd.length).toBe(4);
|
|
180
183
|
});
|
|
181
184
|
|
|
182
|
-
it('should switch to "yourThing" edit, then switch back, then edit', async () => {
|
|
185
|
+
it('should switch to "yourThing" edit, then switch back, then edit', async (done) => {
|
|
183
186
|
const schema = {
|
|
184
187
|
type: 'object',
|
|
185
188
|
properties: {
|
|
@@ -260,9 +263,12 @@ describe('Material anyOf renderer', () => {
|
|
|
260
263
|
input.simulate('change', { target: { value: 'test' } });
|
|
261
264
|
wrapper.update();
|
|
262
265
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
+
setTimeout(() => {
|
|
267
|
+
expect(onChangeData.data).toEqual({
|
|
268
|
+
myThingsAndOrYourThings: [{ age: 5, name: 'test' }]
|
|
269
|
+
});
|
|
270
|
+
done();
|
|
271
|
+
}, 1000);
|
|
266
272
|
});
|
|
267
273
|
|
|
268
274
|
it('should be hideable', () => {
|
|
@@ -292,7 +292,7 @@ describe('Material array layout', () => {
|
|
|
292
292
|
// up button
|
|
293
293
|
expect(
|
|
294
294
|
wrapper
|
|
295
|
-
.find('
|
|
295
|
+
.find('Memo(ExpandPanelRendererComponent)')
|
|
296
296
|
.at(0)
|
|
297
297
|
.find('button')
|
|
298
298
|
.find({ 'aria-label': 'Move up' }).length
|
|
@@ -300,7 +300,7 @@ describe('Material array layout', () => {
|
|
|
300
300
|
// down button
|
|
301
301
|
expect(
|
|
302
302
|
wrapper
|
|
303
|
-
.find('
|
|
303
|
+
.find('Memo(ExpandPanelRendererComponent)')
|
|
304
304
|
.at(0)
|
|
305
305
|
.find('button')
|
|
306
306
|
.find({ 'aria-label': 'Move down' }).length
|
|
@@ -326,7 +326,7 @@ describe('Material array layout', () => {
|
|
|
326
326
|
|
|
327
327
|
// getting up button of second item in expension panel;
|
|
328
328
|
const upButton = wrapper
|
|
329
|
-
.find('
|
|
329
|
+
.find('Memo(ExpandPanelRendererComponent)')
|
|
330
330
|
.at(1)
|
|
331
331
|
.find('button')
|
|
332
332
|
.find({ 'aria-label': 'Move up' });
|
|
@@ -363,7 +363,7 @@ describe('Material array layout', () => {
|
|
|
363
363
|
|
|
364
364
|
// getting up button of second item in expension panel;
|
|
365
365
|
const upButton = wrapper
|
|
366
|
-
.find('
|
|
366
|
+
.find('Memo(ExpandPanelRendererComponent)')
|
|
367
367
|
.at(0)
|
|
368
368
|
.find('button')
|
|
369
369
|
.find({ 'aria-label': 'Move down' });
|
|
@@ -394,7 +394,7 @@ describe('Material array layout', () => {
|
|
|
394
394
|
|
|
395
395
|
// getting up button of second item in expension panel;
|
|
396
396
|
const upButton = wrapper
|
|
397
|
-
.find('
|
|
397
|
+
.find('Memo(ExpandPanelRendererComponent)')
|
|
398
398
|
.at(0)
|
|
399
399
|
.find('button')
|
|
400
400
|
.find({ 'aria-label': 'Move up' });
|
|
@@ -414,7 +414,7 @@ describe('Material array layout', () => {
|
|
|
414
414
|
|
|
415
415
|
// getting up button of second item in expension panel;
|
|
416
416
|
const downButton = wrapper
|
|
417
|
-
.find('
|
|
417
|
+
.find('Memo(ExpandPanelRendererComponent)')
|
|
418
418
|
.at(1)
|
|
419
419
|
.find('button')
|
|
420
420
|
.find({ 'aria-label': 'Move down' });
|
|
@@ -372,4 +372,77 @@ describe('Material categorization layout', () => {
|
|
|
372
372
|
const materialArrayLayout = wrapper.find(MaterialLayoutRenderer);
|
|
373
373
|
expect(materialArrayLayout.props().renderers).toHaveLength(0);
|
|
374
374
|
});
|
|
375
|
+
|
|
376
|
+
it('display correct content when hiding a tab', () => {
|
|
377
|
+
const data = { name : 'fo' };
|
|
378
|
+
const condition: SchemaBasedCondition = {
|
|
379
|
+
scope: '#/properties/name',
|
|
380
|
+
schema: { maxLength: 3 }
|
|
381
|
+
};
|
|
382
|
+
const nameControl: ControlElement = {
|
|
383
|
+
type: 'Control',
|
|
384
|
+
scope: '#/properties/name'
|
|
385
|
+
};
|
|
386
|
+
const uischema: Categorization = {
|
|
387
|
+
type: 'Categorization',
|
|
388
|
+
label: '',
|
|
389
|
+
options: {
|
|
390
|
+
showNavButtons: true
|
|
391
|
+
},
|
|
392
|
+
elements: [
|
|
393
|
+
{
|
|
394
|
+
type: 'Category',
|
|
395
|
+
label: 'A',
|
|
396
|
+
elements: undefined
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
type: 'Category',
|
|
400
|
+
label: 'B',
|
|
401
|
+
elements: undefined,
|
|
402
|
+
rule: {
|
|
403
|
+
effect: RuleEffect.SHOW,
|
|
404
|
+
condition: condition
|
|
405
|
+
}
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
type: 'Category',
|
|
409
|
+
label: 'C',
|
|
410
|
+
elements: [nameControl],
|
|
411
|
+
rule: {
|
|
412
|
+
effect: RuleEffect.HIDE,
|
|
413
|
+
condition: condition
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
]
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
const core = initCore(fixture.schema, uischema, data);
|
|
420
|
+
|
|
421
|
+
const wrapper = mount(
|
|
422
|
+
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
423
|
+
<MaterialCategorizationLayoutRenderer
|
|
424
|
+
{...layoutDefaultProps}
|
|
425
|
+
schema={fixture.schema}
|
|
426
|
+
uischema={uischema}
|
|
427
|
+
/>
|
|
428
|
+
</JsonFormsStateProvider>
|
|
429
|
+
);
|
|
430
|
+
|
|
431
|
+
wrapper
|
|
432
|
+
.find(Tab)
|
|
433
|
+
.at(1)
|
|
434
|
+
.simulate('click');
|
|
435
|
+
|
|
436
|
+
let isCategoryCshown = wrapper.find('input[type="text"]').length > 0;
|
|
437
|
+
expect(isCategoryCshown).toBe(false);
|
|
438
|
+
|
|
439
|
+
core.data = { ...core.data, name: 'Barr' };
|
|
440
|
+
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
441
|
+
wrapper.update();
|
|
442
|
+
|
|
443
|
+
isCategoryCshown = wrapper.find('input[type="text"]').length > 0;
|
|
444
|
+
expect(isCategoryCshown).toBe(true);
|
|
445
|
+
|
|
446
|
+
wrapper.unmount();
|
|
447
|
+
});
|
|
375
448
|
});
|
|
@@ -561,4 +561,77 @@ describe('Material categorization stepper layout', () => {
|
|
|
561
561
|
|
|
562
562
|
wrapper.unmount();
|
|
563
563
|
});
|
|
564
|
+
|
|
565
|
+
it('display correct content when hiding a step', () => {
|
|
566
|
+
const data = { name : 'fo' };
|
|
567
|
+
const condition: SchemaBasedCondition = {
|
|
568
|
+
scope: '#/properties/name',
|
|
569
|
+
schema: { maxLength: 3 }
|
|
570
|
+
};
|
|
571
|
+
const nameControl: ControlElement = {
|
|
572
|
+
type: 'Control',
|
|
573
|
+
scope: '#/properties/name'
|
|
574
|
+
};
|
|
575
|
+
const uischema: Categorization = {
|
|
576
|
+
type: 'Categorization',
|
|
577
|
+
label: '',
|
|
578
|
+
options: {
|
|
579
|
+
showNavButtons: true
|
|
580
|
+
},
|
|
581
|
+
elements: [
|
|
582
|
+
{
|
|
583
|
+
type: 'Category',
|
|
584
|
+
label: 'A',
|
|
585
|
+
elements: undefined
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
type: 'Category',
|
|
589
|
+
label: 'B',
|
|
590
|
+
elements: undefined,
|
|
591
|
+
rule: {
|
|
592
|
+
effect: RuleEffect.SHOW,
|
|
593
|
+
condition: condition
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
{
|
|
597
|
+
type: 'Category',
|
|
598
|
+
label: 'C',
|
|
599
|
+
elements: [nameControl],
|
|
600
|
+
rule: {
|
|
601
|
+
effect: RuleEffect.HIDE,
|
|
602
|
+
condition: condition
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
]
|
|
606
|
+
};
|
|
607
|
+
|
|
608
|
+
const core = initCore(fixture.schema, uischema, data);
|
|
609
|
+
|
|
610
|
+
const wrapper = mount(
|
|
611
|
+
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
612
|
+
<MaterialCategorizationStepperLayoutRenderer
|
|
613
|
+
{...layoutDefaultProps}
|
|
614
|
+
schema={fixture.schema}
|
|
615
|
+
uischema={uischema}
|
|
616
|
+
/>
|
|
617
|
+
</JsonFormsStateProvider>
|
|
618
|
+
);
|
|
619
|
+
|
|
620
|
+
wrapper
|
|
621
|
+
.find(StepButton)
|
|
622
|
+
.at(1)
|
|
623
|
+
.simulate('click');
|
|
624
|
+
|
|
625
|
+
let isCategoryCshown = wrapper.find('input[type="text"]').length > 0;
|
|
626
|
+
expect(isCategoryCshown).toBe(false);
|
|
627
|
+
|
|
628
|
+
core.data = { ...core.data, name: 'Barr' };
|
|
629
|
+
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
630
|
+
wrapper.update();
|
|
631
|
+
|
|
632
|
+
isCategoryCshown = wrapper.find('input[type="text"]').length > 0;
|
|
633
|
+
expect(isCategoryCshown).toBe(true);
|
|
634
|
+
|
|
635
|
+
wrapper.unmount();
|
|
636
|
+
});
|
|
564
637
|
});
|
|
@@ -159,7 +159,7 @@ describe('Material input control', () => {
|
|
|
159
159
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
160
160
|
wrapper.update();
|
|
161
161
|
const validation = wrapper.find('p').first();
|
|
162
|
-
expect(validation.text()).toBe('
|
|
162
|
+
expect(validation.text()).toBe('must be string');
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
it('should display multiple errors', () => {
|
|
@@ -173,7 +173,7 @@ describe('Material input control', () => {
|
|
|
173
173
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
174
174
|
wrapper.update();
|
|
175
175
|
const validation = wrapper.find('p').first();
|
|
176
|
-
expect(validation.text()).toBe('
|
|
176
|
+
expect(validation.text()).toBe('must be string');
|
|
177
177
|
});
|
|
178
178
|
|
|
179
179
|
it('should not show any errors', () => {
|
|
@@ -283,7 +283,7 @@ describe('Material input control', () => {
|
|
|
283
283
|
</JsonFormsStateProvider>
|
|
284
284
|
);
|
|
285
285
|
const label = wrapper.find('label').first();
|
|
286
|
-
expect(label.text()).toBe('Date Cell*');
|
|
286
|
+
expect(label.text()).toBe('Date Cell *');
|
|
287
287
|
});
|
|
288
288
|
|
|
289
289
|
it('should not display a marker for a non-required prop', () => {
|
|
@@ -175,7 +175,7 @@ describe('Material integer cells', () => {
|
|
|
175
175
|
expect(input.props().value).toBe(0);
|
|
176
176
|
});
|
|
177
177
|
|
|
178
|
-
it('should update via input event', () => {
|
|
178
|
+
it('should update via input event', (done) => {
|
|
179
179
|
const core = initCore(schema, uischema, data);
|
|
180
180
|
const onChangeData: any = {
|
|
181
181
|
data: undefined
|
|
@@ -193,10 +193,13 @@ describe('Material integer cells', () => {
|
|
|
193
193
|
|
|
194
194
|
const input = wrapper.find('input');
|
|
195
195
|
input.simulate('change', { target: { value: 13 } });
|
|
196
|
-
|
|
196
|
+
setTimeout(() => {
|
|
197
|
+
expect(onChangeData.data.foo).toBe(13);
|
|
198
|
+
done();
|
|
199
|
+
}, 1000)
|
|
197
200
|
});
|
|
198
201
|
|
|
199
|
-
it('should update via action', () => {
|
|
202
|
+
it('should update via action', (done) => {
|
|
200
203
|
const core = initCore(schema, uischema, { foo: 13 });
|
|
201
204
|
wrapper = mount(
|
|
202
205
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -206,11 +209,14 @@ describe('Material integer cells', () => {
|
|
|
206
209
|
core.data = { ...core.data, foo: 42 };
|
|
207
210
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
208
211
|
wrapper.update();
|
|
209
|
-
|
|
210
|
-
|
|
212
|
+
setTimeout(() => {
|
|
213
|
+
const input = wrapper.find('input').first();
|
|
214
|
+
expect(input.props().value).toBe(42);
|
|
215
|
+
done();
|
|
216
|
+
}, 1000);
|
|
211
217
|
});
|
|
212
218
|
|
|
213
|
-
it('should not update with undefined value', () => {
|
|
219
|
+
it('should not update with undefined value', (done) => {
|
|
214
220
|
const core = initCore(schema, uischema, data);
|
|
215
221
|
wrapper = mount(
|
|
216
222
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -220,11 +226,14 @@ describe('Material integer cells', () => {
|
|
|
220
226
|
core.data = { ...core.data, foo: undefined };
|
|
221
227
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
222
228
|
wrapper.update();
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
setTimeout(() => {
|
|
230
|
+
const input = wrapper.find('input');
|
|
231
|
+
expect(input.props().value).toBe('');
|
|
232
|
+
done();
|
|
233
|
+
}, 1000);
|
|
225
234
|
});
|
|
226
235
|
|
|
227
|
-
it('should not update with null value', () => {
|
|
236
|
+
it('should not update with null value', (done) => {
|
|
228
237
|
const core = initCore(schema, uischema, data);
|
|
229
238
|
wrapper = mount(
|
|
230
239
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -234,11 +243,14 @@ describe('Material integer cells', () => {
|
|
|
234
243
|
core.data = { ...core.data, foo: null };
|
|
235
244
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
236
245
|
wrapper.update();
|
|
237
|
-
|
|
238
|
-
|
|
246
|
+
setTimeout(() => {
|
|
247
|
+
const input = wrapper.find('input').first();
|
|
248
|
+
expect(input.props().value).toBe('');
|
|
249
|
+
done();
|
|
250
|
+
}, 1000);
|
|
239
251
|
});
|
|
240
252
|
|
|
241
|
-
it('should not update with wrong ref', () => {
|
|
253
|
+
it('should not update with wrong ref', (done) => {
|
|
242
254
|
const core = initCore(schema, uischema, data);
|
|
243
255
|
wrapper = mount(
|
|
244
256
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -248,11 +260,14 @@ describe('Material integer cells', () => {
|
|
|
248
260
|
core.data = { ...core.data, bar: 11 };
|
|
249
261
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
250
262
|
wrapper.update();
|
|
251
|
-
|
|
252
|
-
|
|
263
|
+
setTimeout(() => {
|
|
264
|
+
const input = wrapper.find('input');
|
|
265
|
+
expect(input.props().value).toBe(42);
|
|
266
|
+
done();
|
|
267
|
+
}, 1000);
|
|
253
268
|
});
|
|
254
269
|
|
|
255
|
-
it('should not update with null ref', () => {
|
|
270
|
+
it('should not update with null ref', (done) => {
|
|
256
271
|
const core = initCore(schema, uischema, data);
|
|
257
272
|
wrapper = mount(
|
|
258
273
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -262,11 +277,14 @@ describe('Material integer cells', () => {
|
|
|
262
277
|
core.data = { ...core.data, null: 13 };
|
|
263
278
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
264
279
|
wrapper.update();
|
|
265
|
-
|
|
266
|
-
|
|
280
|
+
setTimeout(() => {
|
|
281
|
+
const input = wrapper.find('input');
|
|
282
|
+
expect(input.props().value).toBe(42);
|
|
283
|
+
done();
|
|
284
|
+
}, 1000);
|
|
267
285
|
});
|
|
268
286
|
|
|
269
|
-
it('should not update with undefined ref', () => {
|
|
287
|
+
it('should not update with undefined ref', (done) => {
|
|
270
288
|
const core = initCore(schema, uischema, data);
|
|
271
289
|
wrapper = mount(
|
|
272
290
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -276,8 +294,11 @@ describe('Material integer cells', () => {
|
|
|
276
294
|
core.data = { ...core.data, undefined: 13 };
|
|
277
295
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
278
296
|
wrapper.update();
|
|
279
|
-
|
|
280
|
-
|
|
297
|
+
setTimeout(() => {
|
|
298
|
+
const input = wrapper.find('input');
|
|
299
|
+
expect(input.props().value).toBe(42);
|
|
300
|
+
done();
|
|
301
|
+
}, 1000);
|
|
281
302
|
});
|
|
282
303
|
|
|
283
304
|
it('can be disabled', () => {
|
|
@@ -217,7 +217,7 @@ describe('Material number cells', () => {
|
|
|
217
217
|
expect(input.props().value).toBe(0);
|
|
218
218
|
});
|
|
219
219
|
|
|
220
|
-
it('should update via input event', () => {
|
|
220
|
+
it('should update via input event', (done) => {
|
|
221
221
|
const core = initCore(schema, uischema, data);
|
|
222
222
|
const onChangeData: any = {
|
|
223
223
|
data: undefined
|
|
@@ -234,10 +234,13 @@ describe('Material number cells', () => {
|
|
|
234
234
|
);
|
|
235
235
|
const input = wrapper.find('input');
|
|
236
236
|
input.simulate('change', { target: { value: 2.72 } });
|
|
237
|
-
|
|
237
|
+
setTimeout(() => {
|
|
238
|
+
expect(onChangeData.data.foo).toBe(2.72);
|
|
239
|
+
done();
|
|
240
|
+
}, 1000);
|
|
238
241
|
});
|
|
239
242
|
|
|
240
|
-
it('should update via action', () => {
|
|
243
|
+
it('should update via action', (done) => {
|
|
241
244
|
const core = initCore(schema, uischema, { foo: 2.72 });
|
|
242
245
|
wrapper = mount(
|
|
243
246
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -251,15 +254,18 @@ describe('Material number cells', () => {
|
|
|
251
254
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
252
255
|
wrapper.update();
|
|
253
256
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
setTimeout(() => {
|
|
258
|
+
expect(
|
|
259
|
+
wrapper
|
|
260
|
+
.find('input')
|
|
261
|
+
.first()
|
|
262
|
+
.props().value
|
|
263
|
+
).toBe(3.14);
|
|
264
|
+
done();
|
|
265
|
+
}, 1000);
|
|
260
266
|
});
|
|
261
267
|
|
|
262
|
-
it('should update with undefined value', () => {
|
|
268
|
+
it('should update with undefined value', (done) => {
|
|
263
269
|
const core = initCore(schema, uischema, data);
|
|
264
270
|
wrapper = mount(
|
|
265
271
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -269,11 +275,14 @@ describe('Material number cells', () => {
|
|
|
269
275
|
core.data = { ...core.data, foo: undefined };
|
|
270
276
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
271
277
|
wrapper.update();
|
|
272
|
-
|
|
273
|
-
|
|
278
|
+
setTimeout(() => {
|
|
279
|
+
const input = wrapper.find('input').first();
|
|
280
|
+
expect(input.props().value).toBe('');
|
|
281
|
+
done();
|
|
282
|
+
}, 1000);
|
|
274
283
|
});
|
|
275
284
|
|
|
276
|
-
it('should not update with null value', () => {
|
|
285
|
+
it('should not update with null value', (done) => {
|
|
277
286
|
const core = initCore(schema, uischema, data);
|
|
278
287
|
wrapper = mount(
|
|
279
288
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -283,11 +292,14 @@ describe('Material number cells', () => {
|
|
|
283
292
|
core.data = { ...core.data, foo: null };
|
|
284
293
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
285
294
|
wrapper.update();
|
|
286
|
-
|
|
287
|
-
|
|
295
|
+
setTimeout(() => {
|
|
296
|
+
const input = wrapper.find('input').first();
|
|
297
|
+
expect(input.props().value).toBe('');
|
|
298
|
+
done();
|
|
299
|
+
}, 1000);
|
|
288
300
|
});
|
|
289
301
|
|
|
290
|
-
it('should not update with wrong ref', () => {
|
|
302
|
+
it('should not update with wrong ref', (done) => {
|
|
291
303
|
const core = initCore(schema, uischema, data);
|
|
292
304
|
wrapper = mount(
|
|
293
305
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -297,11 +309,14 @@ describe('Material number cells', () => {
|
|
|
297
309
|
core.data = { ...core.data, bar: 11 };
|
|
298
310
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
299
311
|
wrapper.update();
|
|
300
|
-
|
|
301
|
-
|
|
312
|
+
setTimeout(() => {
|
|
313
|
+
const input = wrapper.find('input').first();
|
|
314
|
+
expect(input.props().value).toBe(3.14);
|
|
315
|
+
done();
|
|
316
|
+
}, 1000);
|
|
302
317
|
});
|
|
303
318
|
|
|
304
|
-
it('should not update with null ref', () => {
|
|
319
|
+
it('should not update with null ref', (done) => {
|
|
305
320
|
const core = initCore(schema, uischema, data);
|
|
306
321
|
wrapper = mount(
|
|
307
322
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -311,11 +326,14 @@ describe('Material number cells', () => {
|
|
|
311
326
|
core.data = { ...core.data, null: 2.72 };
|
|
312
327
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
313
328
|
wrapper.update();
|
|
314
|
-
|
|
315
|
-
|
|
329
|
+
setTimeout(() => {
|
|
330
|
+
const input = wrapper.find('input').first();
|
|
331
|
+
expect(input.props().value).toBe(3.14);
|
|
332
|
+
done();
|
|
333
|
+
}, 1000);
|
|
316
334
|
});
|
|
317
335
|
|
|
318
|
-
it('should not update with undefined ref', () => {
|
|
336
|
+
it('should not update with undefined ref', (done) => {
|
|
319
337
|
const core = initCore(schema, uischema, data);
|
|
320
338
|
wrapper = mount(
|
|
321
339
|
<JsonFormsStateProvider initState={{ renderers: materialRenderers, core }}>
|
|
@@ -325,8 +343,11 @@ describe('Material number cells', () => {
|
|
|
325
343
|
core.data = { ...core.data, undefined: 13 };
|
|
326
344
|
wrapper.setProps({ initState: { renderers: materialRenderers, core }} );
|
|
327
345
|
wrapper.update();
|
|
328
|
-
|
|
329
|
-
|
|
346
|
+
setTimeout(() => {
|
|
347
|
+
const input = wrapper.find('input').first();
|
|
348
|
+
expect(input.props().value).toBe(3.14);
|
|
349
|
+
done();
|
|
350
|
+
}, 1000);
|
|
330
351
|
});
|
|
331
352
|
|
|
332
353
|
it('can be disabled', () => {
|
|
@@ -256,7 +256,7 @@ describe('Material oneOf renderer', () => {
|
|
|
256
256
|
expect(secondTab.props().selected).toBeTruthy();
|
|
257
257
|
});
|
|
258
258
|
|
|
259
|
-
it('should add an item at correct path', () => {
|
|
259
|
+
it('should add an item at correct path', (done) => {
|
|
260
260
|
const schema = {
|
|
261
261
|
type: 'object',
|
|
262
262
|
properties: {
|
|
@@ -298,9 +298,12 @@ describe('Material oneOf renderer', () => {
|
|
|
298
298
|
const input = wrapper.find('input').first();
|
|
299
299
|
input.simulate('change', { target: { value: 'test' } });
|
|
300
300
|
wrapper.update();
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
301
|
+
setTimeout(() => {
|
|
302
|
+
expect(onChangeData.data).toEqual({
|
|
303
|
+
value: 'test'
|
|
304
|
+
});
|
|
305
|
+
done();
|
|
306
|
+
}, 1000);
|
|
304
307
|
});
|
|
305
308
|
|
|
306
309
|
it.skip('should add an item within an array', async () => {
|