@eeacms/volto-eea-website-theme 1.22.1 → 1.24.0
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 +42 -10
- package/RELEASE.md +14 -14
- package/cypress.config.js +3 -3
- package/jest-addon.config.js +3 -0
- package/package.json +4 -3
- package/src/components/manage/Blocks/Title/schema.js +40 -1
- package/src/components/theme/Banner/View.jsx +2 -1
- package/src/config.js +27 -15
- package/src/customizations/@plone/volto-slate/editor/extensions/normalizeExternalData.js +9 -0
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.jsx +9 -6
- package/src/customizations/volto/components/manage/Blocks/Image/Edit.test.jsx +312 -0
- package/src/customizations/volto/components/manage/Blocks/Image/View.jsx +9 -6
- package/src/customizations/volto/components/manage/Blocks/LeadImage/Edit.jsx +8 -4
- package/src/customizations/volto/components/manage/Blocks/LeadImage/View.jsx +8 -5
- package/src/customizations/volto/components/manage/Blocks/LeadImage/schema.js +0 -1
- package/src/customizations/volto/components/manage/Form/Form.test.jsx +1124 -0
- package/src/customizations/volto/components/manage/Widgets/ObjectBrowserWidget.test.jsx +193 -0
- package/src/customizations/volto/components/theme/Comments/Comments.test.jsx +407 -0
- package/src/customizations/volto/components/theme/Header/Header.jsx +53 -50
- package/src/customizations/volto/components/theme/Header/Header.test.jsx +326 -0
- package/src/helpers/schema-utils.js +40 -34
- package/src/index.js +122 -15
- package/src/index.test.js +343 -0
- package/src/customizations/@eeacms/volto-tabs-block/components/templates/default/schema.js +0 -109
- package/src/customizations/@eeacms/volto-tabs-block/components/templates/horizontal-responsive/schema.js +0 -109
package/src/index.js
CHANGED
@@ -1,28 +1,34 @@
|
|
1
|
-
import
|
2
|
-
import { getBlocks } from '@plone/volto/helpers';
|
1
|
+
import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
|
3
2
|
import CustomCSS from '@eeacms/volto-eea-website-theme/components/theme/CustomCSS/CustomCSS';
|
4
3
|
import DraftBackground from '@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground';
|
5
4
|
import HomePageInverseView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView';
|
6
5
|
import HomePageView from '@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView';
|
7
|
-
import InpageNavigation from '@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation';
|
8
6
|
import NotFound from '@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound';
|
9
|
-
import { TopicsWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TopicsWidget';
|
10
7
|
import { TokenWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget';
|
8
|
+
import { TopicsWidget } from '@eeacms/volto-eea-website-theme/components/theme/Widgets/TopicsWidget';
|
9
|
+
import { Icon } from '@plone/volto/components';
|
10
|
+
import { getBlocks } from '@plone/volto/helpers';
|
11
|
+
import Tag from '@eeacms/volto-eea-design-system/ui/Tag/Tag';
|
12
|
+
|
13
|
+
import {
|
14
|
+
addStylingFieldsetSchemaEnhancer,
|
15
|
+
addStylingFieldsetSchemaEnhancerImagePosition,
|
16
|
+
} from '@eeacms/volto-eea-website-theme/helpers/schema-utils';
|
11
17
|
|
12
|
-
import { addStylingFieldsetSchemaEnhancer } from '@eeacms/volto-eea-website-theme/helpers/schema-utils';
|
13
|
-
import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title';
|
14
18
|
import installLayoutSettingsBlock from '@eeacms/volto-eea-website-theme/components/manage/Blocks/LayoutSettings';
|
19
|
+
import installCustomTitle from '@eeacms/volto-eea-website-theme/components/manage/Blocks/Title';
|
15
20
|
|
21
|
+
import FlexGroup from '@eeacms/volto-eea-website-theme/components/manage/Blocks/GroupBlockTemplate/FlexGroup/FlexGroup';
|
16
22
|
import BaseTag from './components/theme/BaseTag';
|
17
23
|
import SubsiteClass from './components/theme/SubsiteClass';
|
18
|
-
import FlexGroup from '@eeacms/volto-eea-website-theme/components/manage/Blocks/GroupBlockTemplate/FlexGroup/FlexGroup';
|
19
24
|
import contentBoxSVG from './icons/content-box.svg';
|
20
25
|
|
21
|
-
import installSlate from './slate';
|
22
26
|
import okMiddleware from './middleware/ok';
|
23
27
|
import voltoCustomMiddleware from './middleware/voltoCustom';
|
28
|
+
import installSlate from './slate';
|
24
29
|
|
25
30
|
import * as eea from './config';
|
31
|
+
import React from 'react';
|
26
32
|
|
27
33
|
const restrictedBlocks = [
|
28
34
|
'__grid', // Grid/Teaser block (kitconcept)
|
@@ -30,6 +36,84 @@ const restrictedBlocks = [
|
|
30
36
|
'teaser',
|
31
37
|
];
|
32
38
|
|
39
|
+
/**
|
40
|
+
* Customizes the variations of a tabs block by modifying their schema and semantic icons.
|
41
|
+
*
|
42
|
+
* @param {Array} tabs_block_variations - An array of variations for the tabs block.
|
43
|
+
* @param {Object} config - The Volto configuration object.
|
44
|
+
*/
|
45
|
+
function tabVariationCustomization(tabs_block_variations, config) {
|
46
|
+
if (!tabs_block_variations) return;
|
47
|
+
const defaultVariation = tabs_block_variations.find(
|
48
|
+
({ id }) => id === 'default',
|
49
|
+
);
|
50
|
+
const accordionVariation = tabs_block_variations.find(
|
51
|
+
({ id }) => id === 'accordion',
|
52
|
+
);
|
53
|
+
const horizontalVariation = tabs_block_variations.find(
|
54
|
+
({ id }) => id === 'horizontal-responsive',
|
55
|
+
);
|
56
|
+
|
57
|
+
if (accordionVariation) {
|
58
|
+
accordionVariation.semanticIcon = {
|
59
|
+
opened: 'ri-arrow-up-s-line',
|
60
|
+
closed: 'ri-arrow-down-s-line',
|
61
|
+
};
|
62
|
+
}
|
63
|
+
|
64
|
+
const oldSchemaEnhancer =
|
65
|
+
config.blocks.blocksConfig.tabs_block.schemaEnhancer;
|
66
|
+
config.blocks.blocksConfig.tabs_block.schemaEnhancer = (props) => {
|
67
|
+
const schema = (oldSchemaEnhancer ? oldSchemaEnhancer(props) : props)
|
68
|
+
.schema;
|
69
|
+
const oldSchemaExtender = schema.properties?.data?.schemaExtender;
|
70
|
+
schema.properties.data.schemaExtender = (schema, child) => {
|
71
|
+
const innerSchema = oldSchemaExtender
|
72
|
+
? oldSchemaExtender(schema, child)
|
73
|
+
: schema;
|
74
|
+
innerSchema.properties.icon.description = (
|
75
|
+
<>
|
76
|
+
Ex. ri-home-line. See{' '}
|
77
|
+
<a
|
78
|
+
target="_blank"
|
79
|
+
rel="noopener noreferrer"
|
80
|
+
href="https://remixicon.com/"
|
81
|
+
>
|
82
|
+
Remix Icon set
|
83
|
+
</a>
|
84
|
+
</>
|
85
|
+
);
|
86
|
+
return innerSchema;
|
87
|
+
};
|
88
|
+
return schema;
|
89
|
+
};
|
90
|
+
const oldDefaultSchemaEnhancer = defaultVariation.schemaEnhancer;
|
91
|
+
defaultVariation.schemaEnhancer = (props) => {
|
92
|
+
const newSchema = oldDefaultSchemaEnhancer(props);
|
93
|
+
const menuFieldset = newSchema.fieldsets.find(({ id }) => id === 'menu');
|
94
|
+
menuFieldset.fields = [
|
95
|
+
'menuAlign',
|
96
|
+
'menuPosition',
|
97
|
+
'menuColor',
|
98
|
+
'menuInverted',
|
99
|
+
];
|
100
|
+
return newSchema;
|
101
|
+
};
|
102
|
+
|
103
|
+
const oldHorizontalSchemaEnhancer = horizontalVariation.schemaEnhancer;
|
104
|
+
horizontalVariation.schemaEnhancer = (props) => {
|
105
|
+
const newSchema = oldHorizontalSchemaEnhancer(props);
|
106
|
+
const menuFieldset = newSchema.fieldsets.find(({ id }) => id === 'menu');
|
107
|
+
menuFieldset.fields = [
|
108
|
+
'menuAlign',
|
109
|
+
'menuPosition',
|
110
|
+
'menuColor',
|
111
|
+
'menuInverted',
|
112
|
+
];
|
113
|
+
return newSchema;
|
114
|
+
};
|
115
|
+
}
|
116
|
+
|
33
117
|
const applyConfig = (config) => {
|
34
118
|
// EEA specific settings
|
35
119
|
config.settings.eea = {
|
@@ -54,6 +138,16 @@ const applyConfig = (config) => {
|
|
54
138
|
config.blocks.blocksConfig[block].restricted = true;
|
55
139
|
}
|
56
140
|
});
|
141
|
+
|
142
|
+
//Apply the image position style for image and leadimage blocks
|
143
|
+
if (config.blocks.blocksConfig.leadimage) {
|
144
|
+
config.blocks.blocksConfig.leadimage.schemaEnhancer = addStylingFieldsetSchemaEnhancerImagePosition;
|
145
|
+
}
|
146
|
+
|
147
|
+
if (config.blocks.blocksConfig.image) {
|
148
|
+
config.blocks.blocksConfig.image.schemaEnhancer = addStylingFieldsetSchemaEnhancerImagePosition;
|
149
|
+
}
|
150
|
+
|
57
151
|
// Set Languages in nextcloud-video-block
|
58
152
|
if (
|
59
153
|
config?.blocks?.blocksConfig?.nextCloudVideo?.subtitlesLanguages &&
|
@@ -116,12 +210,9 @@ const applyConfig = (config) => {
|
|
116
210
|
|
117
211
|
// Apply tabs block customization
|
118
212
|
if (config.blocks.blocksConfig.tabs_block) {
|
119
|
-
|
120
|
-
config.blocks.blocksConfig.tabs_block.
|
121
|
-
|
122
|
-
closed: 'ri-arrow-down-s-line',
|
123
|
-
};
|
124
|
-
}
|
213
|
+
const tabs_block_variations =
|
214
|
+
config.blocks.blocksConfig.tabs_block.variations;
|
215
|
+
tabVariationCustomization(tabs_block_variations, config);
|
125
216
|
}
|
126
217
|
//Group block flex variation
|
127
218
|
if (config.blocks.blocksConfig.group) {
|
@@ -154,8 +245,8 @@ const applyConfig = (config) => {
|
|
154
245
|
if (config.blocks.blocksConfig.columnsBlock) {
|
155
246
|
config.blocks.blocksConfig.columnsBlock.available_colors = eea.colors;
|
156
247
|
config.blocks.blocksConfig.columnsBlock.tocEntries = (
|
157
|
-
block = {},
|
158
248
|
tocData,
|
249
|
+
block = {},
|
159
250
|
) => {
|
160
251
|
// integration with volto-block-toc
|
161
252
|
const headlines = tocData.levels || ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
@@ -366,6 +457,22 @@ const applyConfig = (config) => {
|
|
366
457
|
config.blocks.blocksConfig.accordion.mostUsed = true;
|
367
458
|
}
|
368
459
|
|
460
|
+
// Teaser block changes
|
461
|
+
if (config.blocks.blocksConfig.teaser) {
|
462
|
+
// Use volto-eea-design-system Tag component for rendering teaser tags
|
463
|
+
config.blocks.blocksConfig.teaser.renderTag = (tag, index) => {
|
464
|
+
return (
|
465
|
+
<Tag
|
466
|
+
href={`https://www.eea.europa.eu/en/advanced-search?filters[0][field]=topic&filters[0][values][0]=${tag}&filters[0][type]=any&filters[1][field]=language&filters[1][type]=any&filters[1][values][0]=en&filters[2][field]=issued.date&filters[2][values][0]=Last 5 years&filters[2][type]=any&sort-field=issued.date&sort-direction=desc`}
|
467
|
+
key={index}
|
468
|
+
aria-label={`Search for content tagged with ${tag}`}
|
469
|
+
>
|
470
|
+
{tag}
|
471
|
+
</Tag>
|
472
|
+
);
|
473
|
+
};
|
474
|
+
}
|
475
|
+
|
369
476
|
// Breadcrumbs
|
370
477
|
config.settings.apiExpanders.push({
|
371
478
|
match: '',
|
@@ -0,0 +1,343 @@
|
|
1
|
+
import applyConfig from './index';
|
2
|
+
import * as eea from './config';
|
3
|
+
import BaseTag from './components/theme/BaseTag';
|
4
|
+
|
5
|
+
jest.mock(
|
6
|
+
'@eeacms/volto-eea-design-system/ui/InpageNavigation/InpageNavigation',
|
7
|
+
() => 'MockedInpageNavigation',
|
8
|
+
);
|
9
|
+
jest.mock('@eeacms/volto-eea-website-theme/helpers/schema-utils', () => ({
|
10
|
+
addStylingFieldsetSchemaEnhancer: jest.fn(),
|
11
|
+
}));
|
12
|
+
jest.mock(
|
13
|
+
'@eeacms/volto-eea-website-theme/components/theme/CustomCSS/CustomCSS',
|
14
|
+
() => 'MockedCustomCSS',
|
15
|
+
);
|
16
|
+
jest.mock(
|
17
|
+
'@eeacms/volto-eea-website-theme/components/theme/NotFound/NotFound',
|
18
|
+
() => 'MockedNotFound',
|
19
|
+
);
|
20
|
+
jest.mock(
|
21
|
+
'@eeacms/volto-eea-website-theme/components/theme/DraftBackground/DraftBackground',
|
22
|
+
() => 'MockedDraftBackground',
|
23
|
+
);
|
24
|
+
jest.mock(
|
25
|
+
'@eeacms/volto-eea-website-theme/components/theme/Widgets/TokenWidget',
|
26
|
+
() => ({
|
27
|
+
TokenWidget: 'MockedTokenWidget',
|
28
|
+
}),
|
29
|
+
);
|
30
|
+
jest.mock(
|
31
|
+
'@eeacms/volto-eea-website-theme/components/theme/Widgets/TopicsWidget',
|
32
|
+
() => ({
|
33
|
+
TopicsWidget: 'MockedThemesWidget',
|
34
|
+
}),
|
35
|
+
);
|
36
|
+
jest.mock('./components/theme/SubsiteClass', () => 'MockedSubsiteClass');
|
37
|
+
jest.mock(
|
38
|
+
'@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageView',
|
39
|
+
() => 'MockedHomePageView',
|
40
|
+
);
|
41
|
+
jest.mock(
|
42
|
+
'@eeacms/volto-eea-website-theme/components/theme/Homepage/HomePageInverseView',
|
43
|
+
() => 'MockedHomePageInverseView',
|
44
|
+
);
|
45
|
+
jest.mock('@plone/volto/components', () => ({
|
46
|
+
Icon: 'MockedIcon',
|
47
|
+
}));
|
48
|
+
|
49
|
+
global.__SERVER__ = true;
|
50
|
+
|
51
|
+
describe('applyConfig', () => {
|
52
|
+
it('should update the config settings with EEA specific settings', () => {
|
53
|
+
const originalConfig = {
|
54
|
+
blocks: {
|
55
|
+
blocksConfig: {
|
56
|
+
title: {
|
57
|
+
restricted: undefined,
|
58
|
+
},
|
59
|
+
description: {
|
60
|
+
restricted: undefined,
|
61
|
+
},
|
62
|
+
image: {},
|
63
|
+
video: {},
|
64
|
+
teaser: {
|
65
|
+
restricted: undefined,
|
66
|
+
},
|
67
|
+
nextCloudVideo: {
|
68
|
+
subtitlesLanguages: [],
|
69
|
+
},
|
70
|
+
accordion: undefined,
|
71
|
+
tabs_block: undefined,
|
72
|
+
columnsBlock: undefined,
|
73
|
+
hero: undefined,
|
74
|
+
group: undefined,
|
75
|
+
listing: undefined,
|
76
|
+
dividerBlock: undefined,
|
77
|
+
callToActionBlock: undefined,
|
78
|
+
},
|
79
|
+
},
|
80
|
+
views: {
|
81
|
+
layoutViews: undefined,
|
82
|
+
errorViews: {},
|
83
|
+
},
|
84
|
+
widgets: {
|
85
|
+
views: {
|
86
|
+
id: {
|
87
|
+
taxonomy_themes: undefined,
|
88
|
+
},
|
89
|
+
widget: {
|
90
|
+
tags: undefined,
|
91
|
+
},
|
92
|
+
},
|
93
|
+
},
|
94
|
+
settings: {
|
95
|
+
eea: {
|
96
|
+
languages: [{ code: 'en', name: 'English' }],
|
97
|
+
},
|
98
|
+
contactForm: '',
|
99
|
+
serverConfig: undefined,
|
100
|
+
showTags: true,
|
101
|
+
dateLocale: '',
|
102
|
+
available_colors: [],
|
103
|
+
expressMiddleware: [],
|
104
|
+
appExtras: undefined,
|
105
|
+
|
106
|
+
pluggableStyles: undefined,
|
107
|
+
apiExpanders: [],
|
108
|
+
hasLanguageDropdown: true,
|
109
|
+
themeColors: [],
|
110
|
+
previewText: '',
|
111
|
+
requiredBlocks: [],
|
112
|
+
},
|
113
|
+
};
|
114
|
+
const config = applyConfig(originalConfig);
|
115
|
+
|
116
|
+
expect(config.settings.contactForm).toBe('/contact');
|
117
|
+
expect(config.settings.showTags).toBe(false);
|
118
|
+
expect(config.blocks.blocksConfig['teaser'].restricted).toBe(true);
|
119
|
+
expect(config.blocks.blocksConfig['title'].restricted).toBe(false);
|
120
|
+
expect(config.blocks.blocksConfig['description'].restricted).toBe(false);
|
121
|
+
expect(config.settings.dateLocale).toBe('en-gb');
|
122
|
+
expect(config.views.layoutViews['homepage_view']).toBe(
|
123
|
+
'MockedHomePageView',
|
124
|
+
);
|
125
|
+
expect(config.views.layoutViews['homepage_inverse_view']).toBe(
|
126
|
+
'MockedHomePageInverseView',
|
127
|
+
);
|
128
|
+
expect(config.views.errorViews['404']).toBe('MockedNotFound');
|
129
|
+
|
130
|
+
expect(config.blocks.blocksConfig['description'].className).toBe(
|
131
|
+
'documentDescription eea callout',
|
132
|
+
);
|
133
|
+
|
134
|
+
expect(config.widgets.views.id.subjects).toBe('MockedTokenWidget');
|
135
|
+
expect(config.settings.expressMiddleware.length).toEqual(2);
|
136
|
+
expect(config.settings.appExtras).toEqual([
|
137
|
+
{ match: '/**', component: 'MockedInpageNavigation' },
|
138
|
+
{ match: '', component: 'MockedCustomCSS' },
|
139
|
+
{ match: '', component: 'MockedDraftBackground' },
|
140
|
+
{ match: '', component: 'MockedSubsiteClass' },
|
141
|
+
{ match: '', component: BaseTag },
|
142
|
+
]);
|
143
|
+
expect(config.settings.available_colors).toEqual(eea.colors);
|
144
|
+
expect(config.settings.hasLanguageDropdown).toBe(false);
|
145
|
+
expect(config.settings.themeColors).toEqual([
|
146
|
+
{ value: undefined, title: 'No theme' },
|
147
|
+
{ value: 'primary', title: 'Primary' },
|
148
|
+
{ value: 'secondary', title: 'Secondary' },
|
149
|
+
{ value: 'tertiary', title: 'Tertiary' },
|
150
|
+
]);
|
151
|
+
expect(config.settings.pluggableStyles).toEqual([
|
152
|
+
{
|
153
|
+
id: 'content-box-gray',
|
154
|
+
title: 'Default',
|
155
|
+
previewComponent: expect.any(Function),
|
156
|
+
viewComponent: expect.any(Function),
|
157
|
+
},
|
158
|
+
{
|
159
|
+
id: 'content-box-primary',
|
160
|
+
title: 'Primary',
|
161
|
+
previewComponent: expect.any(Function),
|
162
|
+
viewComponent: expect.any(Function),
|
163
|
+
},
|
164
|
+
{
|
165
|
+
id: 'content-box-secondary',
|
166
|
+
title: 'Secondary',
|
167
|
+
previewComponent: expect.any(Function),
|
168
|
+
viewComponent: expect.any(Function),
|
169
|
+
},
|
170
|
+
{
|
171
|
+
id: 'content-box-tertiary',
|
172
|
+
title: 'Tertiary',
|
173
|
+
previewComponent: expect.any(Function),
|
174
|
+
viewComponent: expect.any(Function),
|
175
|
+
},
|
176
|
+
]);
|
177
|
+
expect(config.blocks.blocksConfig.image.mostUsed).toBe(false);
|
178
|
+
expect(config.blocks.blocksConfig.video.mostUsed).toBe(false);
|
179
|
+
expect(config.settings.apiExpanders).toEqual([
|
180
|
+
{ match: '', GET_CONTENT: ['breadcrumbs'] },
|
181
|
+
]);
|
182
|
+
});
|
183
|
+
|
184
|
+
it('should update the config settings with EEA specific settings', () => {
|
185
|
+
const originalConfig = {
|
186
|
+
blocks: {
|
187
|
+
blocksConfig: {
|
188
|
+
title: {
|
189
|
+
restricted: undefined,
|
190
|
+
},
|
191
|
+
description: {
|
192
|
+
restricted: undefined,
|
193
|
+
},
|
194
|
+
image: {},
|
195
|
+
video: {},
|
196
|
+
teaser: {
|
197
|
+
restricted: undefined,
|
198
|
+
},
|
199
|
+
nextCloudVideo: {
|
200
|
+
subtitlesLanguages: undefined,
|
201
|
+
},
|
202
|
+
accordion: {
|
203
|
+
defaults: {},
|
204
|
+
},
|
205
|
+
tabs_block: {
|
206
|
+
templates: {
|
207
|
+
accordion: {},
|
208
|
+
},
|
209
|
+
variations: [
|
210
|
+
{ id: 'default', title: 'Default', isDefault: true },
|
211
|
+
{
|
212
|
+
id: 'horizontal-responsive',
|
213
|
+
title: 'Horizontal',
|
214
|
+
isDefault: false,
|
215
|
+
},
|
216
|
+
],
|
217
|
+
},
|
218
|
+
columnsBlock: {},
|
219
|
+
hero: {},
|
220
|
+
group: {},
|
221
|
+
listing: {},
|
222
|
+
dividerBlock: {},
|
223
|
+
callToActionBlock: {},
|
224
|
+
},
|
225
|
+
},
|
226
|
+
views: {
|
227
|
+
layoutViews: {},
|
228
|
+
errorViews: {},
|
229
|
+
},
|
230
|
+
widgets: {
|
231
|
+
views: {
|
232
|
+
id: {
|
233
|
+
taxonomy_themes: undefined,
|
234
|
+
},
|
235
|
+
widget: {
|
236
|
+
tags: undefined,
|
237
|
+
},
|
238
|
+
},
|
239
|
+
},
|
240
|
+
settings: {
|
241
|
+
eea: {},
|
242
|
+
contactForm: '',
|
243
|
+
serverConfig: {
|
244
|
+
extractScripts: {},
|
245
|
+
},
|
246
|
+
showTags: true,
|
247
|
+
dateLocale: '',
|
248
|
+
available_colors: [],
|
249
|
+
expressMiddleware: [],
|
250
|
+
appExtras: [],
|
251
|
+
|
252
|
+
pluggableStyles: [],
|
253
|
+
apiExpanders: [],
|
254
|
+
hasLanguageDropdown: true,
|
255
|
+
themeColors: [],
|
256
|
+
previewText: '',
|
257
|
+
requiredBlocks: [],
|
258
|
+
},
|
259
|
+
};
|
260
|
+
const config = applyConfig(originalConfig);
|
261
|
+
|
262
|
+
expect(config.settings.eea).toEqual(eea);
|
263
|
+
expect(config.settings.contactForm).toBe('/contact');
|
264
|
+
expect(config.settings.serverConfig.extractScripts.errorPages).toBe(true);
|
265
|
+
expect(config.settings.showTags).toBe(false);
|
266
|
+
expect(config.blocks.blocksConfig['teaser'].restricted).toBe(true);
|
267
|
+
expect(config.blocks.blocksConfig['title'].restricted).toBe(false);
|
268
|
+
expect(config.blocks.blocksConfig['description'].restricted).toBe(false);
|
269
|
+
expect(config.settings.dateLocale).toBe('en-gb');
|
270
|
+
expect(config.views.layoutViews['homepage_view']).toBe(
|
271
|
+
'MockedHomePageView',
|
272
|
+
);
|
273
|
+
expect(config.views.layoutViews['homepage_inverse_view']).toBe(
|
274
|
+
'MockedHomePageInverseView',
|
275
|
+
);
|
276
|
+
expect(config.views.errorViews['404']).toBe('MockedNotFound');
|
277
|
+
|
278
|
+
expect(config.blocks.blocksConfig['accordion'].options).toEqual({});
|
279
|
+
expect(config.blocks.blocksConfig['accordion'].defaults.theme).toBe(
|
280
|
+
'secondary',
|
281
|
+
);
|
282
|
+
|
283
|
+
expect(config.blocks.blocksConfig['columnsBlock'].available_colors).toEqual(
|
284
|
+
eea.colors,
|
285
|
+
);
|
286
|
+
expect(config.blocks.blocksConfig['description'].className).toBe(
|
287
|
+
'documentDescription eea callout',
|
288
|
+
);
|
289
|
+
expect(config.blocks.blocksConfig['hero'].copyrightPrefix).toBe('Image');
|
290
|
+
|
291
|
+
expect(config.widgets.views.id.subjects).toBe('MockedTokenWidget');
|
292
|
+
expect(config.settings.expressMiddleware.length).toEqual(2);
|
293
|
+
expect(config.settings.appExtras).toEqual([
|
294
|
+
{ match: '/**', component: 'MockedInpageNavigation' },
|
295
|
+
{ match: '', component: 'MockedCustomCSS' },
|
296
|
+
{ match: '', component: 'MockedDraftBackground' },
|
297
|
+
{ match: '', component: 'MockedSubsiteClass' },
|
298
|
+
{ match: '', component: BaseTag },
|
299
|
+
]);
|
300
|
+
expect(config.settings.available_colors).toEqual(eea.colors);
|
301
|
+
expect(config.settings.hasLanguageDropdown).toBe(false);
|
302
|
+
expect(config.settings.themeColors).toEqual([
|
303
|
+
{ value: undefined, title: 'No theme' },
|
304
|
+
{ value: 'primary', title: 'Primary' },
|
305
|
+
{ value: 'secondary', title: 'Secondary' },
|
306
|
+
{ value: 'tertiary', title: 'Tertiary' },
|
307
|
+
]);
|
308
|
+
expect(config.settings.pluggableStyles).toEqual([
|
309
|
+
{
|
310
|
+
id: 'content-box-gray',
|
311
|
+
title: 'Default',
|
312
|
+
previewComponent: expect.any(Function),
|
313
|
+
viewComponent: expect.any(Function),
|
314
|
+
},
|
315
|
+
{
|
316
|
+
id: 'content-box-primary',
|
317
|
+
title: 'Primary',
|
318
|
+
previewComponent: expect.any(Function),
|
319
|
+
viewComponent: expect.any(Function),
|
320
|
+
},
|
321
|
+
{
|
322
|
+
id: 'content-box-secondary',
|
323
|
+
title: 'Secondary',
|
324
|
+
previewComponent: expect.any(Function),
|
325
|
+
viewComponent: expect.any(Function),
|
326
|
+
},
|
327
|
+
{
|
328
|
+
id: 'content-box-tertiary',
|
329
|
+
title: 'Tertiary',
|
330
|
+
previewComponent: expect.any(Function),
|
331
|
+
viewComponent: expect.any(Function),
|
332
|
+
},
|
333
|
+
]);
|
334
|
+
expect(config.blocks.blocksConfig.image.mostUsed).toBe(false);
|
335
|
+
expect(config.blocks.blocksConfig.video.mostUsed).toBe(false);
|
336
|
+
expect(config.blocks.blocksConfig.dividerBlock.mostUsed).toBe(true);
|
337
|
+
expect(config.blocks.blocksConfig.callToActionBlock.mostUsed).toBe(true);
|
338
|
+
expect(config.blocks.blocksConfig.accordion.mostUsed).toBe(true);
|
339
|
+
expect(config.settings.apiExpanders).toEqual([
|
340
|
+
{ match: '', GET_CONTENT: ['breadcrumbs'] },
|
341
|
+
]);
|
342
|
+
});
|
343
|
+
});
|
@@ -1,109 +0,0 @@
|
|
1
|
-
export default () => ({
|
2
|
-
title: 'Default tabs block',
|
3
|
-
fieldsets: [
|
4
|
-
{
|
5
|
-
id: 'default',
|
6
|
-
title: 'Default',
|
7
|
-
fields: ['description'],
|
8
|
-
},
|
9
|
-
{
|
10
|
-
id: 'menu',
|
11
|
-
title: 'Menu',
|
12
|
-
fields: ['menuAlign', 'menuPosition', 'menuColor', 'menuInverted'],
|
13
|
-
},
|
14
|
-
],
|
15
|
-
properties: {
|
16
|
-
description: {
|
17
|
-
title: 'Description',
|
18
|
-
},
|
19
|
-
menuPosition: {
|
20
|
-
title: 'Position',
|
21
|
-
choices: [
|
22
|
-
['top', 'Top'],
|
23
|
-
['bottom', 'Bottom'],
|
24
|
-
['left side', 'Left side'],
|
25
|
-
['right side', 'Right side'],
|
26
|
-
],
|
27
|
-
},
|
28
|
-
menuAlign: {
|
29
|
-
title: 'Alignment',
|
30
|
-
type: 'array',
|
31
|
-
choices: [
|
32
|
-
['left', 'Left'],
|
33
|
-
['center', 'Center'],
|
34
|
-
['right', 'Right'],
|
35
|
-
['space-between', 'Space between'],
|
36
|
-
],
|
37
|
-
},
|
38
|
-
menuSize: {
|
39
|
-
title: 'Size',
|
40
|
-
choices: [
|
41
|
-
['mini', 'Mini'],
|
42
|
-
['tiny', 'Tiny'],
|
43
|
-
['small', 'Small'],
|
44
|
-
['large', 'Large'],
|
45
|
-
['huge', 'Huge'],
|
46
|
-
['massive', 'Masive'],
|
47
|
-
],
|
48
|
-
},
|
49
|
-
menuColor: {
|
50
|
-
title: 'Color',
|
51
|
-
defaultValue: 'green',
|
52
|
-
choices: [
|
53
|
-
['red', 'Red'],
|
54
|
-
['orange', 'Orange'],
|
55
|
-
['yellow', 'Yellow'],
|
56
|
-
['olive', 'Olive'],
|
57
|
-
['green', 'Green'],
|
58
|
-
['teal', 'Teal'],
|
59
|
-
['blue', 'Blue'],
|
60
|
-
['violet', 'Violet'],
|
61
|
-
['purple', 'Purple'],
|
62
|
-
['pink', 'Pink'],
|
63
|
-
['brown', 'Brown'],
|
64
|
-
['grey', 'Grey'],
|
65
|
-
['black', 'Black'],
|
66
|
-
],
|
67
|
-
},
|
68
|
-
menuBorderless: {
|
69
|
-
title: 'Borderless',
|
70
|
-
type: 'boolean',
|
71
|
-
},
|
72
|
-
menuCompact: {
|
73
|
-
title: 'Compact',
|
74
|
-
type: 'boolean',
|
75
|
-
},
|
76
|
-
menuFluid: {
|
77
|
-
title: 'Fluid',
|
78
|
-
type: 'boolean',
|
79
|
-
value: true,
|
80
|
-
},
|
81
|
-
menuInverted: {
|
82
|
-
title: 'Inverted',
|
83
|
-
type: 'boolean',
|
84
|
-
},
|
85
|
-
menuPointing: {
|
86
|
-
title: 'Pointing',
|
87
|
-
type: 'boolean',
|
88
|
-
value: true,
|
89
|
-
},
|
90
|
-
menuSecondary: {
|
91
|
-
title: 'Secondary',
|
92
|
-
type: 'boolean',
|
93
|
-
value: true,
|
94
|
-
},
|
95
|
-
menuStackable: {
|
96
|
-
title: 'Stackable',
|
97
|
-
type: 'boolean',
|
98
|
-
},
|
99
|
-
menuTabular: {
|
100
|
-
title: 'Tabular',
|
101
|
-
type: 'boolean',
|
102
|
-
},
|
103
|
-
menuText: {
|
104
|
-
title: 'Text',
|
105
|
-
type: 'boolean',
|
106
|
-
},
|
107
|
-
},
|
108
|
-
required: [],
|
109
|
-
});
|