@dhis2/analytics 25.2.0 → 25.2.2
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 +4065 -0
- package/build/cjs/__demo__/FileMenu.stories.js +6 -8
- package/build/cjs/components/FileMenu/FileMenu.js +59 -21
- package/build/cjs/components/FileMenu/__tests__/FileMenu.spec.js +194 -318
- package/build/cjs/components/Options/VisualizationOptions.js +1 -3
- package/build/cjs/index.js +46 -304
- package/build/cjs/locales/en/translations.json +0 -1
- package/build/cjs/locales/nl/translations.json +5 -4
- package/build/es/__demo__/FileMenu.stories.js +6 -7
- package/build/es/components/FileMenu/FileMenu.js +57 -20
- package/build/es/components/FileMenu/__tests__/FileMenu.spec.js +189 -293
- package/build/es/components/Options/VisualizationOptions.js +1 -3
- package/build/es/index.js +0 -1
- package/build/es/locales/en/translations.json +0 -1
- package/build/es/locales/nl/translations.json +5 -4
- package/package.json +1 -3
- package/build/cjs/__demo__/Toolbar.stories.js +0 -77
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuBar.js +0 -107
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +0 -66
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuList.js +0 -94
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +0 -99
- package/build/cjs/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +0 -13
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +0 -219
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +0 -23
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +0 -56
- package/build/cjs/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +0 -50
- package/build/cjs/components/Toolbar/HoverMenuBar/index.js +0 -37
- package/build/cjs/components/Toolbar/InterpretationsAndDetailsToggler.js +0 -50
- package/build/cjs/components/Toolbar/MenuButton.styles.js +0 -13
- package/build/cjs/components/Toolbar/Toolbar.js +0 -39
- package/build/cjs/components/Toolbar/ToolbarSidebar.js +0 -45
- package/build/cjs/components/Toolbar/UpdateButton.js +0 -57
- package/build/cjs/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +0 -50
- package/build/cjs/components/Toolbar/__tests__/Toolbar.spec.js +0 -24
- package/build/cjs/components/Toolbar/__tests__/ToolbarSidebar.spec.js +0 -30
- package/build/cjs/components/Toolbar/__tests__/UpdateButton.spec.js +0 -44
- package/build/cjs/components/Toolbar/index.js +0 -57
- package/build/es/__demo__/Toolbar.stories.js +0 -69
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuBar.js +0 -90
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuDropdown.js +0 -44
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuList.js +0 -75
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.js +0 -78
- package/build/es/components/Toolbar/HoverMenuBar/HoverMenuListItem.styles.js +0 -4
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuBar.spec.js +0 -168
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuDropdown.spec.js +0 -16
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuList.spec.js +0 -49
- package/build/es/components/Toolbar/HoverMenuBar/__tests__/HoverMenuListItem.spec.js +0 -41
- package/build/es/components/Toolbar/HoverMenuBar/index.js +0 -4
- package/build/es/components/Toolbar/InterpretationsAndDetailsToggler.js +0 -33
- package/build/es/components/Toolbar/MenuButton.styles.js +0 -4
- package/build/es/components/Toolbar/Toolbar.js +0 -24
- package/build/es/components/Toolbar/ToolbarSidebar.js +0 -29
- package/build/es/components/Toolbar/UpdateButton.js +0 -38
- package/build/es/components/Toolbar/__tests__/InterpretationsAndDetailsToggler.spec.js +0 -43
- package/build/es/components/Toolbar/__tests__/Toolbar.spec.js +0 -17
- package/build/es/components/Toolbar/__tests__/ToolbarSidebar.spec.js +0 -23
- package/build/es/components/Toolbar/__tests__/UpdateButton.spec.js +0 -37
- package/build/es/components/Toolbar/index.js +0 -5
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import '@testing-library/jest-dom';
|
|
1
|
+
import { SharingDialog } from '@dhis2/ui';
|
|
2
|
+
import { shallow } from 'enzyme';
|
|
4
3
|
import React from 'react';
|
|
5
|
-
import {
|
|
4
|
+
import { OpenFileDialog } from '../../OpenFileDialog/OpenFileDialog.js';
|
|
5
|
+
import { TranslationDialog } from '../../TranslationDialog/index.js';
|
|
6
|
+
import { DeleteDialog } from '../DeleteDialog.js';
|
|
6
7
|
import { FileMenu } from '../FileMenu.js';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* throwing other errors */
|
|
11
|
-
useTranslationsResults: () => ({
|
|
12
|
-
translationsData: undefined,
|
|
13
|
-
fetching: true
|
|
14
|
-
})
|
|
15
|
-
}));
|
|
8
|
+
import { GetLinkDialog } from '../GetLinkDialog.js';
|
|
9
|
+
import { RenameDialog } from '../RenameDialog.js';
|
|
10
|
+
import { SaveAsDialog } from '../SaveAsDialog.js';
|
|
16
11
|
describe('The FileMenu component ', () => {
|
|
12
|
+
let shallowFileMenu;
|
|
13
|
+
let props;
|
|
17
14
|
const onDelete = jest.fn();
|
|
18
15
|
const onError = jest.fn();
|
|
19
16
|
const onNew = jest.fn();
|
|
@@ -23,307 +20,206 @@ describe('The FileMenu component ', () => {
|
|
|
23
20
|
const onSaveAs = jest.fn();
|
|
24
21
|
const onShare = jest.fn();
|
|
25
22
|
const onTranslate = jest.fn();
|
|
26
|
-
const baseProps = {
|
|
27
|
-
currentUser: {
|
|
28
|
-
id: 'u1',
|
|
29
|
-
displayName: 'Test user'
|
|
30
|
-
},
|
|
31
|
-
fileType: 'visualization',
|
|
32
|
-
fileObject: undefined,
|
|
33
|
-
onDelete,
|
|
34
|
-
onError,
|
|
35
|
-
onNew,
|
|
36
|
-
onOpen,
|
|
37
|
-
onRename,
|
|
38
|
-
onSave,
|
|
39
|
-
onSaveAs,
|
|
40
|
-
onShare,
|
|
41
|
-
onTranslate
|
|
42
|
-
};
|
|
43
|
-
const fullAccessProps = {
|
|
44
|
-
fileObject: {
|
|
45
|
-
id: 'test',
|
|
46
|
-
access: {
|
|
47
|
-
delete: true,
|
|
48
|
-
manage: true,
|
|
49
|
-
update: true
|
|
50
|
-
},
|
|
51
|
-
href: 'http://dhis2.org'
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
const renderFileMenu = function () {
|
|
56
|
-
let customProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
57
|
-
const props = { ...baseProps,
|
|
58
|
-
...customProps
|
|
59
|
-
};
|
|
60
|
-
const providerData = {
|
|
61
|
-
translations: {
|
|
62
|
-
translations: {}
|
|
63
|
-
},
|
|
64
|
-
sharing: {
|
|
65
|
-
meta: {
|
|
66
|
-
allowPublicAccess: true
|
|
67
|
-
},
|
|
68
|
-
object: {
|
|
69
|
-
userAccesses: [],
|
|
70
|
-
userGroupAccesses: []
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
return render( /*#__PURE__*/React.createElement(CustomDataProvider, {
|
|
75
|
-
data: providerData
|
|
76
|
-
}, /*#__PURE__*/React.createElement(HoverMenuBar, null, /*#__PURE__*/React.createElement(FileMenu, props))));
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const openDropdown = async () => {
|
|
80
|
-
fireEvent.click(screen.getByTestId('dhis2-analytics-hovermenudropdown'));
|
|
81
|
-
expect(await screen.findByTestId('file-menu-container')).toBeVisible();
|
|
82
|
-
};
|
|
83
23
|
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
text: 'New'
|
|
88
|
-
},
|
|
89
|
-
OPEN: {
|
|
90
|
-
testId: 'file-menu-open',
|
|
91
|
-
text: 'Open…'
|
|
92
|
-
},
|
|
93
|
-
SAVE: {
|
|
94
|
-
testId: 'file-menu-save',
|
|
95
|
-
text: 'Save'
|
|
96
|
-
},
|
|
97
|
-
SAVE_AS: {
|
|
98
|
-
testId: 'file-menu-saveas',
|
|
99
|
-
text: 'Save as…'
|
|
100
|
-
},
|
|
101
|
-
RENAME: {
|
|
102
|
-
testId: 'file-menu-rename',
|
|
103
|
-
text: 'Rename…'
|
|
104
|
-
},
|
|
105
|
-
TRANSLATE: {
|
|
106
|
-
testId: 'file-menu-translate',
|
|
107
|
-
text: 'Translate…'
|
|
108
|
-
},
|
|
109
|
-
SHARE: {
|
|
110
|
-
testId: 'file-menu-sharing',
|
|
111
|
-
text: 'Share…'
|
|
112
|
-
},
|
|
113
|
-
GET_LINK: {
|
|
114
|
-
testId: 'file-menu-getlink',
|
|
115
|
-
text: 'Get link…'
|
|
116
|
-
},
|
|
117
|
-
DELETE: {
|
|
118
|
-
testId: 'file-menu-delete',
|
|
119
|
-
text: 'Delete'
|
|
24
|
+
const getFileMenuComponent = props => {
|
|
25
|
+
if (!shallowFileMenu) {
|
|
26
|
+
shallowFileMenu = shallow( /*#__PURE__*/React.createElement(FileMenu, props));
|
|
120
27
|
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const assertMenuItemsDisabledState = menuItems => {
|
|
124
|
-
for (const menuTitem of menuItems) {
|
|
125
|
-
const li = screen.getByTestId(menuTitem.testId);
|
|
126
|
-
expect(getByText(li, menuTitem.text)).toBeVisible();
|
|
127
28
|
|
|
128
|
-
|
|
129
|
-
expect(li).toHaveClass('disabled');
|
|
130
|
-
} else {
|
|
131
|
-
expect(li).not.toHaveClass('disabled');
|
|
132
|
-
}
|
|
133
|
-
}
|
|
29
|
+
return shallowFileMenu;
|
|
134
30
|
};
|
|
135
31
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
disabled: false
|
|
156
|
-
}]);
|
|
157
|
-
});
|
|
158
|
-
it('renders some disabled buttons when no fileObject is present', async () => {
|
|
159
|
-
renderFileMenu();
|
|
160
|
-
await openDropdown();
|
|
161
|
-
assertMenuItemsDisabledState([{ ...MENU_ITEMS.SAVE_AS,
|
|
162
|
-
disabled: true
|
|
163
|
-
}, { ...MENU_ITEMS.RENAME,
|
|
164
|
-
disabled: true
|
|
165
|
-
}, { ...MENU_ITEMS.TRANSLATE,
|
|
166
|
-
disabled: true
|
|
167
|
-
}, { ...MENU_ITEMS.SHARE,
|
|
168
|
-
disabled: true
|
|
169
|
-
}, { ...MENU_ITEMS.GET_LINK,
|
|
170
|
-
disabled: true
|
|
171
|
-
}, { ...MENU_ITEMS.DELETE,
|
|
172
|
-
disabled: true
|
|
173
|
-
}]);
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
shallowFileMenu = undefined;
|
|
34
|
+
props = {
|
|
35
|
+
currentUser: {
|
|
36
|
+
id: 'u1',
|
|
37
|
+
displayName: 'Test user'
|
|
38
|
+
},
|
|
39
|
+
fileType: 'visualization',
|
|
40
|
+
fileObject: undefined,
|
|
41
|
+
onDelete,
|
|
42
|
+
onError,
|
|
43
|
+
onNew,
|
|
44
|
+
onOpen,
|
|
45
|
+
onRename,
|
|
46
|
+
onSave,
|
|
47
|
+
onSaveAs,
|
|
48
|
+
onShare,
|
|
49
|
+
onTranslate
|
|
50
|
+
};
|
|
174
51
|
});
|
|
175
|
-
it('renders
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
52
|
+
it('renders a button', () => {
|
|
53
|
+
expect(getFileMenuComponent(props).find('button')).toHaveLength(1);
|
|
54
|
+
});
|
|
55
|
+
it('renders some enabled buttons regardless of the access settings', () => {
|
|
56
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
57
|
+
fileMenuComponent.find('button').simulate('click');
|
|
58
|
+
const buttonLabels = ['New', 'Open…'];
|
|
59
|
+
buttonLabels.forEach(buttonLabel => expect(fileMenuComponent.findWhere(n => n.prop('label') === buttonLabel).prop('disabled')).toBe(undefined));
|
|
60
|
+
});
|
|
61
|
+
it('renders some disabled buttons when no fileObject is present', () => {
|
|
62
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
63
|
+
fileMenuComponent.find('button').simulate('click');
|
|
64
|
+
const buttonLabels = ['Save as…', 'Rename…', 'Translate…', 'Share…', 'Get link…', 'Delete'];
|
|
65
|
+
buttonLabels.forEach(buttonLabel => expect(fileMenuComponent.findWhere(n => n.prop('label') === buttonLabel).prop('disabled')).toBe(true));
|
|
66
|
+
});
|
|
67
|
+
it('renders some enabled buttons when update access is granted', () => {
|
|
68
|
+
props.fileObject = {
|
|
69
|
+
id: 'test',
|
|
70
|
+
access: {
|
|
71
|
+
delete: false,
|
|
72
|
+
manage: false,
|
|
73
|
+
update: true
|
|
184
74
|
}
|
|
185
75
|
};
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}, { ...MENU_ITEMS.RENAME,
|
|
191
|
-
disabled: false
|
|
192
|
-
}, { ...MENU_ITEMS.TRANSLATE,
|
|
193
|
-
disabled: false
|
|
194
|
-
}]);
|
|
76
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
77
|
+
fileMenuComponent.find('button').simulate('click');
|
|
78
|
+
const buttonLabels = ['Save', 'Rename…', 'Translate…'];
|
|
79
|
+
buttonLabels.forEach(buttonLabel => expect(fileMenuComponent.findWhere(n => n.prop('label') === buttonLabel).prop('disabled')).toBe(false));
|
|
195
80
|
});
|
|
196
|
-
it('renders enabled Delete button when delete access is granted',
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
update: false
|
|
204
|
-
}
|
|
81
|
+
it('renders enabled Delete button when delete access is granted', () => {
|
|
82
|
+
props.fileObject = {
|
|
83
|
+
id: 'test',
|
|
84
|
+
access: {
|
|
85
|
+
delete: true,
|
|
86
|
+
manage: false,
|
|
87
|
+
update: false
|
|
205
88
|
}
|
|
206
89
|
};
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
disabled: false
|
|
211
|
-
}]);
|
|
90
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
91
|
+
fileMenuComponent.find('button').simulate('click');
|
|
92
|
+
expect(fileMenuComponent.findWhere(n => n.prop('label') === 'Delete').prop('disabled')).toBe(false);
|
|
212
93
|
});
|
|
213
|
-
it('renders enabled Share button when manage access is granted',
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
update: false
|
|
221
|
-
}
|
|
94
|
+
it('renders enabled Share button when manage access is granted', () => {
|
|
95
|
+
props.fileObject = {
|
|
96
|
+
id: 'test',
|
|
97
|
+
access: {
|
|
98
|
+
delete: false,
|
|
99
|
+
manage: true,
|
|
100
|
+
update: false
|
|
222
101
|
}
|
|
223
102
|
};
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
fireEvent.click(screen.getByTestId(MENU_ITEMS.RENAME.testId));
|
|
242
|
-
expect(await screen.findByText('Rename visualization', {
|
|
243
|
-
selector: 'h1'
|
|
244
|
-
})).toBeVisible();
|
|
245
|
-
});
|
|
246
|
-
it('renders the TranslationDialog when the Translate button is clicked', async () => {
|
|
247
|
-
renderFileMenu(fullAccessProps);
|
|
248
|
-
await openDropdown();
|
|
249
|
-
fireEvent.click(screen.getByTestId(MENU_ITEMS.TRANSLATE.testId));
|
|
250
|
-
expect(await screen.findByText('Translate', {
|
|
251
|
-
exact: false,
|
|
252
|
-
selector: 'h1'
|
|
253
|
-
})).toBeVisible();
|
|
254
|
-
});
|
|
255
|
-
it('renders the SharingDialog when the Share button is clicked', async () => {
|
|
256
|
-
renderFileMenu(fullAccessProps);
|
|
257
|
-
await openDropdown();
|
|
258
|
-
fireEvent.click(screen.getByTestId(MENU_ITEMS.SHARE.testId));
|
|
259
|
-
expect(await screen.findByText('Sharing and access', {
|
|
260
|
-
selector: 'h1'
|
|
261
|
-
})).toBeVisible();
|
|
262
|
-
});
|
|
263
|
-
it('renders the GetLinkDialog when the Get link button is clicked', async () => {
|
|
264
|
-
const url = 'http://localhost/dhis-web-data-visualizer/#/test';
|
|
265
|
-
renderFileMenu(fullAccessProps);
|
|
266
|
-
await openDropdown();
|
|
267
|
-
fireEvent.click(screen.getByTestId(MENU_ITEMS.GET_LINK.testId));
|
|
268
|
-
expect(await screen.findByTestId('dhis2-uicore-modal')).toBeVisible();
|
|
269
|
-
expect(screen.getByRole('link', {
|
|
270
|
-
name: url
|
|
271
|
-
})).toHaveAttribute('href', url);
|
|
272
|
-
});
|
|
273
|
-
it('renders the DeleteDialog when the Delete button is clicked', async () => {
|
|
274
|
-
const customProps = {
|
|
275
|
-
fileObject: {
|
|
276
|
-
id: 'delete-test',
|
|
277
|
-
access: {
|
|
278
|
-
delete: true,
|
|
279
|
-
manage: true,
|
|
280
|
-
update: true
|
|
281
|
-
}
|
|
103
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
104
|
+
fileMenuComponent.find('button').simulate('click');
|
|
105
|
+
expect(fileMenuComponent.findWhere(n => n.prop('label') === 'Share…').prop('disabled')).toBe(false);
|
|
106
|
+
});
|
|
107
|
+
it('renders the OpenFileDialog component when the Open button is clicked', () => {
|
|
108
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
109
|
+
fileMenuComponent.find('button').simulate('click');
|
|
110
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Open…').simulate('click');
|
|
111
|
+
expect(fileMenuComponent.find(OpenFileDialog)).toHaveLength(1);
|
|
112
|
+
});
|
|
113
|
+
it('renders the RenameDialog when the Rename button is clicked', () => {
|
|
114
|
+
props.fileObject = {
|
|
115
|
+
id: 'test',
|
|
116
|
+
access: {
|
|
117
|
+
delete: true,
|
|
118
|
+
manage: true,
|
|
119
|
+
update: true
|
|
282
120
|
}
|
|
283
121
|
};
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
expect(
|
|
288
|
-
selector: 'h1'
|
|
289
|
-
})).toBeVisible();
|
|
122
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
123
|
+
fileMenuComponent.find('button').simulate('click');
|
|
124
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Rename…').simulate('click');
|
|
125
|
+
expect(fileMenuComponent.find(RenameDialog)).toHaveLength(1);
|
|
290
126
|
});
|
|
291
|
-
it('renders the
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
127
|
+
it('renders the TranslationDialog when the Translate button is clicked', () => {
|
|
128
|
+
props.fileObject = {
|
|
129
|
+
id: 'test',
|
|
130
|
+
access: {
|
|
131
|
+
delete: true,
|
|
132
|
+
manage: true,
|
|
133
|
+
update: true
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
137
|
+
fileMenuComponent.find('button').simulate('click');
|
|
138
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Translate…').simulate('click');
|
|
139
|
+
expect(fileMenuComponent.find(TranslationDialog)).toHaveLength(1);
|
|
298
140
|
});
|
|
299
|
-
it('renders the
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
141
|
+
it('renders the SharingDialog when the Share button is clicked', () => {
|
|
142
|
+
props.fileObject = {
|
|
143
|
+
id: 'test',
|
|
144
|
+
access: {
|
|
145
|
+
delete: true,
|
|
146
|
+
manage: true,
|
|
147
|
+
update: true
|
|
306
148
|
}
|
|
307
149
|
};
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
expect(
|
|
312
|
-
selector: 'h1'
|
|
313
|
-
})).toBeVisible();
|
|
150
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
151
|
+
fileMenuComponent.find('button').simulate('click');
|
|
152
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Share…').simulate('click');
|
|
153
|
+
expect(fileMenuComponent.find(SharingDialog)).toHaveLength(1);
|
|
314
154
|
});
|
|
315
|
-
it('
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
155
|
+
it('renders the GetLinkDialog when the Get link button is clicked', () => {
|
|
156
|
+
props.fileObject = {
|
|
157
|
+
id: 'test',
|
|
158
|
+
access: {
|
|
159
|
+
delete: true,
|
|
160
|
+
manage: true,
|
|
161
|
+
update: true
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
165
|
+
fileMenuComponent.find('button').simulate('click');
|
|
166
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Get link…').simulate('click');
|
|
167
|
+
expect(fileMenuComponent.find(GetLinkDialog)).toHaveLength(1);
|
|
168
|
+
});
|
|
169
|
+
it('renders the DeleteDialog when the Delete button is clicked', () => {
|
|
170
|
+
props.fileObject = {
|
|
171
|
+
id: 'delete-test',
|
|
172
|
+
access: {
|
|
173
|
+
delete: true,
|
|
174
|
+
manage: true,
|
|
175
|
+
update: true
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
179
|
+
fileMenuComponent.find('button').simulate('click');
|
|
180
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Delete').simulate('click');
|
|
181
|
+
expect(fileMenuComponent.find(DeleteDialog)).toHaveLength(1);
|
|
321
182
|
});
|
|
322
|
-
it('
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
183
|
+
it('renders the SaveAsDialog when the Save as… button is clicked', () => {
|
|
184
|
+
props.fileObject = {
|
|
185
|
+
id: 'test',
|
|
186
|
+
access: {
|
|
187
|
+
delete: true,
|
|
188
|
+
manage: true,
|
|
189
|
+
update: true
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
193
|
+
fileMenuComponent.find('button').simulate('click');
|
|
194
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Save as…').simulate('click');
|
|
195
|
+
expect(fileMenuComponent.find(SaveAsDialog)).toHaveLength(1);
|
|
196
|
+
});
|
|
197
|
+
it('renders the SaveAsDialog when the Save… button is clicked but no fileObject is present', () => {
|
|
198
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
199
|
+
fileMenuComponent.find('button').simulate('click');
|
|
200
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Save…').simulate('click');
|
|
201
|
+
expect(fileMenuComponent.find(SaveAsDialog)).toHaveLength(1);
|
|
202
|
+
});
|
|
203
|
+
it('calls the onSave callback when the Save button is clicked and a fileObject is present', () => {
|
|
204
|
+
props.fileObject = {
|
|
205
|
+
id: 'test',
|
|
206
|
+
access: {
|
|
207
|
+
delete: true,
|
|
208
|
+
manage: true,
|
|
209
|
+
update: true
|
|
210
|
+
}
|
|
211
|
+
};
|
|
212
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
213
|
+
fileMenuComponent.find('button').simulate('click');
|
|
214
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Save').simulate('click');
|
|
215
|
+
expect(fileMenuComponent.find(OpenFileDialog).prop('open')).toBe(false);
|
|
216
|
+
expect(onSave).toHaveBeenCalled();
|
|
217
|
+
});
|
|
218
|
+
it('calls the onNew callback when the New button is clicked', () => {
|
|
219
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
220
|
+
fileMenuComponent.find('button').simulate('click');
|
|
221
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'New').simulate('click');
|
|
222
|
+
expect(fileMenuComponent.find(OpenFileDialog).prop('open')).toBe(false);
|
|
223
|
+
expect(onNew).toHaveBeenCalled();
|
|
328
224
|
});
|
|
329
225
|
});
|
|
@@ -6,12 +6,11 @@ import { modalContent, tabSection, tabSectionTitle, tabSectionTitleMargin, tabSe
|
|
|
6
6
|
|
|
7
7
|
const VisualizationOptions = _ref => {
|
|
8
8
|
let {
|
|
9
|
-
initiallyActiveTabKey,
|
|
10
9
|
optionsConfig,
|
|
11
10
|
onClose,
|
|
12
11
|
onUpdate
|
|
13
12
|
} = _ref;
|
|
14
|
-
const [activeTabKey, setActiveTabKey] = useState(
|
|
13
|
+
const [activeTabKey, setActiveTabKey] = useState();
|
|
15
14
|
|
|
16
15
|
const generateTabContent = sections => sections.map(_ref2 => {
|
|
17
16
|
let {
|
|
@@ -93,7 +92,6 @@ const VisualizationOptions = _ref => {
|
|
|
93
92
|
|
|
94
93
|
VisualizationOptions.propTypes = {
|
|
95
94
|
optionsConfig: PropTypes.array.isRequired,
|
|
96
|
-
initiallyActiveTabKey: PropTypes.string,
|
|
97
95
|
onClose: PropTypes.func,
|
|
98
96
|
onUpdate: PropTypes.func
|
|
99
97
|
};
|
package/build/es/index.js
CHANGED
|
@@ -16,7 +16,6 @@ export { default as LegendKey } from './components/LegendKey/LegendKey.js';
|
|
|
16
16
|
export { default as AboutAOUnit } from './components/AboutAOUnit/AboutAOUnit.js';
|
|
17
17
|
export { InterpretationsUnit } from './components/Interpretations/InterpretationsUnit/InterpretationsUnit.js';
|
|
18
18
|
export { InterpretationModal } from './components/Interpretations/InterpretationModal/InterpretationModal.js';
|
|
19
|
-
export * from './components/Toolbar/index.js';
|
|
20
19
|
export { TranslationDialog } from './components/TranslationDialog/index.js';
|
|
21
20
|
export { OfflineTooltip } from './components/OfflineTooltip.js';
|
|
22
21
|
export { CachedDataQueryProvider, useCachedDataQuery } from './components/CachedDataQueryProvider.js'; // Api
|
|
@@ -267,7 +267,6 @@
|
|
|
267
267
|
"Six-months": "Six-months",
|
|
268
268
|
"Financial Years": "Financial Years",
|
|
269
269
|
"Years": "Years",
|
|
270
|
-
"Interpretations and details": "Interpretations and details",
|
|
271
270
|
"Translating to": "Translating to",
|
|
272
271
|
"Choose a locale": "Choose a locale",
|
|
273
272
|
"Base locale reference": "Base locale reference",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"Drag items here, or double click in the list, to start building a calculation formula": "",
|
|
45
45
|
"Math operators": "",
|
|
46
46
|
"Data Type": "",
|
|
47
|
-
"All types": "",
|
|
47
|
+
"All types": "Alle typen",
|
|
48
48
|
"Disaggregation": "",
|
|
49
49
|
"No data": "Geen gegevens",
|
|
50
50
|
"Search by data item name": "",
|
|
51
|
-
"No items selected": "",
|
|
51
|
+
"No items selected": "Geen items geselecteerd",
|
|
52
52
|
"Selected Items": "",
|
|
53
53
|
"No indicators found": "",
|
|
54
54
|
"No data sets found": "",
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
"No data sets found for \"{{- searchTerm}}\"": "",
|
|
59
59
|
"No event data items found for \"{{- searchTerm}}\"": "",
|
|
60
60
|
"No program indicators found for \"{{- searchTerm}}\"": "",
|
|
61
|
-
"Nothing found for \"{{- searchTerm}}\"": "",
|
|
61
|
+
"Nothing found for \"{{- searchTerm}}\"": "Niets gevonden voor \"{{- zoekTerm}}\"",
|
|
62
62
|
"Calculation": "",
|
|
63
63
|
"Metric type": "",
|
|
64
64
|
"All metrics": "",
|
|
65
|
-
"Move to {{axisName}}": "",
|
|
65
|
+
"Move to {{axisName}}": "Ga naar {{axisNaam}}",
|
|
66
66
|
"Add to {{axisName}}": "Voeg toe aan {{axisName}}",
|
|
67
67
|
"Not available for {{visualizationType}}": "",
|
|
68
68
|
"Remove Assigned Categories": "",
|
|
@@ -267,6 +267,7 @@
|
|
|
267
267
|
"Six-months": "",
|
|
268
268
|
"Financial Years": "",
|
|
269
269
|
"Years": "Jaren",
|
|
270
|
+
"Interpretations and details": "",
|
|
270
271
|
"Translating to": "",
|
|
271
272
|
"Choose a locale": "",
|
|
272
273
|
"Base locale reference": "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2/analytics",
|
|
3
|
-
"version": "25.2.
|
|
3
|
+
"version": "25.2.2",
|
|
4
4
|
"main": "./build/cjs/index.js",
|
|
5
5
|
"module": "./build/es/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -40,8 +40,6 @@
|
|
|
40
40
|
"@storybook/addons": "^6.5.9",
|
|
41
41
|
"@storybook/preset-create-react-app": "^3.1.7",
|
|
42
42
|
"@storybook/react": "^6.1.14",
|
|
43
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
44
|
-
"@testing-library/react": "^12.1.5",
|
|
45
43
|
"enzyme": "^3.9.0",
|
|
46
44
|
"enzyme-adapter-react-16": "^1.15.6",
|
|
47
45
|
"fs-extra": "^10.1.0",
|