@truedat/bg 4.44.2 → 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 +12 -0
- package/package.json +21 -18
- package/src/concepts/components/ConceptEdit.js +5 -3
- package/src/concepts/components/ConceptFiltersDefault.js +1 -5
- package/src/concepts/components/ConceptFiltersPublished.js +1 -5
- package/src/concepts/components/ConceptForm.js +84 -159
- package/src/concepts/components/ConceptRoutes.js +14 -10
- package/src/concepts/components/ConceptsBulkUpdate.js +1 -1
- package/src/concepts/components/SharedToForm.js +1 -1
- package/src/concepts/components/__tests__/ConceptFilters.spec.js +10 -4
- package/src/concepts/components/__tests__/ConceptForm.spec.js +49 -109
- package/src/concepts/components/__tests__/ConceptsBulkUpdate.spec.js +41 -44
- package/src/concepts/components/__tests__/ConceptsLabelResults.spec.js +3 -3
- package/src/concepts/components/__tests__/SharedToForm.spec.js +8 -24
- package/src/concepts/components/__tests__/__snapshots__/ConceptFilters.spec.js.snap +43 -10
- package/src/concepts/components/__tests__/__snapshots__/ConceptForm.spec.js.snap +603 -163
- package/src/concepts/components/__tests__/__snapshots__/ConceptsLabelResults.spec.js.snap +7 -12
- package/src/concepts/components/__tests__/__snapshots__/SharedToForm.spec.js.snap +3 -3
- package/src/taxonomy/components/AddMemberForm.js +1 -3
- 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
|
@@ -1,128 +1,68 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
2
|
+
import { waitFor } from "@testing-library/react";
|
|
3
|
+
import userEvent from "@testing-library/user-event";
|
|
4
|
+
import { render } from "@truedat/test/render";
|
|
5
|
+
import { multipleTemplatesMock, singleTemplateMock } from "@truedat/test/mocks";
|
|
6
|
+
import ConceptForm from "../ConceptForm";
|
|
4
7
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const template2 = { id: 2, name: "template2" };
|
|
12
|
-
const templateLoading = false;
|
|
13
|
-
|
|
14
|
-
const props = {
|
|
15
|
-
action,
|
|
16
|
-
applyTemplate,
|
|
17
|
-
conceptAction,
|
|
18
|
-
conceptActionLoading,
|
|
19
|
-
templateLoading,
|
|
20
|
-
};
|
|
8
|
+
const state = {
|
|
9
|
+
conceptActions: { create: {} },
|
|
10
|
+
conceptActionLoading: "",
|
|
11
|
+
domains: [{ id: 1, name: "domain1" }],
|
|
12
|
+
};
|
|
13
|
+
const variables = { scope: "bg", domainIds: [1] };
|
|
21
14
|
|
|
15
|
+
describe("<ConceptForm />", () => {
|
|
22
16
|
describe("with multiple templates", () => {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
selectTemplate={selectTemplate}
|
|
29
|
-
selectedTemplate={template1}
|
|
30
|
-
{...props}
|
|
31
|
-
/>
|
|
32
|
-
);
|
|
17
|
+
const renderOpts = {
|
|
18
|
+
mocks: [multipleTemplatesMock(variables)],
|
|
19
|
+
state,
|
|
20
|
+
fallback: "lazy",
|
|
21
|
+
};
|
|
33
22
|
|
|
34
|
-
it("matches the latest snapshot", () => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
23
|
+
it("matches the latest snapshot", async () => {
|
|
24
|
+
const { container, queryByText } = render(<ConceptForm />, renderOpts);
|
|
25
|
+
await waitFor(() =>
|
|
26
|
+
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
27
|
+
);
|
|
28
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
29
|
+
expect(container).toMatchSnapshot();
|
|
40
30
|
});
|
|
41
31
|
|
|
42
|
-
it("
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
32
|
+
it("renders dynamic fields when template is selected", async () => {
|
|
33
|
+
const { findByText, getByText, queryByText } = render(
|
|
34
|
+
<ConceptForm />,
|
|
35
|
+
renderOpts
|
|
36
|
+
);
|
|
37
|
+
userEvent.click(await findByText("template1"));
|
|
38
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
39
|
+
expect(getByText("field1")).toBeInTheDocument();
|
|
47
40
|
});
|
|
48
41
|
});
|
|
49
42
|
|
|
50
43
|
describe("with a single template", () => {
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
selectTemplate={selectTemplate}
|
|
57
|
-
{...props}
|
|
58
|
-
/>
|
|
59
|
-
);
|
|
60
|
-
|
|
61
|
-
it("matches the latest snapshot", () => {
|
|
62
|
-
expect(wrapper).toMatchSnapshot();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("contains no <TemplateSelector />", () => {
|
|
66
|
-
expect(wrapper.find({ name: "template" })).toHaveLength(0);
|
|
67
|
-
});
|
|
44
|
+
const renderOpts = {
|
|
45
|
+
mocks: [singleTemplateMock(variables)],
|
|
46
|
+
state,
|
|
47
|
+
fallback: "lazy",
|
|
48
|
+
};
|
|
68
49
|
|
|
69
|
-
it("
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("updates it's state when the template changes", () => {
|
|
76
|
-
const wrapper = shallowWithIntl(
|
|
77
|
-
<ConceptForm template={template1} {...props} />
|
|
78
|
-
);
|
|
79
|
-
expect(wrapper.state("type")).toBeUndefined();
|
|
80
|
-
wrapper.setProps({ template: template1 });
|
|
81
|
-
expect(wrapper.state("type")).toEqual(template1.name);
|
|
82
|
-
wrapper.setProps({ template: template2 });
|
|
83
|
-
expect(wrapper.state("type")).toEqual(template2.name);
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
describe("domain selection", () => {
|
|
87
|
-
it("dispatches selectDomain when domain is selected", () => {
|
|
88
|
-
const selectDomain = jest.fn();
|
|
89
|
-
const value = 2;
|
|
90
|
-
const wrapper = shallowWithIntl(
|
|
91
|
-
<ConceptForm selectDomain={selectDomain} {...props} />
|
|
50
|
+
it("matches the latest snapshot", async () => {
|
|
51
|
+
const { container, queryByText } = render(<ConceptForm />, renderOpts);
|
|
52
|
+
await waitFor(() =>
|
|
53
|
+
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
92
54
|
);
|
|
93
|
-
expect(
|
|
94
|
-
|
|
95
|
-
expect(wrapper.state("domain_id")).toBe(value);
|
|
96
|
-
expect(selectDomain.mock.calls.length).toBe(1);
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
describe("content changes", () => {
|
|
101
|
-
it("sets name in state when name field changes", () => {
|
|
102
|
-
const wrapper = shallowWithIntl(<ConceptForm {...props} />);
|
|
103
|
-
const name = "name";
|
|
104
|
-
const value = "newName";
|
|
105
|
-
const e = { preventDefault: jest.fn() };
|
|
106
|
-
wrapper.find({ name }).simulate("change", e, { name, value });
|
|
107
|
-
expect(e.preventDefault.mock.calls.length).toBe(1);
|
|
108
|
-
expect(wrapper.state(name)).toBe(value);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it("sets description in state when rich text editor changes", () => {
|
|
112
|
-
const wrapper = shallowWithIntl(<ConceptForm {...props} />);
|
|
113
|
-
const value = { foo: "bar" };
|
|
114
|
-
const e = { preventDefault: jest.fn() };
|
|
115
|
-
wrapper.find({ name: "description" }).prop("onChange")(e, { value });
|
|
116
|
-
expect(wrapper.state("description")).toBe(value);
|
|
55
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
56
|
+
expect(container).toMatchSnapshot();
|
|
117
57
|
});
|
|
118
58
|
|
|
119
|
-
it("
|
|
120
|
-
const
|
|
121
|
-
|
|
59
|
+
it("contains no <TemplateSelector />", async () => {
|
|
60
|
+
const { queryByText } = render(<ConceptForm />, renderOpts);
|
|
61
|
+
await waitFor(() =>
|
|
62
|
+
expect(queryByText(/loading/i)).not.toBeInTheDocument()
|
|
122
63
|
);
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
expect(wrapper.state("content")).toBe(content);
|
|
64
|
+
await waitFor(() => expect(queryByText(/lazy/i)).not.toBeInTheDocument());
|
|
65
|
+
expect(queryByText("template1")).not.toBeInTheDocument();
|
|
126
66
|
});
|
|
127
67
|
});
|
|
128
68
|
});
|
|
@@ -11,9 +11,6 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
11
11
|
const selectTemplate = jest.fn();
|
|
12
12
|
const selectedDomain = {};
|
|
13
13
|
const concepts = [{ id: 1, type: "simple" }];
|
|
14
|
-
const eventMock = {
|
|
15
|
-
preventDefault: jest.fn()
|
|
16
|
-
};
|
|
17
14
|
|
|
18
15
|
it("matches the latest snapshot", () => {
|
|
19
16
|
const props = { loading, template, selectTemplate, concepts };
|
|
@@ -27,7 +24,7 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
27
24
|
template,
|
|
28
25
|
selectTemplate: jest.fn(),
|
|
29
26
|
concepts,
|
|
30
|
-
selectedDomain
|
|
27
|
+
selectedDomain,
|
|
31
28
|
};
|
|
32
29
|
jest.spyOn(ConceptsBulkUpdate.prototype, "componentDidMount");
|
|
33
30
|
shallow(<ConceptsBulkUpdate {...props} />);
|
|
@@ -44,7 +41,7 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
44
41
|
selectTemplate: jest.fn(),
|
|
45
42
|
concepts,
|
|
46
43
|
selectedDomain,
|
|
47
|
-
applyTemplate: jest.fn()
|
|
44
|
+
applyTemplate: jest.fn(),
|
|
48
45
|
};
|
|
49
46
|
jest.spyOn(ConceptsBulkUpdate.prototype, "setState");
|
|
50
47
|
const wrapper = shallow(<ConceptsBulkUpdate {...props} />);
|
|
@@ -59,7 +56,7 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
59
56
|
selectTemplate,
|
|
60
57
|
templateId,
|
|
61
58
|
concepts,
|
|
62
|
-
selectedDomain: { id: 1 }
|
|
59
|
+
selectedDomain: { id: 1 },
|
|
63
60
|
};
|
|
64
61
|
const wrapper = shallow(<ConceptsBulkUpdate {...props} />);
|
|
65
62
|
expect(wrapper.find({ fieldsToOmit: ["_confidential"] })).toHaveLength(1);
|
|
@@ -71,8 +68,8 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
71
68
|
{
|
|
72
69
|
description: "a",
|
|
73
70
|
id: 2,
|
|
74
|
-
name: "Dos"
|
|
75
|
-
}
|
|
71
|
+
name: "Dos",
|
|
72
|
+
},
|
|
76
73
|
];
|
|
77
74
|
const template = {
|
|
78
75
|
content: [
|
|
@@ -85,7 +82,7 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
85
82
|
name: "bg_number",
|
|
86
83
|
type: "number",
|
|
87
84
|
values: null,
|
|
88
|
-
widget: "number"
|
|
85
|
+
widget: "number",
|
|
89
86
|
},
|
|
90
87
|
{
|
|
91
88
|
cardinality: "1",
|
|
@@ -94,7 +91,7 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
94
91
|
name: "bg_date",
|
|
95
92
|
type: "date",
|
|
96
93
|
values: null,
|
|
97
|
-
widget: "date"
|
|
94
|
+
widget: "date",
|
|
98
95
|
},
|
|
99
96
|
{
|
|
100
97
|
cardinality: "?",
|
|
@@ -103,17 +100,17 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
103
100
|
name: "bg_datetime",
|
|
104
101
|
type: "datetime",
|
|
105
102
|
values: null,
|
|
106
|
-
widget: "datetime"
|
|
107
|
-
}
|
|
103
|
+
widget: "datetime",
|
|
104
|
+
},
|
|
108
105
|
],
|
|
109
106
|
is_secret: false,
|
|
110
|
-
name: ""
|
|
111
|
-
}
|
|
107
|
+
name: "",
|
|
108
|
+
},
|
|
112
109
|
],
|
|
113
110
|
id: 10,
|
|
114
111
|
label: "nuevos tipos",
|
|
115
112
|
name: "nuevostipos",
|
|
116
|
-
scope: "bg"
|
|
113
|
+
scope: "bg",
|
|
117
114
|
};
|
|
118
115
|
|
|
119
116
|
const concepts = [
|
|
@@ -123,12 +120,12 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
123
120
|
_confidential: "No",
|
|
124
121
|
bg_date: "2020-05-16",
|
|
125
122
|
bg_datetime: "2020-05-02 18:00",
|
|
126
|
-
bg_number: -1
|
|
123
|
+
bg_number: -1,
|
|
127
124
|
},
|
|
128
125
|
domain: { external_id: null, id: 2, name: "Dos" },
|
|
129
126
|
id: 18,
|
|
130
127
|
name: "numero",
|
|
131
|
-
type: "nuevostipos"
|
|
128
|
+
type: "nuevostipos",
|
|
132
129
|
},
|
|
133
130
|
{
|
|
134
131
|
business_concept_id: 19,
|
|
@@ -136,12 +133,12 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
136
133
|
_confidential: "No",
|
|
137
134
|
bg_date: "2020-05-16",
|
|
138
135
|
bg_datetime: "2020-05-02 18:00",
|
|
139
|
-
bg_number: -1
|
|
136
|
+
bg_number: -1,
|
|
140
137
|
},
|
|
141
138
|
id: 19,
|
|
142
139
|
name: "numero 2",
|
|
143
|
-
type: "nuevostipos"
|
|
144
|
-
}
|
|
140
|
+
type: "nuevostipos",
|
|
141
|
+
},
|
|
145
142
|
];
|
|
146
143
|
|
|
147
144
|
const props = {
|
|
@@ -152,16 +149,16 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
152
149
|
applyTemplate: applyTemplateWithoutDefaults(template),
|
|
153
150
|
concepts,
|
|
154
151
|
domains,
|
|
155
|
-
selectedDomain: { id: 1 }
|
|
152
|
+
selectedDomain: { id: 1 },
|
|
156
153
|
};
|
|
157
154
|
const wrapper = shallow(<ConceptsBulkUpdate {...props} />);
|
|
158
155
|
wrapper.setState({
|
|
159
156
|
content: {
|
|
160
157
|
bg_number: 1,
|
|
161
158
|
bg_date: "2020-05-14",
|
|
162
|
-
bg_datetime: "2020-05-28 22:50"
|
|
159
|
+
bg_datetime: "2020-05-28 22:50",
|
|
163
160
|
},
|
|
164
|
-
domain_id: 1
|
|
161
|
+
domain_id: 1,
|
|
165
162
|
});
|
|
166
163
|
_.find({ key: "yes" })(
|
|
167
164
|
wrapper
|
|
@@ -180,9 +177,9 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
180
177
|
content: {
|
|
181
178
|
bg_date: "2020-05-14",
|
|
182
179
|
bg_datetime: "2020-05-28 22:50",
|
|
183
|
-
bg_number: 1
|
|
184
|
-
}
|
|
185
|
-
}
|
|
180
|
+
bg_number: 1,
|
|
181
|
+
},
|
|
182
|
+
},
|
|
186
183
|
});
|
|
187
184
|
});
|
|
188
185
|
|
|
@@ -192,8 +189,8 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
192
189
|
{
|
|
193
190
|
description: "a",
|
|
194
191
|
id: 2,
|
|
195
|
-
name: "Dos"
|
|
196
|
-
}
|
|
192
|
+
name: "Dos",
|
|
193
|
+
},
|
|
197
194
|
];
|
|
198
195
|
const template = {
|
|
199
196
|
content: [
|
|
@@ -206,7 +203,7 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
206
203
|
name: "bg_number",
|
|
207
204
|
type: "number",
|
|
208
205
|
values: null,
|
|
209
|
-
widget: "number"
|
|
206
|
+
widget: "number",
|
|
210
207
|
},
|
|
211
208
|
{
|
|
212
209
|
cardinality: "1",
|
|
@@ -215,7 +212,7 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
215
212
|
name: "bg_date",
|
|
216
213
|
type: "date",
|
|
217
214
|
values: null,
|
|
218
|
-
widget: "date"
|
|
215
|
+
widget: "date",
|
|
219
216
|
},
|
|
220
217
|
{
|
|
221
218
|
cardinality: "?",
|
|
@@ -224,17 +221,17 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
224
221
|
name: "bg_datetime",
|
|
225
222
|
type: "datetime",
|
|
226
223
|
values: null,
|
|
227
|
-
widget: "datetime"
|
|
228
|
-
}
|
|
224
|
+
widget: "datetime",
|
|
225
|
+
},
|
|
229
226
|
],
|
|
230
227
|
is_secret: false,
|
|
231
|
-
name: ""
|
|
232
|
-
}
|
|
228
|
+
name: "",
|
|
229
|
+
},
|
|
233
230
|
],
|
|
234
231
|
id: 10,
|
|
235
232
|
label: "nuevos tipos",
|
|
236
233
|
name: "nuevostipos",
|
|
237
|
-
scope: "bg"
|
|
234
|
+
scope: "bg",
|
|
238
235
|
};
|
|
239
236
|
|
|
240
237
|
const concepts = [
|
|
@@ -242,14 +239,14 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
242
239
|
business_concept_id: 18,
|
|
243
240
|
id: 18,
|
|
244
241
|
name: "numero",
|
|
245
|
-
type: "nuevostipos"
|
|
242
|
+
type: "nuevostipos",
|
|
246
243
|
},
|
|
247
244
|
{
|
|
248
245
|
business_concept_id: 19,
|
|
249
246
|
id: 19,
|
|
250
247
|
name: "numero 2",
|
|
251
|
-
type: "nuevostipos"
|
|
252
|
-
}
|
|
248
|
+
type: "nuevostipos",
|
|
249
|
+
},
|
|
253
250
|
];
|
|
254
251
|
|
|
255
252
|
const props = {
|
|
@@ -260,16 +257,16 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
260
257
|
applyTemplate: applyTemplateWithoutDefaults(template),
|
|
261
258
|
concepts,
|
|
262
259
|
domains,
|
|
263
|
-
selectedDomain: { id: 1 }
|
|
260
|
+
selectedDomain: { id: 1 },
|
|
264
261
|
};
|
|
265
262
|
const wrapper = shallow(<ConceptsBulkUpdate {...props} />);
|
|
266
263
|
wrapper.setState({
|
|
267
264
|
content: {
|
|
268
265
|
bg_number: 0,
|
|
269
266
|
bg_date: "",
|
|
270
|
-
bg_datetime: ""
|
|
267
|
+
bg_datetime: "",
|
|
271
268
|
},
|
|
272
|
-
domain_id: 1
|
|
269
|
+
domain_id: 1,
|
|
273
270
|
});
|
|
274
271
|
_.find({ key: "yes" })(
|
|
275
272
|
wrapper
|
|
@@ -286,9 +283,9 @@ describe("<ConceptsBulkUpdate />", () => {
|
|
|
286
283
|
update_attributes: {
|
|
287
284
|
domain_id: 1,
|
|
288
285
|
content: {
|
|
289
|
-
bg_number: 0
|
|
290
|
-
}
|
|
291
|
-
}
|
|
286
|
+
bg_number: 0,
|
|
287
|
+
},
|
|
288
|
+
},
|
|
292
289
|
});
|
|
293
290
|
});
|
|
294
291
|
});
|
|
@@ -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
|
});
|
|
@@ -21,49 +21,33 @@ describe("<SharedToForm />", () => {
|
|
|
21
21
|
saving,
|
|
22
22
|
sharedTo,
|
|
23
23
|
};
|
|
24
|
-
const renderOpts = {
|
|
25
|
-
messages: {
|
|
26
|
-
en: {
|
|
27
|
-
"concept.sharedTo.header": "shared to",
|
|
28
|
-
"concept.sharedTo.dropdown.placeholder": "select domain",
|
|
29
|
-
"concept.sharedTo.dropdown.label": "domain",
|
|
30
|
-
"share.actions.submit": "submit",
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
24
|
|
|
35
25
|
it("matches the latest snapshot", async () => {
|
|
36
|
-
const { container } = render(<SharedToForm {...props}
|
|
26
|
+
const { container } = render(<SharedToForm {...props} />);
|
|
37
27
|
await waitFor(() => {
|
|
38
28
|
expect(container).toMatchSnapshot();
|
|
39
29
|
});
|
|
40
30
|
});
|
|
41
31
|
|
|
42
32
|
it("enables share button when we select a domain", async () => {
|
|
43
|
-
const { findByText, queryByText } = render(
|
|
44
|
-
<SharedToForm {...props} />,
|
|
45
|
-
renderOpts
|
|
46
|
-
);
|
|
33
|
+
const { findByText, queryByText } = render(<SharedToForm {...props} />);
|
|
47
34
|
|
|
48
|
-
expect(queryByText(
|
|
35
|
+
expect(queryByText("Share")).toBeDisabled();
|
|
49
36
|
userEvent.click(await findByText(/baz/));
|
|
50
37
|
await waitFor(() => {
|
|
51
|
-
expect(queryByText(
|
|
38
|
+
expect(queryByText("Share")).not.toBeDisabled();
|
|
52
39
|
});
|
|
53
40
|
});
|
|
54
41
|
|
|
55
42
|
it("invokes function when submit button clicked", async () => {
|
|
56
|
-
const { findByText, queryByText } = render(
|
|
57
|
-
<SharedToForm {...props} />,
|
|
58
|
-
renderOpts
|
|
59
|
-
);
|
|
43
|
+
const { findByText, queryByText } = render(<SharedToForm {...props} />);
|
|
60
44
|
|
|
61
|
-
expect(queryByText(
|
|
45
|
+
expect(queryByText("Share")).toBeDisabled();
|
|
62
46
|
userEvent.click(await findByText(/baz/));
|
|
63
47
|
await waitFor(() => {
|
|
64
|
-
expect(queryByText(
|
|
48
|
+
expect(queryByText("Share")).not.toBeDisabled();
|
|
65
49
|
});
|
|
66
|
-
userEvent.click(await findByText(
|
|
50
|
+
userEvent.click(await findByText("Share"));
|
|
67
51
|
await waitFor(() => {
|
|
68
52
|
expect(saveSharedTo.mock.calls.length).toBe(1);
|
|
69
53
|
});
|
|
@@ -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
|
`;
|