@truedat/qx 7.5.9 → 7.5.10
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/package.json +45 -64
- package/src/components/QxRoutes.js +38 -19
- package/src/components/__tests__/QxRoutes.spec.js +73 -0
- package/src/components/__tests__/__snapshots__/QxRoutes.spec.js.snap +60 -0
- package/src/components/common/ClauseViewer.js +6 -6
- package/src/components/common/DescriptionInput.js +0 -1
- package/src/components/common/ResourceSelector.js +2 -3
- package/src/components/common/TestFormWrapper.js +2 -13
- package/src/components/common/TypeSelector.js +0 -1
- package/src/components/common/__tests__/DescriptionInput.spec.js +12 -21
- package/src/components/common/__tests__/ResourceSelector.spec.js +42 -87
- package/src/components/common/__tests__/TypeSelector.spec.js +0 -1
- package/src/components/common/__tests__/__snapshots__/ResourceSelector.spec.js.snap +32 -22
- package/src/components/common/expressions/Clauses.js +5 -6
- package/src/components/common/expressions/Condition.js +8 -9
- package/src/components/common/expressions/ConstantSelector.js +2 -2
- package/src/components/common/expressions/Expression.js +2 -2
- package/src/components/common/expressions/FieldSelector.js +2 -2
- package/src/components/common/expressions/FunctionArgs.js +5 -6
- package/src/components/common/expressions/FunctionSelector.js +2 -2
- package/src/components/common/expressions/ParamSelector.js +2 -2
- package/src/components/common/expressions/ShapeSelector.js +7 -16
- package/src/components/common/expressions/__tests__/Clauses.spec.js +10 -9
- package/src/components/common/expressions/__tests__/Condition.spec.js +6 -26
- package/src/components/common/expressions/__tests__/ConstantSelector.spec.js +14 -30
- package/src/components/common/expressions/__tests__/Expression.spec.js +44 -51
- package/src/components/common/expressions/__tests__/FieldSelector.spec.js +2 -7
- package/src/components/common/expressions/__tests__/FunctionArgs.spec.js +18 -44
- package/src/components/common/expressions/__tests__/FunctionSelector.spec.js +19 -27
- package/src/components/common/expressions/__tests__/ParamSelector.spec.js +28 -58
- package/src/components/common/expressions/__tests__/ShapeSelector.spec.js +42 -43
- package/src/components/common/expressions/__tests__/__snapshots__/Condition.spec.js.snap +6 -6
- package/src/components/common/expressions/__tests__/__snapshots__/ConstantSelector.spec.js.snap +6 -7
- package/src/components/common/expressions/__tests__/__snapshots__/Expression.spec.js.snap +20 -20
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionArgs.spec.js.snap +8 -9
- package/src/components/common/expressions/__tests__/__snapshots__/FunctionSelector.spec.js.snap +670 -8
- package/src/components/common/expressions/__tests__/__snapshots__/ParamSelector.spec.js.snap +5 -5
- package/src/components/common/expressions/__tests__/__snapshots__/ShapeSelector.spec.js.snap +9 -9
- package/src/components/common/expressions/__tests__/useWatchParams.spec.js +1 -4
- package/src/components/common/expressions/constantInputs/AnySelector.js +5 -6
- package/src/components/common/expressions/constantInputs/BooleanSelector.js +2 -2
- package/src/components/common/expressions/constantInputs/DefaultSelector.js +2 -2
- package/src/components/common/expressions/constantInputs/__tests__/AnySelector.spec.js +16 -37
- package/src/components/common/expressions/constantInputs/__tests__/BooleanSelector.spec.js +14 -17
- package/src/components/common/expressions/constantInputs/__tests__/DefaultSelector.spec.js +12 -27
- package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/AnySelector.spec.js.snap +11 -11
- package/src/components/common/expressions/constantInputs/__tests__/__snapshots__/DefaultSelector.spec.js.snap +0 -1
- package/src/components/common/resourceSelectors/DataStructureSelector.js +2 -2
- package/src/components/common/resourceSelectors/DataViewSelector.js +2 -2
- package/src/components/common/resourceSelectors/ReferenceDatasetSelector.js +2 -2
- package/src/components/common/resourceSelectors/__tests__/DataStructureSelector.spec.js +5 -29
- package/src/components/common/resourceSelectors/__tests__/DataViewSelector.spec.js +23 -25
- package/src/components/common/resourceSelectors/__tests__/ReferenceDatasetSelector.spec.js +21 -32
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataStructureSelector.spec.js.snap +3 -4
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/DataViewSelector.spec.js.snap +1 -1
- package/src/components/common/resourceSelectors/__tests__/__snapshots__/ReferenceDatasetSelector.spec.js.snap +1 -1
- package/src/components/dataViews/DataViewEditor.js +5 -6
- package/src/components/dataViews/DataViewSelect.js +4 -5
- package/src/components/dataViews/DataViews.js +1 -2
- package/src/components/dataViews/Queryable.js +4 -4
- package/src/components/dataViews/Queryables.js +0 -1
- package/src/components/dataViews/__tests__/DataViewEditor.spec.js +36 -111
- package/src/components/dataViews/__tests__/DataViewSelect.spec.js +0 -1
- package/src/components/dataViews/__tests__/DataViews.spec.js +15 -16
- package/src/components/dataViews/__tests__/Queryable.spec.js +0 -1
- package/src/components/dataViews/__tests__/Queryables.spec.js +35 -74
- package/src/components/dataViews/__tests__/__snapshots__/DataViewEditor.spec.js.snap +61 -55
- package/src/components/dataViews/__tests__/__snapshots__/DataViews.spec.js.snap +5 -5
- package/src/components/dataViews/__tests__/__snapshots__/Queryables.spec.js.snap +59 -59
- package/src/components/dataViews/queryableProperties/From.js +4 -4
- package/src/components/dataViews/queryableProperties/GroupBy.js +6 -6
- package/src/components/dataViews/queryableProperties/Join.js +6 -6
- package/src/components/dataViews/queryableProperties/JoinTypeIcon.js +8 -9
- package/src/components/dataViews/queryableProperties/Select.js +4 -5
- package/src/components/dataViews/queryableProperties/SelectField.js +4 -4
- package/src/components/dataViews/queryableProperties/Where.js +4 -4
- package/src/components/dataViews/queryableProperties/__tests__/From.spec.js +0 -1
- package/src/components/dataViews/queryableProperties/__tests__/GroupBy.spec.js +16 -42
- package/src/components/dataViews/queryableProperties/__tests__/Join.spec.js +6 -29
- package/src/components/dataViews/queryableProperties/__tests__/JoinTypeIcon.spec.js +0 -1
- package/src/components/dataViews/queryableProperties/__tests__/Select.spec.js +26 -50
- package/src/components/dataViews/queryableProperties/__tests__/SelectField.spec.js +22 -42
- package/src/components/dataViews/queryableProperties/__tests__/Where.spec.js +6 -17
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/GroupBy.spec.js.snap +309 -9
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Join.spec.js.snap +12 -12
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Select.spec.js.snap +192 -18
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/SelectField.spec.js.snap +6 -8
- package/src/components/dataViews/queryableProperties/__tests__/__snapshots__/Where.spec.js.snap +2 -2
- package/src/components/functions/FunctionEditor.js +3 -5
- package/src/components/functions/FunctionParams.js +2 -3
- package/src/components/functions/Functions.js +3 -4
- package/src/components/functions/__tests__/FunctionEditor.spec.js +61 -57
- package/src/components/functions/__tests__/FunctionParams.spec.js +50 -47
- package/src/components/functions/__tests__/Functions.spec.js +5 -12
- package/src/components/functions/__tests__/__snapshots__/FunctionParams.spec.js.snap +11 -11
- package/src/components/functions/__tests__/__snapshots__/Functions.spec.js.snap +4 -5
- package/src/components/qualityControls/ControlProperties.js +4 -4
- package/src/components/qualityControls/ControlPropertiesView.js +0 -1
- package/src/components/qualityControls/EditQualityControl.js +5 -5
- package/src/components/qualityControls/IconPopup.js +0 -1
- package/src/components/qualityControls/NewDraftQualityControl.js +8 -6
- package/src/components/qualityControls/NewQualityControl.js +5 -6
- package/src/components/qualityControls/QualityBadge.js +29 -30
- package/src/components/qualityControls/QualityControl.js +4 -7
- package/src/components/qualityControls/QualityControlActions.js +7 -7
- package/src/components/qualityControls/QualityControlCrumbs.js +1 -3
- package/src/components/qualityControls/QualityControlEditor.js +5 -11
- package/src/components/qualityControls/QualityControlHeader.js +4 -6
- package/src/components/qualityControls/QualityControlHistory.js +3 -3
- package/src/components/qualityControls/QualityControlManageDomain.js +2 -2
- package/src/components/qualityControls/QualityControlQueryModal.js +1 -1
- package/src/components/qualityControls/QualityControlRoutes.js +27 -54
- package/src/components/qualityControls/QualityControlRow.js +0 -2
- package/src/components/qualityControls/QualityControlScores.js +7 -5
- package/src/components/qualityControls/QualityControlTabs.js +2 -2
- package/src/components/qualityControls/QualityControls.js +10 -8
- package/src/components/qualityControls/QualityControlsLabelResults.js +0 -2
- package/src/components/qualityControls/QualityControlsPagination.js +0 -1
- package/src/components/qualityControls/QualityControlsTable.js +1 -2
- package/src/components/qualityControls/ScoreCriteria.js +4 -4
- package/src/components/qualityControls/ScoreCriteriaView.js +0 -1
- package/src/components/qualityControls/__tests__/ControlProperties.spec.js +10 -15
- package/src/components/qualityControls/__tests__/ControlPropertiesView.spec.js +0 -1
- package/src/components/qualityControls/__tests__/EditQualityControl.spec.js +28 -70
- package/src/components/qualityControls/__tests__/IconPopup.spec.js +10 -11
- package/src/components/qualityControls/__tests__/NewDraftQualityControl.spec.js +33 -70
- package/src/components/qualityControls/__tests__/NewQualityControl.spec.js +81 -113
- package/src/components/qualityControls/__tests__/QualityBadge.spec.js +50 -58
- package/src/components/qualityControls/__tests__/QualityControl.spec.js +19 -31
- package/src/components/qualityControls/__tests__/QualityControlActions.spec.js +49 -46
- package/src/components/qualityControls/__tests__/QualityControlCrumbs.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlEditor.spec.js +68 -107
- package/src/components/qualityControls/__tests__/QualityControlHeader.spec.js +22 -25
- package/src/components/qualityControls/__tests__/QualityControlHistory.spec.js +6 -6
- package/src/components/qualityControls/__tests__/QualityControlManageDomain.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlQueryModal.spec.js +12 -11
- package/src/components/qualityControls/__tests__/QualityControlRow.spec.js +4 -8
- package/src/components/qualityControls/__tests__/QualityControlScores.spec.js +23 -19
- package/src/components/qualityControls/__tests__/QualityControlTabs.spec.js +2 -3
- package/src/components/qualityControls/__tests__/QualityControls.spec.js +69 -53
- package/src/components/qualityControls/__tests__/QualityControlsLabelResults.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlsPagination.spec.js +0 -1
- package/src/components/qualityControls/__tests__/QualityControlsTable.spec.js +2 -3
- package/src/components/qualityControls/__tests__/ScoreCriteria.spec.js +0 -1
- package/src/components/qualityControls/__tests__/ScoreCriteriaView.spec.js +0 -1
- package/src/components/qualityControls/__tests__/__fixtures__/qualityControlHelper.js +1 -1
- package/src/components/qualityControls/__tests__/__snapshots__/EditQualityControl.spec.js.snap +32 -34
- package/src/components/qualityControls/__tests__/__snapshots__/NewDraftQualityControl.spec.js.snap +31 -33
- package/src/components/qualityControls/__tests__/__snapshots__/NewQualityControl.spec.js.snap +17 -19
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControl.spec.js.snap +9 -15
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlActions.spec.js.snap +5 -4
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlCrumbs.spec.js.snap +1 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlEditor.spec.js.snap +0 -3
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHeader.spec.js.snap +16 -11
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlHistory.spec.js.snap +2 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlRow.spec.js.snap +2 -1
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlScores.spec.js.snap +3 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlTabs.spec.js.snap +3 -0
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControls.spec.js.snap +11 -21
- package/src/components/qualityControls/__tests__/__snapshots__/QualityControlsTable.spec.js.snap +2 -0
- package/src/components/qualityControls/controlProperties/Count.js +5 -5
- package/src/components/qualityControls/controlProperties/Ratio.js +6 -8
- package/src/components/qualityControls/controlProperties/__tests__/Count.spec.js +6 -11
- package/src/components/qualityControls/controlProperties/__tests__/Ratio.spec.js +9 -27
- package/src/components/qualityControls/controlProperties/__tests__/__snapshots__/Ratio.spec.js.snap +10 -10
- package/src/components/qualityControls/qualityByControlMode.js +14 -14
- package/src/components/qualityControls/qualityControlScoresColumns.js +1 -2
- package/src/components/qualityControls/scoreCriterias/Deviation.js +2 -2
- package/src/components/qualityControls/scoreCriterias/ErrorCount.js +3 -4
- package/src/components/qualityControls/scoreCriterias/Percentage.js +2 -2
- package/src/components/qualityControls/scoreCriterias/__tests__/Deviation.spec.js +0 -1
- package/src/components/qualityControls/scoreCriterias/__tests__/ErrorCount.spec.js +39 -43
- package/src/components/qualityControls/scoreCriterias/__tests__/Percentage.spec.js +23 -19
- package/src/components/qualityControls/scoreCriterias/__tests__/__snapshots__/ErrorCount.spec.js.snap +4 -7
- package/src/components/scores/MyScoreGroups.js +0 -1
- package/src/components/scores/QualityBar.js +24 -22
- package/src/components/scores/Score.js +4 -5
- package/src/components/scores/ScoreCrumbs.js +3 -5
- package/src/components/scores/ScoreDetails.js +2 -2
- package/src/components/scores/ScoreEvents.js +2 -2
- package/src/components/scores/ScoreGroup.js +5 -4
- package/src/components/scores/ScoreGroupBreadcrumbs.js +1 -2
- package/src/components/scores/ScoreGroupForm.js +2 -4
- package/src/components/scores/ScoreGroupLink.js +1 -2
- package/src/components/scores/ScoreGroupMessage.js +0 -1
- package/src/components/scores/ScoreGroupPopup.js +1 -1
- package/src/components/scores/ScoreGroupsRoutes.js +19 -0
- package/src/components/scores/ScoreGroupsTable.js +15 -48
- package/src/components/scores/ScoreRoutes.js +9 -24
- package/src/components/scores/ScoreStatusDecorator.js +1 -2
- package/src/components/scores/ScoreTabs.js +2 -2
- package/src/components/scores/__tests__/MyScoreGroups.spec.js +0 -1
- package/src/components/scores/__tests__/QualityBar.spec.js +19 -26
- package/src/components/scores/__tests__/Score.spec.js +2 -3
- package/src/components/scores/__tests__/ScoreCrumbs.spec.js +4 -5
- package/src/components/scores/__tests__/ScoreDetails.spec.js +4 -5
- package/src/components/scores/__tests__/ScoreEvents.spec.js +2 -3
- package/src/components/scores/__tests__/ScoreGroup.spec.js +15 -14
- package/src/components/scores/__tests__/ScoreGroupBreadcrumbs.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupForm.spec.js +18 -34
- package/src/components/scores/__tests__/ScoreGroupLink.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupMessage.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreGroupPopup.spec.js +0 -2
- package/src/components/scores/__tests__/ScoreGroupsRoutes.spec.js +32 -0
- package/src/components/scores/__tests__/ScoreGroupsTable.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreStatusDecorator.spec.js +0 -1
- package/src/components/scores/__tests__/ScoreTabs.spec.js +3 -4
- package/src/components/scores/__tests__/__snapshots__/MyScoreGroups.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/Score.spec.js.snap +4 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreCrumbs.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreDetails.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroup.spec.js.snap +39 -10
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupBreadcrumbs.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupForm.spec.js.snap +10 -10
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupLink.spec.js.snap +1 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsRoutes.spec.js.snap +19 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreGroupsTable.spec.js.snap +2 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreStatusDecorator.spec.js.snap +5 -0
- package/src/components/scores/__tests__/__snapshots__/ScoreTabs.spec.js.snap +4 -0
- package/src/hooks/__tests__/useDataViews.spec.js +1 -1
- package/src/hooks/__tests__/useFunctions.spec.js +5 -5
- package/src/hooks/useDataViews.js +2 -2
- package/src/hooks/useExecutionGroups.js +1 -1
- package/src/hooks/useFunctions.js +4 -4
- package/src/hooks/useQualityControls.js +13 -7
- package/src/hooks/useScoreGroups.js +1 -1
- package/src/hooks/useScores.js +2 -2
- package/src/styles/scores.less +21 -21
- package/src/types.js +1 -4
|
@@ -1,66 +1,42 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { waitFor } from "@testing-library/react";
|
|
3
|
-
import { act } from "react-dom/test-utils";
|
|
4
|
-
import { render } from "@truedat/test/render";
|
|
5
1
|
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
6
3
|
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
7
4
|
import FunctionParams from "@truedat/qx/components/functions/FunctionParams";
|
|
8
5
|
import ParamSelector from "../ParamSelector";
|
|
9
6
|
|
|
10
|
-
const renderOpts = {
|
|
11
|
-
messages: {
|
|
12
|
-
en: {
|
|
13
|
-
"functions.form.required": "required",
|
|
14
|
-
"functions.form.add_description": "add_description",
|
|
15
|
-
"functions.form.name": "name",
|
|
16
|
-
"functions.form.add_param": "add_param",
|
|
17
|
-
"expressions.data_type.timestamp": "timestamp",
|
|
18
|
-
"expressions.data_type.date": "date",
|
|
19
|
-
"expressions.data_type.number": "number",
|
|
20
|
-
"expressions.data_type.string": "string",
|
|
21
|
-
"expressions.data_type.boolean": "boolean",
|
|
22
|
-
"expressions.data_type.any": "any",
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
fallback: "lazy",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
7
|
describe("<ParamSelector />", () => {
|
|
29
|
-
it("matches the latest snapshot", () => {
|
|
8
|
+
it("matches the latest snapshot", async () => {
|
|
30
9
|
const defaultValues = {
|
|
31
10
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
32
11
|
};
|
|
33
|
-
const
|
|
12
|
+
const rendered = render(
|
|
34
13
|
<TestFormWrapper defaultValues={defaultValues}>
|
|
35
14
|
<ParamSelector />
|
|
36
|
-
</TestFormWrapper
|
|
37
|
-
renderOpts
|
|
15
|
+
</TestFormWrapper>
|
|
38
16
|
);
|
|
39
|
-
|
|
17
|
+
await waitForLoad(rendered);
|
|
18
|
+
expect(rendered.container).toMatchSnapshot();
|
|
40
19
|
});
|
|
41
20
|
|
|
42
21
|
it("user interaction", async () => {
|
|
22
|
+
const user = userEvent.setup({ delay: null, skipHover: true });
|
|
43
23
|
const watcher = jest.fn();
|
|
44
|
-
|
|
45
24
|
const defaultValues = {
|
|
46
25
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
47
26
|
};
|
|
48
27
|
|
|
49
|
-
const
|
|
28
|
+
const rendered = render(
|
|
50
29
|
<TestFormWrapper
|
|
51
30
|
watcher={watcher}
|
|
52
31
|
context={{ type: "boolean" }}
|
|
53
32
|
defaultValues={defaultValues}
|
|
54
33
|
>
|
|
55
34
|
<ParamSelector />
|
|
56
|
-
</TestFormWrapper
|
|
57
|
-
renderOpts
|
|
35
|
+
</TestFormWrapper>
|
|
58
36
|
);
|
|
59
|
-
await
|
|
37
|
+
await waitForLoad(rendered);
|
|
60
38
|
|
|
61
|
-
await
|
|
62
|
-
userEvent.click(getByRole("option", { name: /param1/i }));
|
|
63
|
-
});
|
|
39
|
+
await user.click(rendered.getByRole("option", { name: /param1/i }));
|
|
64
40
|
|
|
65
41
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
66
42
|
params: [
|
|
@@ -73,33 +49,29 @@ describe("<ParamSelector />", () => {
|
|
|
73
49
|
test: { value: { id: 1 } },
|
|
74
50
|
});
|
|
75
51
|
|
|
76
|
-
expect(container).toMatchSnapshot();
|
|
52
|
+
expect(rendered.container).toMatchSnapshot();
|
|
77
53
|
});
|
|
78
54
|
|
|
79
55
|
it("deleting param will clean field", async () => {
|
|
56
|
+
const user = userEvent.setup({ delay: null, skipHover: true });
|
|
80
57
|
const watcher = jest.fn();
|
|
81
|
-
|
|
82
58
|
const defaultValues = {
|
|
83
59
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
84
60
|
};
|
|
85
61
|
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
</TestFormWrapper>,
|
|
96
|
-
renderOpts
|
|
97
|
-
);
|
|
98
|
-
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
99
|
-
|
|
100
|
-
await act(async () =>
|
|
101
|
-
userEvent.click(await getByRole("option", { name: /param1/i }))
|
|
62
|
+
const rendered = render(
|
|
63
|
+
<TestFormWrapper
|
|
64
|
+
watcher={watcher}
|
|
65
|
+
context={{ type: "boolean" }}
|
|
66
|
+
defaultValues={defaultValues}
|
|
67
|
+
>
|
|
68
|
+
<FunctionParams />
|
|
69
|
+
<ParamSelector />
|
|
70
|
+
</TestFormWrapper>
|
|
102
71
|
);
|
|
72
|
+
await waitForLoad(rendered);
|
|
73
|
+
|
|
74
|
+
await user.click(rendered.getByRole("option", { name: /param1/i }));
|
|
103
75
|
|
|
104
76
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
105
77
|
params: [
|
|
@@ -112,16 +84,14 @@ describe("<ParamSelector />", () => {
|
|
|
112
84
|
test: { value: { id: 1 } },
|
|
113
85
|
});
|
|
114
86
|
|
|
115
|
-
await
|
|
116
|
-
|
|
117
|
-
userEvent.click(getAllByRole("button")[0]);
|
|
118
|
-
});
|
|
87
|
+
await user.hover(rendered.getByRole("textbox"));
|
|
88
|
+
await user.click(rendered.getAllByRole("button")[0]);
|
|
119
89
|
|
|
120
90
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
121
91
|
params: [],
|
|
122
92
|
test: { value: null },
|
|
123
93
|
});
|
|
124
94
|
|
|
125
|
-
expect(container).toMatchSnapshot();
|
|
95
|
+
expect(rendered.container).toMatchSnapshot();
|
|
126
96
|
});
|
|
127
97
|
});
|
|
@@ -1,57 +1,43 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { waitFor } from "@testing-library/react";
|
|
3
|
-
import { render } from "@truedat/test/render";
|
|
4
1
|
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
5
3
|
import TestFormWrapper from "@truedat/qx/components/common/TestFormWrapper";
|
|
6
4
|
import ShapeSelector from "../ShapeSelector";
|
|
7
5
|
|
|
8
|
-
const renderOpts = {
|
|
9
|
-
messages: {
|
|
10
|
-
en: {
|
|
11
|
-
"functions.expression.shape.function": "function",
|
|
12
|
-
"functions.expression.shape.constant": "constant",
|
|
13
|
-
"functions.expression.shape.param": "param",
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
fallback: "loading",
|
|
17
|
-
};
|
|
18
|
-
|
|
19
6
|
describe("<ShapeSelector />", () => {
|
|
20
7
|
it("matches the latest snapshot", async () => {
|
|
21
8
|
const defaultValues = {
|
|
22
9
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
23
10
|
};
|
|
24
|
-
const
|
|
11
|
+
const rendered = render(
|
|
25
12
|
<TestFormWrapper defaultValues={defaultValues}>
|
|
26
13
|
<ShapeSelector />
|
|
27
|
-
</TestFormWrapper
|
|
28
|
-
renderOpts
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
await waitFor(() =>
|
|
32
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
14
|
+
</TestFormWrapper>
|
|
33
15
|
);
|
|
34
|
-
|
|
16
|
+
await waitForLoad(rendered);
|
|
17
|
+
expect(rendered.container).toMatchSnapshot();
|
|
35
18
|
});
|
|
36
19
|
it("user interaction select param", async () => {
|
|
20
|
+
const user = userEvent.setup({ delay: null });
|
|
37
21
|
const watcher = jest.fn();
|
|
38
22
|
const defaultValues = {
|
|
39
23
|
params: [{ name: "param1", type: "boolean", id: 1 }],
|
|
40
24
|
};
|
|
41
|
-
|
|
25
|
+
|
|
26
|
+
const rendered = render(
|
|
42
27
|
<TestFormWrapper
|
|
43
28
|
watcher={watcher}
|
|
44
29
|
context={{ type: "boolean" }}
|
|
45
30
|
defaultValues={defaultValues}
|
|
46
31
|
>
|
|
47
32
|
<ShapeSelector />
|
|
48
|
-
</TestFormWrapper
|
|
49
|
-
renderOpts
|
|
33
|
+
</TestFormWrapper>
|
|
50
34
|
);
|
|
51
|
-
await
|
|
52
|
-
|
|
35
|
+
await waitForLoad(rendered);
|
|
36
|
+
|
|
37
|
+
await user.click(
|
|
38
|
+
await rendered.findByRole("option", { name: /expression.shape.param/i })
|
|
53
39
|
);
|
|
54
|
-
|
|
40
|
+
|
|
55
41
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
56
42
|
params: [
|
|
57
43
|
{
|
|
@@ -62,40 +48,53 @@ describe("<ShapeSelector />", () => {
|
|
|
62
48
|
],
|
|
63
49
|
test: { shape: "param", value: { isCondition: undefined } },
|
|
64
50
|
});
|
|
65
|
-
|
|
51
|
+
|
|
52
|
+
expect(rendered.container).toMatchSnapshot();
|
|
66
53
|
});
|
|
67
54
|
it("user interaction select constant", async () => {
|
|
55
|
+
const user = userEvent.setup({ delay: null });
|
|
68
56
|
const watcher = jest.fn();
|
|
69
|
-
|
|
57
|
+
|
|
58
|
+
const rendered = render(
|
|
70
59
|
<TestFormWrapper watcher={watcher} context={{ type: "boolean" }}>
|
|
71
60
|
<ShapeSelector />
|
|
72
|
-
</TestFormWrapper
|
|
73
|
-
renderOpts
|
|
61
|
+
</TestFormWrapper>
|
|
74
62
|
);
|
|
75
|
-
await
|
|
76
|
-
|
|
63
|
+
await waitForLoad(rendered);
|
|
64
|
+
|
|
65
|
+
await user.click(
|
|
66
|
+
await rendered.findByRole("option", {
|
|
67
|
+
name: /expression.shape.constant/i,
|
|
68
|
+
})
|
|
77
69
|
);
|
|
78
|
-
|
|
70
|
+
|
|
79
71
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
80
72
|
test: { shape: "constant", value: { isCondition: undefined } },
|
|
81
73
|
});
|
|
82
|
-
|
|
74
|
+
|
|
75
|
+
expect(rendered.container).toMatchSnapshot();
|
|
83
76
|
});
|
|
84
77
|
it("user interaction select function", async () => {
|
|
78
|
+
const user = userEvent.setup({ delay: null });
|
|
85
79
|
const watcher = jest.fn();
|
|
86
|
-
|
|
80
|
+
|
|
81
|
+
const rendered = render(
|
|
87
82
|
<TestFormWrapper watcher={watcher} context={{ type: "boolean" }}>
|
|
88
83
|
<ShapeSelector />
|
|
89
|
-
</TestFormWrapper
|
|
90
|
-
renderOpts
|
|
84
|
+
</TestFormWrapper>
|
|
91
85
|
);
|
|
92
|
-
await
|
|
93
|
-
|
|
86
|
+
await waitForLoad(rendered);
|
|
87
|
+
|
|
88
|
+
await user.click(
|
|
89
|
+
await rendered.findByRole("option", {
|
|
90
|
+
name: /expression.shape.function/i,
|
|
91
|
+
})
|
|
94
92
|
);
|
|
95
|
-
|
|
93
|
+
|
|
96
94
|
expect(watcher).toHaveBeenLastCalledWith({
|
|
97
95
|
test: { shape: "function", value: { isCondition: undefined } },
|
|
98
96
|
});
|
|
99
|
-
|
|
97
|
+
|
|
98
|
+
expect(rendered.container).toMatchSnapshot();
|
|
100
99
|
});
|
|
101
100
|
});
|
|
@@ -49,7 +49,7 @@ exports[`<Condition /> matches the latest snapshot 1`] = `
|
|
|
49
49
|
</code>
|
|
50
50
|
</b>
|
|
51
51
|
</small>
|
|
52
|
-
|
|
52
|
+
functions.expression.shape.constant
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
55
|
<div
|
|
@@ -71,7 +71,7 @@ exports[`<Condition /> matches the latest snapshot 1`] = `
|
|
|
71
71
|
</code>
|
|
72
72
|
</b>
|
|
73
73
|
</small>
|
|
74
|
-
|
|
74
|
+
functions.expression.shape.function
|
|
75
75
|
</div>
|
|
76
76
|
</div>
|
|
77
77
|
</div>
|
|
@@ -96,7 +96,7 @@ exports[`<Condition /> matches the latest snapshot 1`] = `
|
|
|
96
96
|
class="condition-operator-trigger"
|
|
97
97
|
>
|
|
98
98
|
<span>
|
|
99
|
-
|
|
99
|
+
expression.condition.selectFunction
|
|
100
100
|
</span>
|
|
101
101
|
</div>
|
|
102
102
|
<div
|
|
@@ -112,7 +112,7 @@ exports[`<Condition /> matches the latest snapshot 1`] = `
|
|
|
112
112
|
<span
|
|
113
113
|
class="text"
|
|
114
114
|
>
|
|
115
|
-
|
|
115
|
+
expression.condition.customExpression
|
|
116
116
|
</span>
|
|
117
117
|
</div>
|
|
118
118
|
</div>
|
|
@@ -162,7 +162,7 @@ exports[`<Condition /> matches the latest snapshot 1`] = `
|
|
|
162
162
|
</code>
|
|
163
163
|
</b>
|
|
164
164
|
</small>
|
|
165
|
-
|
|
165
|
+
functions.expression.shape.constant
|
|
166
166
|
</div>
|
|
167
167
|
</div>
|
|
168
168
|
<div
|
|
@@ -184,7 +184,7 @@ exports[`<Condition /> matches the latest snapshot 1`] = `
|
|
|
184
184
|
</code>
|
|
185
185
|
</b>
|
|
186
186
|
</small>
|
|
187
|
-
|
|
187
|
+
functions.expression.shape.function
|
|
188
188
|
</div>
|
|
189
189
|
</div>
|
|
190
190
|
</div>
|
package/src/components/common/expressions/__tests__/__snapshots__/ConstantSelector.spec.js.snap
CHANGED
|
@@ -12,7 +12,6 @@ exports[`<ConstantSelector /> matches the latest snapshot 1`] = `
|
|
|
12
12
|
autocomplete="off"
|
|
13
13
|
required=""
|
|
14
14
|
type="text"
|
|
15
|
-
value=""
|
|
16
15
|
/>
|
|
17
16
|
</div>
|
|
18
17
|
</div>
|
|
@@ -35,7 +34,7 @@ exports[`<ConstantSelector /> user interaction 1`] = `
|
|
|
35
34
|
class="divider text"
|
|
36
35
|
role="alert"
|
|
37
36
|
>
|
|
38
|
-
string
|
|
37
|
+
expressions.data_type.string
|
|
39
38
|
</div>
|
|
40
39
|
<i
|
|
41
40
|
aria-hidden="true"
|
|
@@ -58,7 +57,7 @@ exports[`<ConstantSelector /> user interaction 1`] = `
|
|
|
58
57
|
<span
|
|
59
58
|
class="text"
|
|
60
59
|
>
|
|
61
|
-
boolean
|
|
60
|
+
expressions.data_type.boolean
|
|
62
61
|
</span>
|
|
63
62
|
</div>
|
|
64
63
|
<div
|
|
@@ -75,7 +74,7 @@ exports[`<ConstantSelector /> user interaction 1`] = `
|
|
|
75
74
|
<span
|
|
76
75
|
class="text"
|
|
77
76
|
>
|
|
78
|
-
string
|
|
77
|
+
expressions.data_type.string
|
|
79
78
|
</span>
|
|
80
79
|
</div>
|
|
81
80
|
<div
|
|
@@ -92,7 +91,7 @@ exports[`<ConstantSelector /> user interaction 1`] = `
|
|
|
92
91
|
<span
|
|
93
92
|
class="text"
|
|
94
93
|
>
|
|
95
|
-
number
|
|
94
|
+
expressions.data_type.number
|
|
96
95
|
</span>
|
|
97
96
|
</div>
|
|
98
97
|
<div
|
|
@@ -109,7 +108,7 @@ exports[`<ConstantSelector /> user interaction 1`] = `
|
|
|
109
108
|
<span
|
|
110
109
|
class="text"
|
|
111
110
|
>
|
|
112
|
-
date
|
|
111
|
+
expressions.data_type.date
|
|
113
112
|
</span>
|
|
114
113
|
</div>
|
|
115
114
|
<div
|
|
@@ -126,7 +125,7 @@ exports[`<ConstantSelector /> user interaction 1`] = `
|
|
|
126
125
|
<span
|
|
127
126
|
class="text"
|
|
128
127
|
>
|
|
129
|
-
timestamp
|
|
128
|
+
expressions.data_type.timestamp
|
|
130
129
|
</span>
|
|
131
130
|
</div>
|
|
132
131
|
</div>
|
|
@@ -42,7 +42,7 @@ exports[`<Expression /> matches the latest snapshot 1`] = `
|
|
|
42
42
|
</code>
|
|
43
43
|
</b>
|
|
44
44
|
</small>
|
|
45
|
-
constant
|
|
45
|
+
functions.expression.shape.constant
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
<div
|
|
@@ -64,7 +64,7 @@ exports[`<Expression /> matches the latest snapshot 1`] = `
|
|
|
64
64
|
</code>
|
|
65
65
|
</b>
|
|
66
66
|
</small>
|
|
67
|
-
function
|
|
67
|
+
functions.expression.shape.function
|
|
68
68
|
</div>
|
|
69
69
|
</div>
|
|
70
70
|
</div>
|
|
@@ -119,7 +119,7 @@ exports[`<Expression /> shape constant expression 1`] = `
|
|
|
119
119
|
</code>
|
|
120
120
|
</b>
|
|
121
121
|
</small>
|
|
122
|
-
constant
|
|
122
|
+
functions.expression.shape.constant
|
|
123
123
|
</div>
|
|
124
124
|
</div>
|
|
125
125
|
<div
|
|
@@ -141,7 +141,7 @@ exports[`<Expression /> shape constant expression 1`] = `
|
|
|
141
141
|
</code>
|
|
142
142
|
</b>
|
|
143
143
|
</small>
|
|
144
|
-
function
|
|
144
|
+
functions.expression.shape.function
|
|
145
145
|
</div>
|
|
146
146
|
</div>
|
|
147
147
|
</div>
|
|
@@ -169,7 +169,7 @@ exports[`<Expression /> shape constant expression 1`] = `
|
|
|
169
169
|
<span
|
|
170
170
|
class="text"
|
|
171
171
|
>
|
|
172
|
-
true
|
|
172
|
+
functions.expression.constant.true
|
|
173
173
|
</span>
|
|
174
174
|
</div>
|
|
175
175
|
<div
|
|
@@ -182,7 +182,7 @@ exports[`<Expression /> shape constant expression 1`] = `
|
|
|
182
182
|
<span
|
|
183
183
|
class="text"
|
|
184
184
|
>
|
|
185
|
-
false
|
|
185
|
+
functions.expression.constant.false
|
|
186
186
|
</span>
|
|
187
187
|
</div>
|
|
188
188
|
</div>
|
|
@@ -238,7 +238,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
238
238
|
</code>
|
|
239
239
|
</b>
|
|
240
240
|
</small>
|
|
241
|
-
constant
|
|
241
|
+
functions.expression.shape.constant
|
|
242
242
|
</div>
|
|
243
243
|
</div>
|
|
244
244
|
<div
|
|
@@ -260,7 +260,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
260
260
|
</code>
|
|
261
261
|
</b>
|
|
262
262
|
</small>
|
|
263
|
-
function
|
|
263
|
+
functions.expression.shape.function
|
|
264
264
|
</div>
|
|
265
265
|
</div>
|
|
266
266
|
</div>
|
|
@@ -279,8 +279,8 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
279
279
|
class="dropdown icon"
|
|
280
280
|
/>
|
|
281
281
|
<div
|
|
282
|
-
aria-expanded="
|
|
283
|
-
class="ui
|
|
282
|
+
aria-expanded="false"
|
|
283
|
+
class="ui fluid search selection dropdown"
|
|
284
284
|
role="combobox"
|
|
285
285
|
>
|
|
286
286
|
<input
|
|
@@ -304,7 +304,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
304
304
|
class="dropdown icon"
|
|
305
305
|
/>
|
|
306
306
|
<div
|
|
307
|
-
class="
|
|
307
|
+
class="menu transition"
|
|
308
308
|
role="listbox"
|
|
309
309
|
>
|
|
310
310
|
<div
|
|
@@ -427,7 +427,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
427
427
|
</code>
|
|
428
428
|
</b>
|
|
429
429
|
</small>
|
|
430
|
-
constant
|
|
430
|
+
functions.expression.shape.constant
|
|
431
431
|
</div>
|
|
432
432
|
</div>
|
|
433
433
|
<div
|
|
@@ -449,7 +449,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
449
449
|
</code>
|
|
450
450
|
</b>
|
|
451
451
|
</small>
|
|
452
|
-
function
|
|
452
|
+
functions.expression.shape.function
|
|
453
453
|
</div>
|
|
454
454
|
</div>
|
|
455
455
|
</div>
|
|
@@ -486,7 +486,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
486
486
|
class="divider text"
|
|
487
487
|
role="alert"
|
|
488
488
|
>
|
|
489
|
-
function.placeholder
|
|
489
|
+
functions.form.expression.function.placeholder
|
|
490
490
|
</div>
|
|
491
491
|
<i
|
|
492
492
|
aria-hidden="true"
|
|
@@ -619,7 +619,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
619
619
|
</code>
|
|
620
620
|
</b>
|
|
621
621
|
</small>
|
|
622
|
-
constant
|
|
622
|
+
functions.expression.shape.constant
|
|
623
623
|
</div>
|
|
624
624
|
</div>
|
|
625
625
|
<div
|
|
@@ -641,7 +641,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
641
641
|
</code>
|
|
642
642
|
</b>
|
|
643
643
|
</small>
|
|
644
|
-
function
|
|
644
|
+
functions.expression.shape.function
|
|
645
645
|
</div>
|
|
646
646
|
</div>
|
|
647
647
|
</div>
|
|
@@ -678,7 +678,7 @@ exports[`<Expression /> shape function expression 1`] = `
|
|
|
678
678
|
class="divider text"
|
|
679
679
|
role="alert"
|
|
680
680
|
>
|
|
681
|
-
function.placeholder
|
|
681
|
+
functions.form.expression.function.placeholder
|
|
682
682
|
</div>
|
|
683
683
|
<i
|
|
684
684
|
aria-hidden="true"
|
|
@@ -798,7 +798,7 @@ exports[`<Expression /> shape param expression 1`] = `
|
|
|
798
798
|
</code>
|
|
799
799
|
</b>
|
|
800
800
|
</small>
|
|
801
|
-
constant
|
|
801
|
+
functions.expression.shape.constant
|
|
802
802
|
</div>
|
|
803
803
|
</div>
|
|
804
804
|
<div
|
|
@@ -820,7 +820,7 @@ exports[`<Expression /> shape param expression 1`] = `
|
|
|
820
820
|
</code>
|
|
821
821
|
</b>
|
|
822
822
|
</small>
|
|
823
|
-
function
|
|
823
|
+
functions.expression.shape.function
|
|
824
824
|
</div>
|
|
825
825
|
</div>
|
|
826
826
|
<div
|
|
@@ -842,7 +842,7 @@ exports[`<Expression /> shape param expression 1`] = `
|
|
|
842
842
|
</code>
|
|
843
843
|
</b>
|
|
844
844
|
</small>
|
|
845
|
-
param
|
|
845
|
+
functions.expression.shape.param
|
|
846
846
|
</div>
|
|
847
847
|
</div>
|
|
848
848
|
</div>
|
|
@@ -6,7 +6,6 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
6
6
|
<div>
|
|
7
7
|
<ul
|
|
8
8
|
class="function-tree"
|
|
9
|
-
style=""
|
|
10
9
|
>
|
|
11
10
|
<li>
|
|
12
11
|
<div
|
|
@@ -74,7 +73,7 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
74
73
|
</code>
|
|
75
74
|
</b>
|
|
76
75
|
</small>
|
|
77
|
-
constant
|
|
76
|
+
functions.expression.shape.constant
|
|
78
77
|
</div>
|
|
79
78
|
</div>
|
|
80
79
|
<div
|
|
@@ -96,7 +95,7 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
96
95
|
</code>
|
|
97
96
|
</b>
|
|
98
97
|
</small>
|
|
99
|
-
function
|
|
98
|
+
functions.expression.shape.function
|
|
100
99
|
</div>
|
|
101
100
|
</div>
|
|
102
101
|
</div>
|
|
@@ -113,7 +112,7 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
113
112
|
class="divider text"
|
|
114
113
|
role="alert"
|
|
115
114
|
>
|
|
116
|
-
true
|
|
115
|
+
functions.expression.constant.true
|
|
117
116
|
</div>
|
|
118
117
|
<i
|
|
119
118
|
aria-hidden="true"
|
|
@@ -132,7 +131,7 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
132
131
|
<span
|
|
133
132
|
class="text"
|
|
134
133
|
>
|
|
135
|
-
true
|
|
134
|
+
functions.expression.constant.true
|
|
136
135
|
</span>
|
|
137
136
|
</div>
|
|
138
137
|
<div
|
|
@@ -145,7 +144,7 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
145
144
|
<span
|
|
146
145
|
class="text"
|
|
147
146
|
>
|
|
148
|
-
false
|
|
147
|
+
functions.expression.constant.false
|
|
149
148
|
</span>
|
|
150
149
|
</div>
|
|
151
150
|
</div>
|
|
@@ -221,7 +220,7 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
221
220
|
</code>
|
|
222
221
|
</b>
|
|
223
222
|
</small>
|
|
224
|
-
constant
|
|
223
|
+
functions.expression.shape.constant
|
|
225
224
|
</div>
|
|
226
225
|
</div>
|
|
227
226
|
<div
|
|
@@ -243,7 +242,7 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
243
242
|
</code>
|
|
244
243
|
</b>
|
|
245
244
|
</small>
|
|
246
|
-
function
|
|
245
|
+
functions.expression.shape.function
|
|
247
246
|
</div>
|
|
248
247
|
</div>
|
|
249
248
|
</div>
|
|
@@ -280,7 +279,7 @@ exports[`<FunctionArgs /> user interaction 1`] = `
|
|
|
280
279
|
class="divider text"
|
|
281
280
|
role="alert"
|
|
282
281
|
>
|
|
283
|
-
function.placeholder
|
|
282
|
+
functions.form.expression.function.placeholder
|
|
284
283
|
</div>
|
|
285
284
|
<i
|
|
286
285
|
aria-hidden="true"
|