@eeacms/volto-cca-policy 1.0.1 → 1.0.3
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/.github/workflows/betterleaks.yml +133 -0
- package/.gitleaks.toml +89 -0
- package/CHANGELOG.md +262 -1
- package/README.md +59 -0
- package/RELEASE.md +1 -1
- package/jest-addon.config.js +7 -3
- package/package.json +3 -2
- package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem.jsx +228 -0
- package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem.test.jsx +167 -0
- package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueContentView.jsx +189 -0
- package/src/components/Search/NavigatorCatalogue/NavigatorCatalogueMapView.jsx +11 -0
- package/src/components/Search/NavigatorCatalogue/utils.js +101 -0
- package/src/components/Search/NavigatorCatalogue/utils.test.js +132 -0
- package/src/components/Search/NavigatorGuide/NavigatorGuideContentView.jsx +409 -0
- package/src/components/Search/NavigatorGuide/NavigatorGuideLayout.jsx +8 -0
- package/src/components/index.js +2 -0
- package/src/components/manage/Blocks/CollectionStatistics/CollectionStatsView.test.jsx +2 -0
- package/src/components/theme/CompareTools/CompareToolsPanel.jsx +151 -0
- package/src/components/theme/CompareTools/CompareToolsPanel.test.jsx +96 -0
- package/src/components/theme/CompareTools/CompareToolsView.jsx +468 -0
- package/src/components/theme/CompareTools/utils.js +111 -0
- package/src/components/theme/CompareTools/utils.test.jsx +217 -0
- package/src/components/theme/Views/ExtendedToolView.jsx +409 -0
- package/src/components/theme/Views/ExtendedToolView.test.jsx +436 -0
- package/src/constants.js +1 -0
- package/src/customizations/@plone-collective/volto-rss-provider/express-middleware.js +1 -1
- package/src/customizations/volto/components/theme/View/LinkView.jsx +1 -1
- package/src/customizations/volto/reducers/breadcrumbs/breadcrumbs.js +1 -1
- package/src/customizations/volto/server.jsx +1 -1
- package/src/helpers/Utils.jsx +29 -0
- package/src/helpers/index.js +3 -0
- package/src/index.js +31 -2
- package/src/search/index.js +6 -0
- package/src/search/navigator_catalogue/config.js +89 -0
- package/src/search/navigator_catalogue/facets.js +86 -0
- package/src/search/navigator_catalogue/views.js +28 -0
- package/src/search/navigator_guide/config.js +70 -0
- package/src/search/navigator_guide/facets.js +31 -0
- package/src/search/navigator_guide/guideSteps.js +93 -0
- package/src/slate-styles.less +4 -0
- package/src/state.js +1 -0
- package/theme/elements/button.overrides +0 -11
- package/theme/elements/label.overrides +15 -0
- package/theme/globals/blocks.less +3 -2
- package/theme/globals/navigator.less +967 -0
- package/theme/globals/site.overrides +5 -0
- package/theme/tokens/colors.less +2 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import { fireEvent, render, screen } from '@testing-library/react';
|
|
4
|
+
import { IntlProvider } from 'react-intl';
|
|
5
|
+
|
|
6
|
+
import ExtendedToolView from './ExtendedToolView';
|
|
7
|
+
import { useCompareTools } from '../CompareTools/utils';
|
|
8
|
+
import { formatFunctionalityScore } from '../../Search/NavigatorCatalogue/utils';
|
|
9
|
+
|
|
10
|
+
jest.mock('../CompareTools/utils', () => ({
|
|
11
|
+
useCompareTools: jest.fn(),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
jest.mock('@eeacms/volto-cca-policy/components', () => ({
|
|
15
|
+
CompareToolsPanel: () => <div data-testid="compare-tools-panel" />,
|
|
16
|
+
PortalMessage: () => <div data-testid="portal-message" />,
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
jest.mock('@eeacms/volto-cca-policy/helpers', () => ({
|
|
20
|
+
HTMLField: ({ value }) =>
|
|
21
|
+
value ? <div dangerouslySetInnerHTML={{ __html: value }} /> : null,
|
|
22
|
+
|
|
23
|
+
TextField: ({ label, value }) =>
|
|
24
|
+
value !== null && value !== undefined && value !== '' ? (
|
|
25
|
+
<div>
|
|
26
|
+
<span>{label}</span>
|
|
27
|
+
<span>{String(value)}</span>
|
|
28
|
+
</div>
|
|
29
|
+
) : null,
|
|
30
|
+
|
|
31
|
+
BooleanField: ({ label, value, yesLabel, noLabel }) => (
|
|
32
|
+
<div>
|
|
33
|
+
<span>{label}</span>
|
|
34
|
+
<span>{value ? yesLabel : noLabel}</span>
|
|
35
|
+
</div>
|
|
36
|
+
),
|
|
37
|
+
|
|
38
|
+
VocabularyField: ({ label, values = [] }) =>
|
|
39
|
+
values.length > 0 ? (
|
|
40
|
+
<div>
|
|
41
|
+
<span>{label}</span>
|
|
42
|
+
<span>{values.join(', ')}</span>
|
|
43
|
+
</div>
|
|
44
|
+
) : null,
|
|
45
|
+
|
|
46
|
+
ContentMetadata: () => <div data-testid="content-metadata" />,
|
|
47
|
+
ItemLogo: () => <div data-testid="item-logo" />,
|
|
48
|
+
DocumentsList: () => <div data-testid="documents-list" />,
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
jest.mock('@plone/volto/registry', () => ({
|
|
52
|
+
blocks: {
|
|
53
|
+
blocksConfig: {
|
|
54
|
+
title: {
|
|
55
|
+
view: ({ metadata }) => <h1>{metadata.title}</h1>,
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
}));
|
|
60
|
+
|
|
61
|
+
jest.mock('../../Search/NavigatorCatalogue/utils', () => ({
|
|
62
|
+
formatFunctionalityScore: jest.fn((value) => `Formatted score: ${value}`),
|
|
63
|
+
}));
|
|
64
|
+
|
|
65
|
+
const toggle = jest.fn();
|
|
66
|
+
|
|
67
|
+
const renderComponent = (content = {}) =>
|
|
68
|
+
render(
|
|
69
|
+
<IntlProvider locale="en" messages={{}}>
|
|
70
|
+
<ExtendedToolView content={content} />
|
|
71
|
+
</IntlProvider>,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
describe('ExtendedToolView', () => {
|
|
75
|
+
beforeEach(() => {
|
|
76
|
+
jest.clearAllMocks();
|
|
77
|
+
|
|
78
|
+
useCompareTools.mockReturnValue({
|
|
79
|
+
isSelected: false,
|
|
80
|
+
isLimitReached: false,
|
|
81
|
+
toggle,
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it('renders the title and acronym', () => {
|
|
86
|
+
renderComponent({
|
|
87
|
+
title: 'Climate Tool',
|
|
88
|
+
acronym: 'CT',
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
expect(
|
|
92
|
+
screen.getByRole('heading', {
|
|
93
|
+
name: 'Climate Tool (CT)',
|
|
94
|
+
}),
|
|
95
|
+
).toBeInTheDocument();
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it('renders the title without an acronym', () => {
|
|
99
|
+
renderComponent({
|
|
100
|
+
title: 'Climate Tool',
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
expect(
|
|
104
|
+
screen.getByRole('heading', {
|
|
105
|
+
name: 'Climate Tool',
|
|
106
|
+
}),
|
|
107
|
+
).toBeInTheDocument();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('renders the open-tool button when a hyperlink is provided', () => {
|
|
111
|
+
renderComponent({
|
|
112
|
+
title: 'Climate Tool',
|
|
113
|
+
hyperlink: 'https://example.com/tool',
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
const openToolButton = screen.getByRole('button', {
|
|
117
|
+
name: /open tool/i,
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
expect(openToolButton).toHaveAttribute('href', 'https://example.com/tool');
|
|
121
|
+
expect(openToolButton).toHaveAttribute('target', '_blank');
|
|
122
|
+
expect(openToolButton).toHaveAttribute('rel', 'noopener noreferrer');
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('does not render the open-tool button without a hyperlink', () => {
|
|
126
|
+
renderComponent({
|
|
127
|
+
title: 'Climate Tool',
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
expect(
|
|
131
|
+
screen.queryByRole('button', {
|
|
132
|
+
name: /open tool/i,
|
|
133
|
+
}),
|
|
134
|
+
).not.toBeInTheDocument();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('adds the tool to comparison when the button is clicked', () => {
|
|
138
|
+
renderComponent({
|
|
139
|
+
UID: 'tool-uid',
|
|
140
|
+
'@id': '/tools/climate-tool',
|
|
141
|
+
title: 'Climate Tool',
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
fireEvent.click(
|
|
145
|
+
screen.getByRole('button', {
|
|
146
|
+
name: /add to comparison/i,
|
|
147
|
+
}),
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
expect(toggle).toHaveBeenCalledTimes(1);
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it('passes the correct tool data to useCompareTools', () => {
|
|
154
|
+
renderComponent({
|
|
155
|
+
UID: 'tool-uid',
|
|
156
|
+
'@id': '/tools/climate-tool',
|
|
157
|
+
title: 'Climate Tool',
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
expect(useCompareTools).toHaveBeenCalledWith({
|
|
161
|
+
uid: 'tool-uid',
|
|
162
|
+
title: 'Climate Tool',
|
|
163
|
+
href: '/tools/climate-tool',
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('disables the comparison button when the tool is selected', () => {
|
|
168
|
+
useCompareTools.mockReturnValue({
|
|
169
|
+
isSelected: true,
|
|
170
|
+
isLimitReached: false,
|
|
171
|
+
toggle,
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
renderComponent({
|
|
175
|
+
UID: 'tool-uid',
|
|
176
|
+
'@id': '/tools/climate-tool',
|
|
177
|
+
title: 'Climate Tool',
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
const button = screen.getByRole('button', {
|
|
181
|
+
name: /add to comparison/i,
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
expect(button).toBeDisabled();
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('disables the comparison button when the comparison limit is reached', () => {
|
|
188
|
+
useCompareTools.mockReturnValue({
|
|
189
|
+
isSelected: false,
|
|
190
|
+
isLimitReached: true,
|
|
191
|
+
toggle,
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
renderComponent({
|
|
195
|
+
UID: 'tool-uid',
|
|
196
|
+
'@id': '/tools/climate-tool',
|
|
197
|
+
title: 'Climate Tool',
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
const button = screen.getByRole('button', {
|
|
201
|
+
name: /add to comparison/i,
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
expect(button).toBeDisabled();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it('does not call toggle when the comparison button is disabled', () => {
|
|
208
|
+
useCompareTools.mockReturnValue({
|
|
209
|
+
isSelected: true,
|
|
210
|
+
isLimitReached: false,
|
|
211
|
+
toggle,
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
renderComponent({
|
|
215
|
+
UID: 'tool-uid',
|
|
216
|
+
'@id': '/tools/climate-tool',
|
|
217
|
+
title: 'Climate Tool',
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
const button = screen.getByRole('button', {
|
|
221
|
+
name: /add to comparison/i,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
fireEvent.click(button);
|
|
225
|
+
|
|
226
|
+
expect(toggle).not.toHaveBeenCalled();
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it('does not render the comparison button without a UID', () => {
|
|
230
|
+
renderComponent({
|
|
231
|
+
title: 'Climate Tool',
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
expect(
|
|
235
|
+
screen.queryByRole('button', {
|
|
236
|
+
name: /add to comparison/i,
|
|
237
|
+
}),
|
|
238
|
+
).not.toBeInTheDocument();
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('renders English and the additional available language', () => {
|
|
242
|
+
renderComponent({
|
|
243
|
+
title: 'Climate Tool',
|
|
244
|
+
tool_available_english: true,
|
|
245
|
+
tool_available_language: 'French',
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
expect(screen.getByText('English, French')).toBeInTheDocument();
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('renders only English when no additional language is provided', () => {
|
|
252
|
+
renderComponent({
|
|
253
|
+
title: 'Climate Tool',
|
|
254
|
+
tool_available_english: true,
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
expect(screen.getByText('English')).toBeInTheDocument();
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
it('renders only the additional language when English is unavailable', () => {
|
|
261
|
+
renderComponent({
|
|
262
|
+
title: 'Climate Tool',
|
|
263
|
+
tool_available_english: false,
|
|
264
|
+
tool_available_language: 'Romanian',
|
|
265
|
+
});
|
|
266
|
+
|
|
267
|
+
expect(screen.getByText('Romanian')).toBeInTheDocument();
|
|
268
|
+
expect(screen.queryByText(/English,/)).not.toBeInTheDocument();
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
it('does not render an available-language value when none exists', () => {
|
|
272
|
+
renderComponent({
|
|
273
|
+
title: 'Climate Tool',
|
|
274
|
+
tool_available_english: false,
|
|
275
|
+
tool_available_language: '',
|
|
276
|
+
});
|
|
277
|
+
|
|
278
|
+
expect(screen.queryByText('Available language')).not.toBeInTheDocument();
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('formats the functionality score', () => {
|
|
282
|
+
renderComponent({
|
|
283
|
+
title: 'Climate Tool',
|
|
284
|
+
functionality: 4,
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
expect(formatFunctionalityScore).toHaveBeenCalledWith(4);
|
|
288
|
+
expect(screen.getByText('Formatted score: 4')).toBeInTheDocument();
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('formats a functionality score of zero', () => {
|
|
292
|
+
renderComponent({
|
|
293
|
+
title: 'Climate Tool',
|
|
294
|
+
functionality: 0,
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
expect(formatFunctionalityScore).toHaveBeenCalledWith(0);
|
|
298
|
+
expect(screen.getByText('Formatted score: 0')).toBeInTheDocument();
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it('does not format an undefined functionality score', () => {
|
|
302
|
+
renderComponent({
|
|
303
|
+
title: 'Climate Tool',
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
expect(formatFunctionalityScore).not.toHaveBeenCalled();
|
|
307
|
+
});
|
|
308
|
+
|
|
309
|
+
it('does not format a null functionality score', () => {
|
|
310
|
+
renderComponent({
|
|
311
|
+
title: 'Climate Tool',
|
|
312
|
+
functionality: null,
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
expect(formatFunctionalityScore).not.toHaveBeenCalled();
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
it('renders text fields', () => {
|
|
319
|
+
renderComponent({
|
|
320
|
+
title: 'Climate Tool',
|
|
321
|
+
tool_provider: 'Example Provider',
|
|
322
|
+
public_private_mode: 'Public',
|
|
323
|
+
spatial_resolution: 'Regional',
|
|
324
|
+
underlying_data_maintenance: 'Updated yearly',
|
|
325
|
+
strengths_and_possible_limitations: 'Easy to use',
|
|
326
|
+
});
|
|
327
|
+
|
|
328
|
+
expect(screen.getByText('Example Provider')).toBeInTheDocument();
|
|
329
|
+
expect(screen.getByText('Public')).toBeInTheDocument();
|
|
330
|
+
expect(screen.getByText('Regional')).toBeInTheDocument();
|
|
331
|
+
expect(screen.getByText('Updated yearly')).toBeInTheDocument();
|
|
332
|
+
expect(screen.getByText('Easy to use')).toBeInTheDocument();
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
it('renders coder fields', () => {
|
|
336
|
+
renderComponent({
|
|
337
|
+
title: 'Climate Tool',
|
|
338
|
+
coder_1: 'Coder One',
|
|
339
|
+
coder_2: 'Coder Two',
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
expect(screen.getByText('Coder1')).toBeInTheDocument();
|
|
343
|
+
expect(screen.getByText('Coder One')).toBeInTheDocument();
|
|
344
|
+
expect(screen.getByText('Coder2')).toBeInTheDocument();
|
|
345
|
+
expect(screen.getByText('Coder Two')).toBeInTheDocument();
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('renders HTML descriptions', () => {
|
|
349
|
+
renderComponent({
|
|
350
|
+
title: 'Climate Tool',
|
|
351
|
+
long_description: '<p>Long tool description</p>',
|
|
352
|
+
description: '<p>Short tool description</p>',
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
expect(screen.getByText('Long tool description')).toBeInTheDocument();
|
|
356
|
+
expect(screen.getByText('Short tool description')).toBeInTheDocument();
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
it('renders boolean fields with YES values', () => {
|
|
360
|
+
renderComponent({
|
|
361
|
+
title: 'Climate Tool',
|
|
362
|
+
only_interactive_support_tool: true,
|
|
363
|
+
adaptation_cycle_step: true,
|
|
364
|
+
updating_cycle_of_the_tool: true,
|
|
365
|
+
language_accessibility: true,
|
|
366
|
+
free_access: true,
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
expect(screen.getAllByText('YES')).toHaveLength(5);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it('renders boolean fields with NO values', () => {
|
|
373
|
+
renderComponent({
|
|
374
|
+
title: 'Climate Tool',
|
|
375
|
+
only_interactive_support_tool: false,
|
|
376
|
+
adaptation_cycle_step: false,
|
|
377
|
+
updating_cycle_of_the_tool: false,
|
|
378
|
+
language_accessibility: false,
|
|
379
|
+
free_access: false,
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
expect(screen.getAllByText('NO')).toHaveLength(5);
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
it('renders vocabulary fields', () => {
|
|
386
|
+
renderComponent({
|
|
387
|
+
title: 'Climate Tool',
|
|
388
|
+
intended_user_groups: ['Policy makers', 'Researchers'],
|
|
389
|
+
place_of_implementation: ['Europe'],
|
|
390
|
+
type_of_data: ['Climate data'],
|
|
391
|
+
data_sources: ['Satellite'],
|
|
392
|
+
license_status: ['Open source'],
|
|
393
|
+
user_support_provisions: ['Documentation'],
|
|
394
|
+
tool_validation_use: ['Validated'],
|
|
395
|
+
number_of_users_tool: ['More than 1,000'],
|
|
396
|
+
tool_provider_mode: ['Public provider'],
|
|
397
|
+
adaptation_support_cycle_step: ['Assessing risks'],
|
|
398
|
+
type_of_outputs: ['Maps'],
|
|
399
|
+
temporality_of_data: ['Historical'],
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
expect(screen.getByText('Policy makers, Researchers')).toBeInTheDocument();
|
|
403
|
+
expect(screen.getByText('Europe')).toBeInTheDocument();
|
|
404
|
+
expect(screen.getByText('Climate data')).toBeInTheDocument();
|
|
405
|
+
expect(screen.getByText('Satellite')).toBeInTheDocument();
|
|
406
|
+
expect(screen.getByText('Open source')).toBeInTheDocument();
|
|
407
|
+
expect(screen.getByText('Documentation')).toBeInTheDocument();
|
|
408
|
+
expect(screen.getByText('Validated')).toBeInTheDocument();
|
|
409
|
+
expect(screen.getByText('More than 1,000')).toBeInTheDocument();
|
|
410
|
+
expect(screen.getByText('Public provider')).toBeInTheDocument();
|
|
411
|
+
expect(screen.getByText('Assessing risks')).toBeInTheDocument();
|
|
412
|
+
expect(screen.getByText('Maps')).toBeInTheDocument();
|
|
413
|
+
expect(screen.getByText('Historical')).toBeInTheDocument();
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('renders accessibility and usability as a vocabulary value', () => {
|
|
417
|
+
renderComponent({
|
|
418
|
+
title: 'Climate Tool',
|
|
419
|
+
accessibility_and_usability: 'Easy to use',
|
|
420
|
+
});
|
|
421
|
+
|
|
422
|
+
expect(screen.getByText('Easy to use')).toBeInTheDocument();
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
it('renders supporting components', () => {
|
|
426
|
+
renderComponent({
|
|
427
|
+
title: 'Climate Tool',
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
expect(screen.getByTestId('item-logo')).toBeInTheDocument();
|
|
431
|
+
expect(screen.getByTestId('compare-tools-panel')).toBeInTheDocument();
|
|
432
|
+
expect(screen.getByTestId('portal-message')).toBeInTheDocument();
|
|
433
|
+
expect(screen.getByTestId('content-metadata')).toBeInTheDocument();
|
|
434
|
+
expect(screen.getByTestId('documents-list')).toBeInTheDocument();
|
|
435
|
+
});
|
|
436
|
+
});
|
package/src/constants.js
CHANGED
|
@@ -7,6 +7,7 @@ export const ORGANISATION = 'eea.climateadapt.organisation';
|
|
|
7
7
|
export const ACE_PROJECT = 'eea.climateadapt.aceproject';
|
|
8
8
|
export const PUBLICATION_REPORT = 'eea.climateadapt.publicationreport';
|
|
9
9
|
export const TOOL = 'eea.climateadapt.tool';
|
|
10
|
+
export const EXTENDED_TOOL = 'eea.climateadapt.extendedtool';
|
|
10
11
|
export const VIDEO = 'eea.climateadapt.video';
|
|
11
12
|
export const C3S_INDICATOR = 'eea.climateadapt.c3sindicator';
|
|
12
13
|
export const MISSION_SIGNATORY_PROFILE = 'mission_signatory_profile';
|
|
@@ -46,7 +46,7 @@ async function getRssFeedData(apiPath, APISUFFIX, req, settings) {
|
|
|
46
46
|
.accept('json')
|
|
47
47
|
.use(addHeadersFactory(req));
|
|
48
48
|
|
|
49
|
-
const authToken = req.universalCookies?.get?.('auth_token');
|
|
49
|
+
const authToken = req.universalCookies?.get?.('auth_token'); //betterleaks:allow
|
|
50
50
|
if (authToken) {
|
|
51
51
|
request.set('Authorization', `Bearer ${authToken}`);
|
|
52
52
|
}
|
|
@@ -238,7 +238,7 @@ server.get('/*', (req, res) => {
|
|
|
238
238
|
.toString(),
|
|
239
239
|
);
|
|
240
240
|
|
|
241
|
-
const authToken = req.universalCookies.get('auth_token');
|
|
241
|
+
const authToken = req.universalCookies.get('auth_token'); //betterleaks:allow
|
|
242
242
|
const initialState = {
|
|
243
243
|
userSession: { ...userSession(), token: authToken },
|
|
244
244
|
form: req.body,
|
package/src/helpers/Utils.jsx
CHANGED
|
@@ -62,6 +62,35 @@ export const HTMLField = ({ value, className }) => {
|
|
|
62
62
|
);
|
|
63
63
|
};
|
|
64
64
|
|
|
65
|
+
export const TextField = ({ label, value }) => {
|
|
66
|
+
if (value === null || value === undefined || value === '') return null;
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<>
|
|
70
|
+
<h5>{label}</h5>
|
|
71
|
+
<p>{value}</p>
|
|
72
|
+
</>
|
|
73
|
+
);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export const BooleanField = ({ label, value, yesLabel, noLabel }) => (
|
|
77
|
+
<TextField label={label} value={value ? yesLabel : noLabel} />
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
export const VocabularyField = ({ label, values }) => {
|
|
81
|
+
if (!values?.length) return null;
|
|
82
|
+
|
|
83
|
+
return (
|
|
84
|
+
<TextField
|
|
85
|
+
label={label}
|
|
86
|
+
value={values
|
|
87
|
+
.map((value) => value?.title || value?.token || value)
|
|
88
|
+
.filter(Boolean)
|
|
89
|
+
.join(', ')}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
};
|
|
93
|
+
|
|
65
94
|
export const ExternalLink = (props) => {
|
|
66
95
|
let { url, text } = props;
|
|
67
96
|
|
package/src/helpers/index.js
CHANGED
package/src/index.js
CHANGED
|
@@ -13,11 +13,13 @@ import {
|
|
|
13
13
|
MissionSignatoryProfileView,
|
|
14
14
|
CreateArchivedCopyButton,
|
|
15
15
|
ImageWidget,
|
|
16
|
+
CompareToolsView,
|
|
16
17
|
} from '@eeacms/volto-cca-policy/components';
|
|
17
18
|
|
|
18
19
|
import CcaEventView from './components/theme/Views/CcaEventView';
|
|
19
20
|
import NewsItemView from './components/theme/Views/NewsItemView';
|
|
20
21
|
import EventView from './components/theme/Views/EventView';
|
|
22
|
+
import ExtendedToolView from './components/theme/Views/ExtendedToolView';
|
|
21
23
|
import AdaptationOptionView from './components/theme/Views/AdaptationOptionView';
|
|
22
24
|
import CaseStudyView from './components/theme/Views/CaseStudyView';
|
|
23
25
|
import ProjectView from './components/theme/Views/ProjectView';
|
|
@@ -33,6 +35,7 @@ import {
|
|
|
33
35
|
ACE_PROJECT,
|
|
34
36
|
PUBLICATION_REPORT,
|
|
35
37
|
TOOL,
|
|
38
|
+
EXTENDED_TOOL,
|
|
36
39
|
VIDEO,
|
|
37
40
|
C3S_INDICATOR,
|
|
38
41
|
CCA_EVENT,
|
|
@@ -47,6 +50,11 @@ import GeocharsWidget from './components/theme/Widgets/GeocharsWidget';
|
|
|
47
50
|
import PromotionalImageWidget from './components/theme/Widgets/PromotionalImageWidget';
|
|
48
51
|
import HealthHorizontalCardItem from './components/Result/HealthHorizontalCardItem';
|
|
49
52
|
import ClusterHorizontalCardItem from './components/Result/ClusterHorizontalCardItem';
|
|
53
|
+
import NavigatorCatalogueCardItem from './components/Search/NavigatorCatalogue/NavigatorCatalogueCardItem';
|
|
54
|
+
import NavigatorCatalogueMapView from './components/Search/NavigatorCatalogue/NavigatorCatalogueMapView';
|
|
55
|
+
import NavigatorCatalogueContentView from './components/Search/NavigatorCatalogue/NavigatorCatalogueContentView';
|
|
56
|
+
import NavigatorGuideLayout from './components/Search/NavigatorGuide/NavigatorGuideLayout';
|
|
57
|
+
import NavigatorGuideContentView from './components/Search/NavigatorGuide/NavigatorGuideContentView';
|
|
50
58
|
|
|
51
59
|
import { langRedirection } from './store/middleware';
|
|
52
60
|
|
|
@@ -357,6 +365,7 @@ const applyConfig = (config) => {
|
|
|
357
365
|
[EVENT]: EventView,
|
|
358
366
|
[CCA_EVENT]: CcaEventView,
|
|
359
367
|
[TOOL]: DatabaseItemView,
|
|
368
|
+
[EXTENDED_TOOL]: ExtendedToolView,
|
|
360
369
|
[INDICATOR]: DatabaseItemView,
|
|
361
370
|
[ORGANISATION]: DatabaseItemView,
|
|
362
371
|
[GUIDANCE]: DatabaseItemView,
|
|
@@ -415,6 +424,21 @@ const applyConfig = (config) => {
|
|
|
415
424
|
config.settings.searchlib.resolve.ClusterHorizontalCardItem = {
|
|
416
425
|
component: ClusterHorizontalCardItem,
|
|
417
426
|
};
|
|
427
|
+
config.settings.searchlib.resolve.NavigatorCatalogueCardItem = {
|
|
428
|
+
component: NavigatorCatalogueCardItem,
|
|
429
|
+
};
|
|
430
|
+
config.settings.searchlib.resolve.NavigatorCatalogueMapView = {
|
|
431
|
+
component: NavigatorCatalogueMapView,
|
|
432
|
+
};
|
|
433
|
+
config.settings.searchlib.resolve.NavigatorCatalogueContentView = {
|
|
434
|
+
component: NavigatorCatalogueContentView,
|
|
435
|
+
};
|
|
436
|
+
config.settings.searchlib.resolve.NavigatorGuideLayout = {
|
|
437
|
+
component: NavigatorGuideLayout,
|
|
438
|
+
};
|
|
439
|
+
config.settings.searchlib.resolve.NavigatorGuideContentView = {
|
|
440
|
+
component: NavigatorGuideContentView,
|
|
441
|
+
};
|
|
418
442
|
// Custom widgets
|
|
419
443
|
config.widgets.id.geochars = GeocharsWidget;
|
|
420
444
|
config.widgets.id.geolocation = GeolocationWidget;
|
|
@@ -431,6 +455,7 @@ const applyConfig = (config) => {
|
|
|
431
455
|
{ cssClass: 'large-text', label: 'Large text' },
|
|
432
456
|
{ cssClass: 'medium-text', label: 'Medium text' },
|
|
433
457
|
{ cssClass: 'small-text', label: 'Small text' },
|
|
458
|
+
{ cssClass: 'green-text', label: 'Green text' },
|
|
434
459
|
];
|
|
435
460
|
|
|
436
461
|
// TODO: fix in all languages
|
|
@@ -493,13 +518,17 @@ const applyConfig = (config) => {
|
|
|
493
518
|
path: `/broken-links`,
|
|
494
519
|
component: BrokenLinks,
|
|
495
520
|
},
|
|
496
|
-
|
|
521
|
+
{
|
|
522
|
+
path: `*/navigator/compare`,
|
|
523
|
+
component: CompareToolsView,
|
|
524
|
+
},
|
|
497
525
|
...(config.addonRoutes || []),
|
|
498
526
|
];
|
|
499
527
|
|
|
500
528
|
config.settings.nonContentRoutes = [
|
|
501
529
|
...config.settings.nonContentRoutes,
|
|
502
530
|
'/broken-links',
|
|
531
|
+
'/navigator/compare',
|
|
503
532
|
];
|
|
504
533
|
|
|
505
534
|
config.settings.appExtras = [
|
|
@@ -565,7 +594,7 @@ const applyConfig = (config) => {
|
|
|
565
594
|
|
|
566
595
|
config.settings.themeColors = [
|
|
567
596
|
...config.settings.themeColors,
|
|
568
|
-
{ value: 'green', title: '
|
|
597
|
+
{ value: 'green', title: 'Green' },
|
|
569
598
|
];
|
|
570
599
|
|
|
571
600
|
config.settings.matomoTrackerIdFn = (pathname) => {
|
package/src/search/index.js
CHANGED
|
@@ -5,6 +5,8 @@ import installMissionToolsSearch from './mission_tools/config-tools';
|
|
|
5
5
|
import installMissionProjectsSearch from './mission_projects/config-projects';
|
|
6
6
|
import installMissionFundingSearch from './mission_funding/config-funding';
|
|
7
7
|
import installMissionAllSearch from './mission_all/config-all';
|
|
8
|
+
import installNavigatorCatalogueSearch from './navigator_catalogue/config';
|
|
9
|
+
import installNavigatorGuideSearch from './navigator_guide/config';
|
|
8
10
|
|
|
9
11
|
const extraQueryParams = {
|
|
10
12
|
text_fields: [
|
|
@@ -35,6 +37,8 @@ const applyConfig = (config) => {
|
|
|
35
37
|
installMissionToolsSearch,
|
|
36
38
|
installMissionFundingSearch,
|
|
37
39
|
installMissionAllSearch,
|
|
40
|
+
installNavigatorCatalogueSearch,
|
|
41
|
+
installNavigatorGuideSearch,
|
|
38
42
|
].reduce((acc, cur) => cur(acc), config.settings.searchlib);
|
|
39
43
|
|
|
40
44
|
const searchui = config.settings.searchlib.searchui;
|
|
@@ -44,6 +48,8 @@ const applyConfig = (config) => {
|
|
|
44
48
|
searchui.missionStoriesSearch.extraQueryParams = extraQueryParams;
|
|
45
49
|
searchui.missionToolsSearch.extraQueryParams = extraQueryParams;
|
|
46
50
|
searchui.missionAll.extraQueryParams = extraQueryParams;
|
|
51
|
+
searchui.navigatorCatalogueSearch.extraQueryParams = extraQueryParams;
|
|
52
|
+
searchui.navigatorGuideSearch.extraQueryParams = extraQueryParams;
|
|
47
53
|
|
|
48
54
|
// console.log(config.settings.searchlib);
|
|
49
55
|
|