-
Notifications
You must be signed in to change notification settings - Fork 13
/
test-setup-config.js
85 lines (79 loc) · 2.13 KB
/
test-setup-config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
* This is the mocked config registry loader for tests.
* It uses some of the default (real) configuration,
* (mainly) DraftJS one, to not differ too much from reality
* Ideally, we should mock this ones as well at some point.
* Views, Widgets and Blocks are mocked already, to keep
* snapshot consistency and readability.
*/
import '@plone/volto/config';
import config from '@plone/volto/registry';
import applyItaliaConfig from './src';
applyItaliaConfig(config);
config.set('settings', {
...config.settings,
apiPath: 'http://localhost:8080/Plone',
lazyBundles: {
cms: [
'prettierStandalone',
'prettierParserHtml',
'prismCore',
'toastify',
'reactSelect',
'reactSortableHOC',
'moment',
'rrule',
// 'diffLib',
],
},
apiExpanders: [],
publicURL: 'http://localhost:3000',
});
function BaseWidget(name) {
return (props) => (
<div id={`mocked-field-${props.id}`} className={`mocked-${name}-widget`}>
{props.title || 'No title'} - {props.description || 'No description'}
</div>
);
}
config.set('widgets', {
...config.widgets,
id: {
schema: BaseWidget('schema'),
subjects: BaseWidget('subjects'),
query: BaseWidget('query'),
recurrence: BaseWidget('recurrence'),
remoteUrl: BaseWidget('remoteurl'),
},
widget: {
richtext: BaseWidget('richtext'),
textarea: BaseWidget('textarea'),
datetime: BaseWidget('datetime'),
date: BaseWidget('date'),
password: BaseWidget('password'),
file: BaseWidget('file'),
align: BaseWidget('align'),
url: BaseWidget('url'),
email: BaseWidget('email'),
object_browser: BaseWidget('object_browser'),
},
vocabulary: {},
factory: {},
choices: BaseWidget('choices'),
type: {
boolean: BaseWidget('boolean'),
array: BaseWidget('array'),
object: BaseWidget('object'),
datetime: BaseWidget('datetime'),
date: BaseWidget('date'),
password: BaseWidget('password'),
number: BaseWidget('number'),
integer: BaseWidget('integer'),
},
default: BaseWidget('default'),
});
config.set('experimental', {
addBlockButton: {
enabled: false,
},
});