@truedat/bg 4.44.4 → 4.44.5
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/CHANGELOG.md +6 -0
- package/package.json +21 -18
- package/src/concepts/components/ConceptFiltersDefault.js +1 -5
- package/src/concepts/components/ConceptFiltersPublished.js +1 -5
- package/src/concepts/components/ConceptForm.js +24 -68
- package/src/concepts/components/__tests__/ConceptFilters.spec.js +10 -4
- package/src/concepts/components/__tests__/ConceptForm.spec.js +32 -99
- package/src/concepts/components/__tests__/ConceptsLabelResults.spec.js +3 -3
- package/src/concepts/components/__tests__/__snapshots__/ConceptFilters.spec.js.snap +43 -10
- package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +79 -79
- package/src/concepts/components/__tests__/__snapshots__/ConceptsLabelResults.spec.js.snap +7 -12
- package/src/taxonomy/components/__tests__/DomainActions.spec.js +3 -3
- package/src/taxonomy/components/__tests__/DomainCrumbs.spec.js +4 -4
- package/src/taxonomy/components/__tests__/__snapshots__/DomainActions.spec.js.snap +5 -10
- package/src/taxonomy/components/__tests__/__snapshots__/DomainCrumbs.spec.js.snap +37 -74
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/bg",
|
|
3
|
-
"version": "4.44.
|
|
3
|
+
"version": "4.44.5",
|
|
4
4
|
"description": "Truedat Web Business Glossary",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -22,20 +22,20 @@
|
|
|
22
22
|
"eslint:fix": "eslint --fix src/**"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@babel/cli": "^7.
|
|
26
|
-
"@babel/core": "^7.
|
|
27
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
28
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.
|
|
29
|
-
"@babel/plugin-proposal-optional-chaining": "^7.
|
|
25
|
+
"@babel/cli": "^7.17.10",
|
|
26
|
+
"@babel/core": "^7.18.0",
|
|
27
|
+
"@babel/plugin-proposal-class-properties": "^7.17.12",
|
|
28
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.18.0",
|
|
29
|
+
"@babel/plugin-proposal-optional-chaining": "^7.17.12",
|
|
30
30
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
31
|
-
"@babel/plugin-transform-modules-commonjs": "^7.
|
|
32
|
-
"@babel/preset-env": "^7.
|
|
33
|
-
"@babel/preset-react": "^7.
|
|
34
|
-
"@testing-library/jest-dom": "^5.
|
|
31
|
+
"@babel/plugin-transform-modules-commonjs": "^7.18.0",
|
|
32
|
+
"@babel/preset-env": "^7.18.0",
|
|
33
|
+
"@babel/preset-react": "^7.17.12",
|
|
34
|
+
"@testing-library/jest-dom": "^5.16.4",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.44.
|
|
38
|
-
"babel-jest": "^
|
|
37
|
+
"@truedat/test": "4.44.5",
|
|
38
|
+
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
41
41
|
"babel-plugin-react-intl": "^5.1.18",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"enzyme": "^3.11.0",
|
|
44
44
|
"enzyme-to-json": "^3.6.2",
|
|
45
45
|
"identity-obj-proxy": "^3.0.0",
|
|
46
|
-
"jest": "^
|
|
46
|
+
"jest": "^28.1.0",
|
|
47
|
+
"jest-environment-jsdom": "^28.1.0",
|
|
47
48
|
"react": "^16.14.0",
|
|
48
49
|
"react-dom": "^16.14.0",
|
|
49
50
|
"redux-saga-test-plan": "^4.0.4",
|
|
@@ -51,6 +52,8 @@
|
|
|
51
52
|
"semantic-ui-react": "^2.0.3"
|
|
52
53
|
},
|
|
53
54
|
"jest": {
|
|
55
|
+
"maxWorkers": "50%",
|
|
56
|
+
"testTimeout": 10000,
|
|
54
57
|
"moduleDirectories": [
|
|
55
58
|
"<rootDir>/src",
|
|
56
59
|
"../../node_modules"
|
|
@@ -83,15 +86,15 @@
|
|
|
83
86
|
]
|
|
84
87
|
},
|
|
85
88
|
"dependencies": {
|
|
86
|
-
"@truedat/core": "4.44.
|
|
87
|
-
"@truedat/df": "4.44.
|
|
89
|
+
"@truedat/core": "4.44.5",
|
|
90
|
+
"@truedat/df": "4.44.5",
|
|
88
91
|
"file-saver": "^2.0.5",
|
|
89
92
|
"moment": "^2.24.0",
|
|
90
93
|
"path-to-regexp": "^1.7.0",
|
|
91
|
-
"prop-types": "^15.
|
|
94
|
+
"prop-types": "^15.8.1",
|
|
92
95
|
"react-hook-form": "^7.30.0",
|
|
93
96
|
"react-intl": "^5.20.10",
|
|
94
|
-
"react-moment": "^
|
|
97
|
+
"react-moment": "^1.1.2",
|
|
95
98
|
"react-redux": "^7.2.4",
|
|
96
99
|
"react-router-dom": "^5.2.0",
|
|
97
100
|
"redux": "^4.1.1",
|
|
@@ -104,5 +107,5 @@
|
|
|
104
107
|
"react-dom": ">= 16.8.6 < 17",
|
|
105
108
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
106
109
|
},
|
|
107
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "5a339468198c803592b285eddd0dd0c0b0eced93"
|
|
108
111
|
}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { bindActionCreators } from "redux";
|
|
3
2
|
import { connect } from "react-redux";
|
|
3
|
+
import { AvailableFilters } from "@truedat/core/components";
|
|
4
4
|
import { addConceptFilter, resetConceptFilters } from "../routines";
|
|
5
5
|
import { getConceptAvailableFilters } from "../selectors";
|
|
6
6
|
|
|
7
|
-
const AvailableFilters = React.lazy(() =>
|
|
8
|
-
import("@truedat/core/components/AvailableFilters")
|
|
9
|
-
);
|
|
10
|
-
|
|
11
7
|
const mapStateToProps = (state) => ({
|
|
12
8
|
filters: getConceptAvailableFilters(state),
|
|
13
9
|
disabled: state.conceptFiltersLoading,
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import { connect } from "react-redux";
|
|
4
3
|
import { bindActionCreators } from "redux";
|
|
4
|
+
import { AvailableFilters } from "@truedat/core/components";
|
|
5
5
|
import { addConceptFilter, resetConceptFilters } from "../routines";
|
|
6
6
|
import { getConceptAvailableFilters } from "../selectors";
|
|
7
7
|
|
|
8
|
-
const AvailableFilters = React.lazy(() =>
|
|
9
|
-
import("@truedat/core/components/AvailableFilters")
|
|
10
|
-
);
|
|
11
|
-
|
|
12
8
|
const mapStateToProps = (state) => ({
|
|
13
9
|
filters: _.flow(getConceptAvailableFilters, _.without(["status"]))(state),
|
|
14
10
|
disabled: state.conceptFiltersLoading,
|
|
@@ -13,14 +13,12 @@ import {
|
|
|
13
13
|
import { compose } from "redux";
|
|
14
14
|
import { connect } from "react-redux";
|
|
15
15
|
import { injectIntl, FormattedMessage } from "react-intl";
|
|
16
|
-
import { HistoryBackButton
|
|
17
|
-
import { selectDomain } from "@truedat/df/routines";
|
|
18
|
-
import { applyTemplate } from "@truedat/df/utils";
|
|
16
|
+
import { HistoryBackButton } from "@truedat/core/components";
|
|
19
17
|
import { conceptAction } from "../routines";
|
|
20
18
|
import DomainDropdownSelector from "../../taxonomy/components/DomainDropdownSelector";
|
|
21
19
|
|
|
22
|
-
const
|
|
23
|
-
import("@truedat/df/components/
|
|
20
|
+
const SelectableDynamicForm = React.lazy(() =>
|
|
21
|
+
import("@truedat/df/components/SelectableDynamicForm")
|
|
24
22
|
);
|
|
25
23
|
|
|
26
24
|
const RichTextEditor = React.lazy(() =>
|
|
@@ -35,8 +33,6 @@ const initialState = {
|
|
|
35
33
|
name: "",
|
|
36
34
|
description: {},
|
|
37
35
|
content: {},
|
|
38
|
-
templatesLoading: true,
|
|
39
|
-
template: null,
|
|
40
36
|
};
|
|
41
37
|
|
|
42
38
|
const isNonEmptyString = _.flow(_.trim, _.negate(_.isEmpty));
|
|
@@ -44,6 +40,7 @@ const isValid = _.conforms({
|
|
|
44
40
|
name: isNonEmptyString,
|
|
45
41
|
domain_id: _.isFinite,
|
|
46
42
|
description: _.negate(_.isEmpty),
|
|
43
|
+
type: isNonEmptyString,
|
|
47
44
|
});
|
|
48
45
|
|
|
49
46
|
export class ConceptForm extends React.Component {
|
|
@@ -52,41 +49,12 @@ export class ConceptForm extends React.Component {
|
|
|
52
49
|
conceptAction: PropTypes.func,
|
|
53
50
|
conceptActionLoading: PropTypes.string,
|
|
54
51
|
intl: PropTypes.object,
|
|
55
|
-
selectDomain: PropTypes.func,
|
|
56
52
|
};
|
|
57
53
|
|
|
58
54
|
state = initialState;
|
|
59
55
|
|
|
60
|
-
|
|
61
|
-
const { type: name, content, domain_id } = this.state;
|
|
62
|
-
const template = name
|
|
63
|
-
? _.find(_.propEq("name", name))(templates)
|
|
64
|
-
: _.size(templates) == 1
|
|
65
|
-
? templates[0]
|
|
66
|
-
: null;
|
|
67
|
-
this.setState({
|
|
68
|
-
template,
|
|
69
|
-
templatesLoading: false,
|
|
70
|
-
type: template?.name || null,
|
|
71
|
-
content: template ? applyTemplate(template)(content, domain_id) : {},
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
handleTemplateSelected = (e, { template }) => {
|
|
76
|
-
const { content, domain_id } = this.state;
|
|
77
|
-
this.setState({
|
|
78
|
-
template,
|
|
79
|
-
type: template?.name || null,
|
|
80
|
-
content: template ? applyTemplate(template)(content, domain_id) : {},
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
handleDomainSelected = (e, { value }) => {
|
|
56
|
+
handleDomainSelected = (_e, { value }) => {
|
|
85
57
|
const domain_id = value;
|
|
86
|
-
|
|
87
|
-
const { selectDomain } = this.props;
|
|
88
|
-
selectDomain({ id: domain_id });
|
|
89
|
-
|
|
90
58
|
this.setState({ domain_id });
|
|
91
59
|
};
|
|
92
60
|
|
|
@@ -102,29 +70,24 @@ export class ConceptForm extends React.Component {
|
|
|
102
70
|
}
|
|
103
71
|
};
|
|
104
72
|
|
|
105
|
-
handleContentChange = (content) => {
|
|
106
|
-
this.setState({ content });
|
|
107
|
-
};
|
|
73
|
+
handleContentChange = ({ content }) => this.setState({ content });
|
|
108
74
|
|
|
109
75
|
isInvalid = () => _.negate(isValid)(this.state);
|
|
110
76
|
|
|
111
77
|
handleSubmit = (e) => {
|
|
112
78
|
e.preventDefault();
|
|
113
79
|
const { action, conceptAction } = this.props;
|
|
114
|
-
const
|
|
80
|
+
const business_concept_version = _.pick([
|
|
115
81
|
"domain_id",
|
|
116
82
|
"type",
|
|
83
|
+
"content",
|
|
117
84
|
...staticFields,
|
|
118
85
|
])(this.state);
|
|
119
|
-
const { template, content, domain_id } = this.state;
|
|
120
86
|
|
|
121
87
|
conceptAction({
|
|
122
88
|
action: actionKey,
|
|
123
89
|
...action,
|
|
124
|
-
business_concept_version
|
|
125
|
-
...businessConceptVersion,
|
|
126
|
-
content: applyTemplate(template)(content, domain_id),
|
|
127
|
-
},
|
|
90
|
+
business_concept_version,
|
|
128
91
|
});
|
|
129
92
|
};
|
|
130
93
|
|
|
@@ -135,12 +98,10 @@ export class ConceptForm extends React.Component {
|
|
|
135
98
|
intl: { formatMessage },
|
|
136
99
|
} = this.props;
|
|
137
100
|
|
|
138
|
-
const { name, description, content,
|
|
139
|
-
this.state;
|
|
101
|
+
const { name, description, content, type, domain_id } = this.state;
|
|
140
102
|
|
|
141
103
|
const loading =
|
|
142
|
-
|
|
143
|
-
(action && action.href && conceptActionLoading === action.href);
|
|
104
|
+
action && action.href && conceptActionLoading === action.href;
|
|
144
105
|
|
|
145
106
|
return (
|
|
146
107
|
<Container as={Segment} text>
|
|
@@ -157,16 +118,9 @@ export class ConceptForm extends React.Component {
|
|
|
157
118
|
/>
|
|
158
119
|
<DomainDropdownSelector
|
|
159
120
|
name="domain"
|
|
160
|
-
invalid={!_.isFinite(
|
|
121
|
+
invalid={!_.isFinite(domain_id)}
|
|
161
122
|
onChange={this.handleDomainSelected}
|
|
162
123
|
/>
|
|
163
|
-
<TemplateSelector
|
|
164
|
-
scope="bg"
|
|
165
|
-
selectedValue={template?.id}
|
|
166
|
-
onLoad={this.handleTemplatesLoaded}
|
|
167
|
-
onChange={this.handleTemplateSelected}
|
|
168
|
-
required
|
|
169
|
-
/>
|
|
170
124
|
<Form.Field required>
|
|
171
125
|
<label>
|
|
172
126
|
<FormattedMessage id="concepts.props.name" />
|
|
@@ -193,21 +147,23 @@ export class ConceptForm extends React.Component {
|
|
|
193
147
|
onChange={this.handleEditorChange}
|
|
194
148
|
/>
|
|
195
149
|
</Form.Field>
|
|
196
|
-
|
|
197
|
-
|
|
150
|
+
<SelectableDynamicForm
|
|
151
|
+
scope="bg"
|
|
152
|
+
domainIds={_.isNil(domain_id) ? null : [domain_id]}
|
|
153
|
+
required
|
|
154
|
+
header={
|
|
198
155
|
<Header
|
|
199
156
|
as="h3"
|
|
200
157
|
content={formatMessage({
|
|
201
158
|
id: "concepts.form.aditional_fields",
|
|
202
159
|
})}
|
|
203
160
|
/>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
) : null}
|
|
161
|
+
}
|
|
162
|
+
content={content}
|
|
163
|
+
name={type}
|
|
164
|
+
onChange={this.handleContentChange}
|
|
165
|
+
onNameChange={(type) => this.setState({ type })}
|
|
166
|
+
/>
|
|
211
167
|
<div className="actions">
|
|
212
168
|
<HistoryBackButton
|
|
213
169
|
content={formatMessage({ id: "actions.cancel" })}
|
|
@@ -232,5 +188,5 @@ const mapStateToProps = ({ conceptActionLoading, conceptsActions }) => ({
|
|
|
232
188
|
|
|
233
189
|
export default compose(
|
|
234
190
|
injectIntl,
|
|
235
|
-
connect(mapStateToProps, { conceptAction
|
|
191
|
+
connect(mapStateToProps, { conceptAction })
|
|
236
192
|
)(ConceptForm);
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
|
+
import ConceptFilters from "../ConceptFilters";
|
|
4
|
+
|
|
5
|
+
const state = {
|
|
6
|
+
conceptFilters: { domain_id: [1, 2], confidential: ["yes", "no"] },
|
|
7
|
+
conceptActiveFilters: { domain_id: [1] },
|
|
8
|
+
};
|
|
9
|
+
const renderOpts = { state };
|
|
4
10
|
|
|
5
11
|
describe("<ConceptFilters />", () => {
|
|
6
12
|
it("matches the latest snapshot", () => {
|
|
7
|
-
const
|
|
8
|
-
expect(
|
|
13
|
+
const { container } = render(<ConceptFilters />, renderOpts);
|
|
14
|
+
expect(container).toMatchSnapshot();
|
|
9
15
|
});
|
|
10
16
|
});
|
|
@@ -1,135 +1,68 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { waitFor } from "@testing-library/react";
|
|
3
3
|
import userEvent from "@testing-library/user-event";
|
|
4
|
-
import { TEMPLATES_QUERY } from "@truedat/core/api/queries";
|
|
5
4
|
import { render } from "@truedat/test/render";
|
|
5
|
+
import { multipleTemplatesMock, singleTemplateMock } from "@truedat/test/mocks";
|
|
6
6
|
import ConceptForm from "../ConceptForm";
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
scope: "remediation",
|
|
13
|
-
content: [
|
|
14
|
-
{
|
|
15
|
-
name: "g1",
|
|
16
|
-
fields: [{ name: "field1", label: "field1", placeholder: "field1" }],
|
|
17
|
-
},
|
|
18
|
-
],
|
|
8
|
+
const state = {
|
|
9
|
+
conceptActions: { create: {} },
|
|
10
|
+
conceptActionLoading: "",
|
|
11
|
+
domains: [{ id: 1, name: "domain1" }],
|
|
19
12
|
};
|
|
20
|
-
const
|
|
21
|
-
id: "2",
|
|
22
|
-
name: "template2",
|
|
23
|
-
label: "template2",
|
|
24
|
-
scope: "remediation",
|
|
25
|
-
content: {},
|
|
26
|
-
};
|
|
27
|
-
const makeRenderOpts = (templates) => ({
|
|
28
|
-
mocks: [
|
|
29
|
-
{
|
|
30
|
-
request: { query: TEMPLATES_QUERY, variables: { scope: "bg" } },
|
|
31
|
-
result: { data: { templates } },
|
|
32
|
-
},
|
|
33
|
-
],
|
|
34
|
-
state: {
|
|
35
|
-
conceptActions: { create: {} },
|
|
36
|
-
conceptActionLoading: "",
|
|
37
|
-
domains: [{ id: 1, name: "domain1" }],
|
|
38
|
-
},
|
|
39
|
-
});
|
|
13
|
+
const variables = { scope: "bg", domainIds: [1] };
|
|
40
14
|
|
|
41
15
|
describe("<ConceptForm />", () => {
|
|
42
16
|
describe("with multiple templates", () => {
|
|
43
|
-
const
|
|
44
|
-
|
|
17
|
+
const renderOpts = {
|
|
18
|
+
mocks: [multipleTemplatesMock(variables)],
|
|
19
|
+
state,
|
|
20
|
+
fallback: "lazy",
|
|
21
|
+
};
|
|
45
22
|
|
|
46
23
|
it("matches the latest snapshot", async () => {
|
|
47
|
-
const { container, queryByText } = render(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
</Suspense>,
|
|
51
|
-
renderOpts
|
|
24
|
+
const { container, queryByText } = render(<ConceptForm />, renderOpts);
|
|
25
|
+
await waitFor(() =>
|
|
26
|
+
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
52
27
|
);
|
|
53
|
-
await waitFor(() =>
|
|
54
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument();
|
|
55
|
-
});
|
|
28
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
56
29
|
expect(container).toMatchSnapshot();
|
|
57
30
|
});
|
|
58
31
|
|
|
59
|
-
it("contains one <TemplateSelector />", async () => {
|
|
60
|
-
const { queryByText } = render(
|
|
61
|
-
<Suspense fallback="loading...">
|
|
62
|
-
<ConceptForm />
|
|
63
|
-
</Suspense>,
|
|
64
|
-
renderOpts
|
|
65
|
-
);
|
|
66
|
-
await waitFor(() => {
|
|
67
|
-
expect(queryByText("template1")).toBeInTheDocument();
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
32
|
it("renders dynamic fields when template is selected", async () => {
|
|
72
33
|
const { findByText, getByText, queryByText } = render(
|
|
73
|
-
<
|
|
74
|
-
<ConceptForm />
|
|
75
|
-
</Suspense>,
|
|
34
|
+
<ConceptForm />,
|
|
76
35
|
renderOpts
|
|
77
36
|
);
|
|
78
|
-
await waitFor(() => {
|
|
79
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument();
|
|
80
|
-
});
|
|
81
37
|
userEvent.click(await findByText("template1"));
|
|
82
|
-
await waitFor(() =>
|
|
83
|
-
|
|
84
|
-
});
|
|
38
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
39
|
+
expect(getByText("field1")).toBeInTheDocument();
|
|
85
40
|
});
|
|
86
41
|
});
|
|
87
42
|
|
|
88
43
|
describe("with a single template", () => {
|
|
89
|
-
const
|
|
90
|
-
|
|
44
|
+
const renderOpts = {
|
|
45
|
+
mocks: [singleTemplateMock(variables)],
|
|
46
|
+
state,
|
|
47
|
+
fallback: "lazy",
|
|
48
|
+
};
|
|
91
49
|
|
|
92
50
|
it("matches the latest snapshot", async () => {
|
|
93
|
-
const { container, queryByText } = render(
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
</Suspense>,
|
|
97
|
-
renderOpts
|
|
51
|
+
const { container, queryByText } = render(<ConceptForm />, renderOpts);
|
|
52
|
+
await waitFor(() =>
|
|
53
|
+
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
98
54
|
);
|
|
99
|
-
await waitFor(() =>
|
|
100
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument();
|
|
101
|
-
});
|
|
55
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
102
56
|
expect(container).toMatchSnapshot();
|
|
103
57
|
});
|
|
104
58
|
|
|
105
59
|
it("contains no <TemplateSelector />", async () => {
|
|
106
|
-
const { queryByText } = render(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
</Suspense>,
|
|
110
|
-
renderOpts
|
|
60
|
+
const { queryByText } = render(<ConceptForm />, renderOpts);
|
|
61
|
+
await waitFor(() =>
|
|
62
|
+
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
111
63
|
);
|
|
112
|
-
await waitFor(() =>
|
|
113
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument();
|
|
114
|
-
});
|
|
64
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
115
65
|
expect(queryByText("template1")).not.toBeInTheDocument();
|
|
116
66
|
});
|
|
117
67
|
});
|
|
118
|
-
|
|
119
|
-
describe("domain selection", () => {
|
|
120
|
-
const renderOpts = makeRenderOpts([template1, template2]);
|
|
121
|
-
|
|
122
|
-
it("dispatches selectDomain when domain is selected", async () => {
|
|
123
|
-
const { queryByText, getByRole } = render(
|
|
124
|
-
<Suspense fallback="loading...">
|
|
125
|
-
<ConceptForm />
|
|
126
|
-
</Suspense>,
|
|
127
|
-
renderOpts
|
|
128
|
-
);
|
|
129
|
-
await waitFor(() => {
|
|
130
|
-
expect(queryByText(/loading/i)).not.toBeInTheDocument();
|
|
131
|
-
});
|
|
132
|
-
userEvent.click(getByRole("option", { name: "domain1" }));
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
68
|
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { ConceptsLabelResults } from "../ConceptsLabelResults";
|
|
4
4
|
|
|
5
5
|
describe("<ConceptsLabelResults />", () => {
|
|
6
6
|
const props = { conceptCount: 22 };
|
|
7
7
|
|
|
8
8
|
it("matches the latest snapshot", () => {
|
|
9
|
-
const
|
|
10
|
-
expect(
|
|
9
|
+
const { container } = render(<ConceptsLabelResults {...props} />);
|
|
10
|
+
expect(container).toMatchSnapshot();
|
|
11
11
|
});
|
|
12
12
|
});
|
|
@@ -1,14 +1,47 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<ConceptFilters /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
aria-expanded="false"
|
|
7
|
+
class="ui button floating labeled scrolling dropdown icon"
|
|
8
|
+
role="listbox"
|
|
9
|
+
tabindex="0"
|
|
10
|
+
>
|
|
11
|
+
<div
|
|
12
|
+
aria-atomic="true"
|
|
13
|
+
aria-live="polite"
|
|
14
|
+
class="divider text"
|
|
15
|
+
role="alert"
|
|
16
|
+
>
|
|
17
|
+
Filters
|
|
18
|
+
</div>
|
|
19
|
+
<i
|
|
20
|
+
aria-hidden="true"
|
|
21
|
+
class="filter icon"
|
|
22
|
+
/>
|
|
23
|
+
<div
|
|
24
|
+
class="menu transition"
|
|
25
|
+
>
|
|
26
|
+
<div
|
|
27
|
+
class="item"
|
|
28
|
+
role="option"
|
|
29
|
+
>
|
|
30
|
+
<em>
|
|
31
|
+
(reset all filters)
|
|
32
|
+
</em>
|
|
33
|
+
</div>
|
|
34
|
+
<div
|
|
35
|
+
class="item"
|
|
36
|
+
role="option"
|
|
37
|
+
>
|
|
38
|
+
<span
|
|
39
|
+
class="text"
|
|
40
|
+
>
|
|
41
|
+
confidential
|
|
42
|
+
</span>
|
|
43
|
+
</div>
|
|
44
|
+
</div>
|
|
45
|
+
</div>
|
|
46
|
+
</div>
|
|
14
47
|
`;
|
|
@@ -203,23 +203,23 @@ exports[`<ConceptForm /> with a single template matches the latest snapshot 1`]
|
|
|
203
203
|
autocorrect="on"
|
|
204
204
|
contenteditable="true"
|
|
205
205
|
data-gramm="false"
|
|
206
|
-
data-key="
|
|
206
|
+
data-key="9"
|
|
207
207
|
data-slate-editor="true"
|
|
208
208
|
role="textbox"
|
|
209
209
|
spellcheck="true"
|
|
210
210
|
style="outline: none; white-space: pre-wrap; word-wrap: break-word;"
|
|
211
211
|
>
|
|
212
212
|
<div
|
|
213
|
-
data-key="
|
|
213
|
+
data-key="10"
|
|
214
214
|
data-slate-object="block"
|
|
215
215
|
style="position: relative;"
|
|
216
216
|
>
|
|
217
217
|
<span
|
|
218
|
-
data-key="
|
|
218
|
+
data-key="13"
|
|
219
219
|
data-slate-object="text"
|
|
220
220
|
>
|
|
221
221
|
<span
|
|
222
|
-
data-offset-key="
|
|
222
|
+
data-offset-key="13:0"
|
|
223
223
|
data-slate-leaf="true"
|
|
224
224
|
>
|
|
225
225
|
<span>
|
|
@@ -389,81 +389,6 @@ exports[`<ConceptForm /> with multiple templates matches the latest snapshot 1`]
|
|
|
389
389
|
</div>
|
|
390
390
|
</div>
|
|
391
391
|
</div>
|
|
392
|
-
<div
|
|
393
|
-
class="required field"
|
|
394
|
-
>
|
|
395
|
-
<label>
|
|
396
|
-
Template
|
|
397
|
-
<div
|
|
398
|
-
class="ui left pointing label"
|
|
399
|
-
>
|
|
400
|
-
Empty required field
|
|
401
|
-
</div>
|
|
402
|
-
</label>
|
|
403
|
-
<div
|
|
404
|
-
class="field"
|
|
405
|
-
>
|
|
406
|
-
<div
|
|
407
|
-
aria-busy="false"
|
|
408
|
-
aria-expanded="false"
|
|
409
|
-
class="ui search selection dropdown"
|
|
410
|
-
name="template"
|
|
411
|
-
role="combobox"
|
|
412
|
-
>
|
|
413
|
-
<input
|
|
414
|
-
aria-autocomplete="list"
|
|
415
|
-
autocomplete="off"
|
|
416
|
-
class="search"
|
|
417
|
-
tabindex="0"
|
|
418
|
-
type="text"
|
|
419
|
-
value=""
|
|
420
|
-
/>
|
|
421
|
-
<div
|
|
422
|
-
aria-atomic="true"
|
|
423
|
-
aria-live="polite"
|
|
424
|
-
class="divider default text"
|
|
425
|
-
role="alert"
|
|
426
|
-
>
|
|
427
|
-
Select a template...
|
|
428
|
-
</div>
|
|
429
|
-
<i
|
|
430
|
-
aria-hidden="true"
|
|
431
|
-
class="dropdown icon"
|
|
432
|
-
/>
|
|
433
|
-
<div
|
|
434
|
-
class="menu transition"
|
|
435
|
-
role="listbox"
|
|
436
|
-
>
|
|
437
|
-
<div
|
|
438
|
-
aria-checked="false"
|
|
439
|
-
aria-selected="true"
|
|
440
|
-
class="selected item"
|
|
441
|
-
role="option"
|
|
442
|
-
style="pointer-events: all;"
|
|
443
|
-
>
|
|
444
|
-
<span
|
|
445
|
-
class="text"
|
|
446
|
-
>
|
|
447
|
-
template1
|
|
448
|
-
</span>
|
|
449
|
-
</div>
|
|
450
|
-
<div
|
|
451
|
-
aria-checked="false"
|
|
452
|
-
aria-selected="false"
|
|
453
|
-
class="item"
|
|
454
|
-
role="option"
|
|
455
|
-
style="pointer-events: all;"
|
|
456
|
-
>
|
|
457
|
-
<span
|
|
458
|
-
class="text"
|
|
459
|
-
>
|
|
460
|
-
template2
|
|
461
|
-
</span>
|
|
462
|
-
</div>
|
|
463
|
-
</div>
|
|
464
|
-
</div>
|
|
465
|
-
</div>
|
|
466
|
-
</div>
|
|
467
392
|
<div
|
|
468
393
|
class="required field"
|
|
469
394
|
>
|
|
@@ -619,6 +544,81 @@ exports[`<ConceptForm /> with multiple templates matches the latest snapshot 1`]
|
|
|
619
544
|
</div>
|
|
620
545
|
</div>
|
|
621
546
|
</div>
|
|
547
|
+
<div
|
|
548
|
+
class="required field"
|
|
549
|
+
>
|
|
550
|
+
<label>
|
|
551
|
+
Template
|
|
552
|
+
<div
|
|
553
|
+
class="ui left pointing label"
|
|
554
|
+
>
|
|
555
|
+
Empty required field
|
|
556
|
+
</div>
|
|
557
|
+
</label>
|
|
558
|
+
<div
|
|
559
|
+
class="field"
|
|
560
|
+
>
|
|
561
|
+
<div
|
|
562
|
+
aria-busy="false"
|
|
563
|
+
aria-expanded="false"
|
|
564
|
+
class="ui search selection dropdown"
|
|
565
|
+
name="template"
|
|
566
|
+
role="combobox"
|
|
567
|
+
>
|
|
568
|
+
<input
|
|
569
|
+
aria-autocomplete="list"
|
|
570
|
+
autocomplete="off"
|
|
571
|
+
class="search"
|
|
572
|
+
tabindex="0"
|
|
573
|
+
type="text"
|
|
574
|
+
value=""
|
|
575
|
+
/>
|
|
576
|
+
<div
|
|
577
|
+
aria-atomic="true"
|
|
578
|
+
aria-live="polite"
|
|
579
|
+
class="divider default text"
|
|
580
|
+
role="alert"
|
|
581
|
+
>
|
|
582
|
+
Select a template...
|
|
583
|
+
</div>
|
|
584
|
+
<i
|
|
585
|
+
aria-hidden="true"
|
|
586
|
+
class="dropdown icon"
|
|
587
|
+
/>
|
|
588
|
+
<div
|
|
589
|
+
class="menu transition"
|
|
590
|
+
role="listbox"
|
|
591
|
+
>
|
|
592
|
+
<div
|
|
593
|
+
aria-checked="false"
|
|
594
|
+
aria-selected="true"
|
|
595
|
+
class="selected item"
|
|
596
|
+
role="option"
|
|
597
|
+
style="pointer-events: all;"
|
|
598
|
+
>
|
|
599
|
+
<span
|
|
600
|
+
class="text"
|
|
601
|
+
>
|
|
602
|
+
template1
|
|
603
|
+
</span>
|
|
604
|
+
</div>
|
|
605
|
+
<div
|
|
606
|
+
aria-checked="false"
|
|
607
|
+
aria-selected="false"
|
|
608
|
+
class="item"
|
|
609
|
+
role="option"
|
|
610
|
+
style="pointer-events: all;"
|
|
611
|
+
>
|
|
612
|
+
<span
|
|
613
|
+
class="text"
|
|
614
|
+
>
|
|
615
|
+
template2
|
|
616
|
+
</span>
|
|
617
|
+
</div>
|
|
618
|
+
</div>
|
|
619
|
+
</div>
|
|
620
|
+
</div>
|
|
621
|
+
</div>
|
|
622
622
|
<div
|
|
623
623
|
class="actions"
|
|
624
624
|
>
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<ConceptsLabelResults /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"count": 22,
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
/>
|
|
15
|
-
</Label>
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui label concepts-label-results"
|
|
7
|
+
>
|
|
8
|
+
22 concepts found
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
16
11
|
`;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { DomainActions } from "../DomainActions";
|
|
4
4
|
|
|
5
5
|
describe("<DomainActions />", () => {
|
|
@@ -10,7 +10,7 @@ describe("<DomainActions />", () => {
|
|
|
10
10
|
const props = { domain, domainActions };
|
|
11
11
|
|
|
12
12
|
it("matches the latest snapshot", () => {
|
|
13
|
-
const
|
|
14
|
-
expect(
|
|
13
|
+
const { container } = render(<DomainActions {...props} />);
|
|
14
|
+
expect(container).toMatchSnapshot();
|
|
15
15
|
});
|
|
16
16
|
});
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
3
3
|
import { DomainCrumbs } from "../DomainCrumbs";
|
|
4
4
|
|
|
5
5
|
describe("<DomainCrumbs />", () => {
|
|
6
6
|
const parents = [
|
|
7
7
|
{ id: 1, name: "p1" },
|
|
8
|
-
{ id: 2, text: "p2" }
|
|
8
|
+
{ id: 2, text: "p2" },
|
|
9
9
|
];
|
|
10
10
|
const domain = { id: 3, name: "domain" };
|
|
11
11
|
const props = { parents, domain };
|
|
12
12
|
|
|
13
13
|
it("matches the latest snapshot", () => {
|
|
14
|
-
const
|
|
15
|
-
expect(
|
|
14
|
+
const { container } = render(<DomainCrumbs {...props} />);
|
|
15
|
+
expect(container).toMatchSnapshot();
|
|
16
16
|
});
|
|
17
17
|
});
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<DomainActions /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
id={3}
|
|
12
|
-
onConfirm={[Function]}
|
|
13
|
-
/>
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="actions"
|
|
7
|
+
/>
|
|
8
|
+
</div>
|
|
14
9
|
`;
|
|
@@ -1,80 +1,43 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<DomainCrumbs /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
as={
|
|
8
|
-
Object {
|
|
9
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
10
|
-
"displayName": "Link",
|
|
11
|
-
"propTypes": Object {
|
|
12
|
-
"innerRef": [Function],
|
|
13
|
-
"onClick": [Function],
|
|
14
|
-
"replace": [Function],
|
|
15
|
-
"target": [Function],
|
|
16
|
-
"to": [Function],
|
|
17
|
-
},
|
|
18
|
-
"render": [Function],
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
to="/domains"
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="ui breadcrumb"
|
|
22
7
|
>
|
|
23
|
-
<
|
|
24
|
-
|
|
8
|
+
<a
|
|
9
|
+
class="section"
|
|
10
|
+
href="/domains"
|
|
11
|
+
>
|
|
12
|
+
Taxonomy
|
|
13
|
+
</a>
|
|
14
|
+
<i
|
|
15
|
+
aria-hidden="true"
|
|
16
|
+
class="right angle icon divider"
|
|
25
17
|
/>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
</
|
|
50
|
-
|
|
51
|
-
icon="right angle"
|
|
52
|
-
/>
|
|
53
|
-
<BreadcrumbSection
|
|
54
|
-
as={
|
|
55
|
-
Object {
|
|
56
|
-
"$$typeof": Symbol(react.forward_ref),
|
|
57
|
-
"displayName": "Link",
|
|
58
|
-
"propTypes": Object {
|
|
59
|
-
"innerRef": [Function],
|
|
60
|
-
"onClick": [Function],
|
|
61
|
-
"replace": [Function],
|
|
62
|
-
"target": [Function],
|
|
63
|
-
"to": [Function],
|
|
64
|
-
},
|
|
65
|
-
"render": [Function],
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
key="1"
|
|
69
|
-
to="/domains/2"
|
|
70
|
-
/>
|
|
71
|
-
<BreadcrumbDivider
|
|
72
|
-
icon="right angle"
|
|
73
|
-
/>
|
|
74
|
-
<BreadcrumbSection
|
|
75
|
-
active={true}
|
|
76
|
-
>
|
|
77
|
-
domain
|
|
78
|
-
</BreadcrumbSection>
|
|
79
|
-
</Breadcrumb>
|
|
18
|
+
<a
|
|
19
|
+
class="section"
|
|
20
|
+
href="/domains/1"
|
|
21
|
+
>
|
|
22
|
+
p1
|
|
23
|
+
</a>
|
|
24
|
+
<i
|
|
25
|
+
aria-hidden="true"
|
|
26
|
+
class="right angle icon divider"
|
|
27
|
+
/>
|
|
28
|
+
<a
|
|
29
|
+
class="section"
|
|
30
|
+
href="/domains/2"
|
|
31
|
+
/>
|
|
32
|
+
<i
|
|
33
|
+
aria-hidden="true"
|
|
34
|
+
class="right angle icon divider"
|
|
35
|
+
/>
|
|
36
|
+
<div
|
|
37
|
+
class="active section"
|
|
38
|
+
>
|
|
39
|
+
domain
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
80
43
|
`;
|