@dhis2/analytics 25.2.1 → 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/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/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,29 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _ui = require("@dhis2/ui");
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _enzyme = require("enzyme");
|
|
6
6
|
|
|
7
|
-
require("
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _OpenFileDialog = require("../../OpenFileDialog/OpenFileDialog.js");
|
|
10
10
|
|
|
11
|
-
var _index = require("../../
|
|
11
|
+
var _index = require("../../TranslationDialog/index.js");
|
|
12
|
+
|
|
13
|
+
var _DeleteDialog = require("../DeleteDialog.js");
|
|
12
14
|
|
|
13
15
|
var _FileMenu = require("../FileMenu.js");
|
|
14
16
|
|
|
17
|
+
var _GetLinkDialog = require("../GetLinkDialog.js");
|
|
18
|
+
|
|
19
|
+
var _RenameDialog = require("../RenameDialog.js");
|
|
20
|
+
|
|
21
|
+
var _SaveAsDialog = require("../SaveAsDialog.js");
|
|
22
|
+
|
|
15
23
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
24
|
|
|
17
|
-
jest.mock('../../TranslationDialog/TranslationModal/useTranslationsResults.js', () => ({
|
|
18
|
-
/* This will keep the translation dialog in
|
|
19
|
-
* a loading state, which prevents it from
|
|
20
|
-
* throwing other errors */
|
|
21
|
-
useTranslationsResults: () => ({
|
|
22
|
-
translationsData: undefined,
|
|
23
|
-
fetching: true
|
|
24
|
-
})
|
|
25
|
-
}));
|
|
26
25
|
describe('The FileMenu component ', () => {
|
|
26
|
+
let shallowFileMenu;
|
|
27
|
+
let props;
|
|
27
28
|
const onDelete = jest.fn();
|
|
28
29
|
const onError = jest.fn();
|
|
29
30
|
const onNew = jest.fn();
|
|
@@ -33,331 +34,206 @@ describe('The FileMenu component ', () => {
|
|
|
33
34
|
const onSaveAs = jest.fn();
|
|
34
35
|
const onShare = jest.fn();
|
|
35
36
|
const onTranslate = jest.fn();
|
|
36
|
-
const baseProps = {
|
|
37
|
-
currentUser: {
|
|
38
|
-
id: 'u1',
|
|
39
|
-
displayName: 'Test user'
|
|
40
|
-
},
|
|
41
|
-
fileType: 'visualization',
|
|
42
|
-
fileObject: undefined,
|
|
43
|
-
onDelete,
|
|
44
|
-
onError,
|
|
45
|
-
onNew,
|
|
46
|
-
onOpen,
|
|
47
|
-
onRename,
|
|
48
|
-
onSave,
|
|
49
|
-
onSaveAs,
|
|
50
|
-
onShare,
|
|
51
|
-
onTranslate
|
|
52
|
-
};
|
|
53
|
-
const fullAccessProps = {
|
|
54
|
-
fileObject: {
|
|
55
|
-
id: 'test',
|
|
56
|
-
access: {
|
|
57
|
-
delete: true,
|
|
58
|
-
manage: true,
|
|
59
|
-
update: true
|
|
60
|
-
},
|
|
61
|
-
href: 'http://dhis2.org'
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
37
|
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
...customProps
|
|
69
|
-
};
|
|
70
|
-
const providerData = {
|
|
71
|
-
translations: {
|
|
72
|
-
translations: {}
|
|
73
|
-
},
|
|
74
|
-
sharing: {
|
|
75
|
-
meta: {
|
|
76
|
-
allowPublicAccess: true
|
|
77
|
-
},
|
|
78
|
-
object: {
|
|
79
|
-
userAccesses: [],
|
|
80
|
-
userGroupAccesses: []
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
return (0, _react.render)( /*#__PURE__*/_react2.default.createElement(_appRuntime.CustomDataProvider, {
|
|
85
|
-
data: providerData
|
|
86
|
-
}, /*#__PURE__*/_react2.default.createElement(_index.HoverMenuBar, null, /*#__PURE__*/_react2.default.createElement(_FileMenu.FileMenu, props))));
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const openDropdown = async () => {
|
|
90
|
-
_react.fireEvent.click(_react.screen.getByTestId('dhis2-analytics-hovermenudropdown'));
|
|
91
|
-
|
|
92
|
-
expect(await _react.screen.findByTestId('file-menu-container')).toBeVisible();
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const MENU_ITEMS = {
|
|
96
|
-
NEW: {
|
|
97
|
-
testId: 'file-menu-new',
|
|
98
|
-
text: 'New'
|
|
99
|
-
},
|
|
100
|
-
OPEN: {
|
|
101
|
-
testId: 'file-menu-open',
|
|
102
|
-
text: 'Open…'
|
|
103
|
-
},
|
|
104
|
-
SAVE: {
|
|
105
|
-
testId: 'file-menu-save',
|
|
106
|
-
text: 'Save'
|
|
107
|
-
},
|
|
108
|
-
SAVE_AS: {
|
|
109
|
-
testId: 'file-menu-saveas',
|
|
110
|
-
text: 'Save as…'
|
|
111
|
-
},
|
|
112
|
-
RENAME: {
|
|
113
|
-
testId: 'file-menu-rename',
|
|
114
|
-
text: 'Rename…'
|
|
115
|
-
},
|
|
116
|
-
TRANSLATE: {
|
|
117
|
-
testId: 'file-menu-translate',
|
|
118
|
-
text: 'Translate…'
|
|
119
|
-
},
|
|
120
|
-
SHARE: {
|
|
121
|
-
testId: 'file-menu-sharing',
|
|
122
|
-
text: 'Share…'
|
|
123
|
-
},
|
|
124
|
-
GET_LINK: {
|
|
125
|
-
testId: 'file-menu-getlink',
|
|
126
|
-
text: 'Get link…'
|
|
127
|
-
},
|
|
128
|
-
DELETE: {
|
|
129
|
-
testId: 'file-menu-delete',
|
|
130
|
-
text: 'Delete'
|
|
38
|
+
const getFileMenuComponent = props => {
|
|
39
|
+
if (!shallowFileMenu) {
|
|
40
|
+
shallowFileMenu = (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_FileMenu.FileMenu, props));
|
|
131
41
|
}
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
const assertMenuItemsDisabledState = menuItems => {
|
|
135
|
-
for (const menuTitem of menuItems) {
|
|
136
|
-
const li = _react.screen.getByTestId(menuTitem.testId);
|
|
137
42
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (menuTitem.disabled) {
|
|
141
|
-
expect(li).toHaveClass('disabled');
|
|
142
|
-
} else {
|
|
143
|
-
expect(li).not.toHaveClass('disabled');
|
|
144
|
-
}
|
|
145
|
-
}
|
|
43
|
+
return shallowFileMenu;
|
|
146
44
|
};
|
|
147
45
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
disabled: false
|
|
168
|
-
}, { ...MENU_ITEMS.OPEN,
|
|
169
|
-
disabled: false
|
|
170
|
-
}]);
|
|
171
|
-
});
|
|
172
|
-
it('renders some disabled buttons when no fileObject is present', async () => {
|
|
173
|
-
renderFileMenu();
|
|
174
|
-
await openDropdown();
|
|
175
|
-
assertMenuItemsDisabledState([{ ...MENU_ITEMS.SAVE_AS,
|
|
176
|
-
disabled: true
|
|
177
|
-
}, { ...MENU_ITEMS.RENAME,
|
|
178
|
-
disabled: true
|
|
179
|
-
}, { ...MENU_ITEMS.TRANSLATE,
|
|
180
|
-
disabled: true
|
|
181
|
-
}, { ...MENU_ITEMS.SHARE,
|
|
182
|
-
disabled: true
|
|
183
|
-
}, { ...MENU_ITEMS.GET_LINK,
|
|
184
|
-
disabled: true
|
|
185
|
-
}, { ...MENU_ITEMS.DELETE,
|
|
186
|
-
disabled: true
|
|
187
|
-
}]);
|
|
46
|
+
beforeEach(() => {
|
|
47
|
+
shallowFileMenu = undefined;
|
|
48
|
+
props = {
|
|
49
|
+
currentUser: {
|
|
50
|
+
id: 'u1',
|
|
51
|
+
displayName: 'Test user'
|
|
52
|
+
},
|
|
53
|
+
fileType: 'visualization',
|
|
54
|
+
fileObject: undefined,
|
|
55
|
+
onDelete,
|
|
56
|
+
onError,
|
|
57
|
+
onNew,
|
|
58
|
+
onOpen,
|
|
59
|
+
onRename,
|
|
60
|
+
onSave,
|
|
61
|
+
onSaveAs,
|
|
62
|
+
onShare,
|
|
63
|
+
onTranslate
|
|
64
|
+
};
|
|
188
65
|
});
|
|
189
|
-
it('renders
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
66
|
+
it('renders a button', () => {
|
|
67
|
+
expect(getFileMenuComponent(props).find('button')).toHaveLength(1);
|
|
68
|
+
});
|
|
69
|
+
it('renders some enabled buttons regardless of the access settings', () => {
|
|
70
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
71
|
+
fileMenuComponent.find('button').simulate('click');
|
|
72
|
+
const buttonLabels = ['New', 'Open…'];
|
|
73
|
+
buttonLabels.forEach(buttonLabel => expect(fileMenuComponent.findWhere(n => n.prop('label') === buttonLabel).prop('disabled')).toBe(undefined));
|
|
74
|
+
});
|
|
75
|
+
it('renders some disabled buttons when no fileObject is present', () => {
|
|
76
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
77
|
+
fileMenuComponent.find('button').simulate('click');
|
|
78
|
+
const buttonLabels = ['Save as…', 'Rename…', 'Translate…', 'Share…', 'Get link…', 'Delete'];
|
|
79
|
+
buttonLabels.forEach(buttonLabel => expect(fileMenuComponent.findWhere(n => n.prop('label') === buttonLabel).prop('disabled')).toBe(true));
|
|
80
|
+
});
|
|
81
|
+
it('renders some enabled buttons when update access is granted', () => {
|
|
82
|
+
props.fileObject = {
|
|
83
|
+
id: 'test',
|
|
84
|
+
access: {
|
|
85
|
+
delete: false,
|
|
86
|
+
manage: false,
|
|
87
|
+
update: true
|
|
198
88
|
}
|
|
199
89
|
};
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}, { ...MENU_ITEMS.RENAME,
|
|
205
|
-
disabled: false
|
|
206
|
-
}, { ...MENU_ITEMS.TRANSLATE,
|
|
207
|
-
disabled: false
|
|
208
|
-
}]);
|
|
90
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
91
|
+
fileMenuComponent.find('button').simulate('click');
|
|
92
|
+
const buttonLabels = ['Save', 'Rename…', 'Translate…'];
|
|
93
|
+
buttonLabels.forEach(buttonLabel => expect(fileMenuComponent.findWhere(n => n.prop('label') === buttonLabel).prop('disabled')).toBe(false));
|
|
209
94
|
});
|
|
210
|
-
it('renders enabled Delete button when delete access is granted',
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
update: false
|
|
218
|
-
}
|
|
95
|
+
it('renders enabled Delete button when delete access is granted', () => {
|
|
96
|
+
props.fileObject = {
|
|
97
|
+
id: 'test',
|
|
98
|
+
access: {
|
|
99
|
+
delete: true,
|
|
100
|
+
manage: false,
|
|
101
|
+
update: false
|
|
219
102
|
}
|
|
220
103
|
};
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
disabled: false
|
|
225
|
-
}]);
|
|
104
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
105
|
+
fileMenuComponent.find('button').simulate('click');
|
|
106
|
+
expect(fileMenuComponent.findWhere(n => n.prop('label') === 'Delete').prop('disabled')).toBe(false);
|
|
226
107
|
});
|
|
227
|
-
it('renders enabled Share button when manage access is granted',
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
update: false
|
|
235
|
-
}
|
|
108
|
+
it('renders enabled Share button when manage access is granted', () => {
|
|
109
|
+
props.fileObject = {
|
|
110
|
+
id: 'test',
|
|
111
|
+
access: {
|
|
112
|
+
delete: false,
|
|
113
|
+
manage: true,
|
|
114
|
+
update: false
|
|
236
115
|
}
|
|
237
116
|
};
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
renderFileMenu(fullAccessProps);
|
|
256
|
-
await openDropdown();
|
|
257
|
-
|
|
258
|
-
_react.fireEvent.click(_react.screen.getByTestId(MENU_ITEMS.RENAME.testId));
|
|
259
|
-
|
|
260
|
-
expect(await _react.screen.findByText('Rename visualization', {
|
|
261
|
-
selector: 'h1'
|
|
262
|
-
})).toBeVisible();
|
|
263
|
-
});
|
|
264
|
-
it('renders the TranslationDialog when the Translate button is clicked', async () => {
|
|
265
|
-
renderFileMenu(fullAccessProps);
|
|
266
|
-
await openDropdown();
|
|
267
|
-
|
|
268
|
-
_react.fireEvent.click(_react.screen.getByTestId(MENU_ITEMS.TRANSLATE.testId));
|
|
269
|
-
|
|
270
|
-
expect(await _react.screen.findByText('Translate', {
|
|
271
|
-
exact: false,
|
|
272
|
-
selector: 'h1'
|
|
273
|
-
})).toBeVisible();
|
|
274
|
-
});
|
|
275
|
-
it('renders the SharingDialog when the Share button is clicked', async () => {
|
|
276
|
-
renderFileMenu(fullAccessProps);
|
|
277
|
-
await openDropdown();
|
|
278
|
-
|
|
279
|
-
_react.fireEvent.click(_react.screen.getByTestId(MENU_ITEMS.SHARE.testId));
|
|
280
|
-
|
|
281
|
-
expect(await _react.screen.findByText('Sharing and access', {
|
|
282
|
-
selector: 'h1'
|
|
283
|
-
})).toBeVisible();
|
|
284
|
-
});
|
|
285
|
-
it('renders the GetLinkDialog when the Get link button is clicked', async () => {
|
|
286
|
-
const url = 'http://localhost/dhis-web-data-visualizer/#/test';
|
|
287
|
-
renderFileMenu(fullAccessProps);
|
|
288
|
-
await openDropdown();
|
|
289
|
-
|
|
290
|
-
_react.fireEvent.click(_react.screen.getByTestId(MENU_ITEMS.GET_LINK.testId));
|
|
291
|
-
|
|
292
|
-
expect(await _react.screen.findByTestId('dhis2-uicore-modal')).toBeVisible();
|
|
293
|
-
expect(_react.screen.getByRole('link', {
|
|
294
|
-
name: url
|
|
295
|
-
})).toHaveAttribute('href', url);
|
|
296
|
-
});
|
|
297
|
-
it('renders the DeleteDialog when the Delete button is clicked', async () => {
|
|
298
|
-
const customProps = {
|
|
299
|
-
fileObject: {
|
|
300
|
-
id: 'delete-test',
|
|
301
|
-
access: {
|
|
302
|
-
delete: true,
|
|
303
|
-
manage: true,
|
|
304
|
-
update: true
|
|
305
|
-
}
|
|
117
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
118
|
+
fileMenuComponent.find('button').simulate('click');
|
|
119
|
+
expect(fileMenuComponent.findWhere(n => n.prop('label') === 'Share…').prop('disabled')).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
it('renders the OpenFileDialog component when the Open button is clicked', () => {
|
|
122
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
123
|
+
fileMenuComponent.find('button').simulate('click');
|
|
124
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Open…').simulate('click');
|
|
125
|
+
expect(fileMenuComponent.find(_OpenFileDialog.OpenFileDialog)).toHaveLength(1);
|
|
126
|
+
});
|
|
127
|
+
it('renders the RenameDialog when the Rename button is clicked', () => {
|
|
128
|
+
props.fileObject = {
|
|
129
|
+
id: 'test',
|
|
130
|
+
access: {
|
|
131
|
+
delete: true,
|
|
132
|
+
manage: true,
|
|
133
|
+
update: true
|
|
306
134
|
}
|
|
307
135
|
};
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
expect(await _react.screen.findByText('Delete visualization', {
|
|
314
|
-
selector: 'h1'
|
|
315
|
-
})).toBeVisible();
|
|
136
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
137
|
+
fileMenuComponent.find('button').simulate('click');
|
|
138
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Rename…').simulate('click');
|
|
139
|
+
expect(fileMenuComponent.find(_RenameDialog.RenameDialog)).toHaveLength(1);
|
|
316
140
|
});
|
|
317
|
-
it('renders the
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
}
|
|
141
|
+
it('renders the TranslationDialog when the Translate button is clicked', () => {
|
|
142
|
+
props.fileObject = {
|
|
143
|
+
id: 'test',
|
|
144
|
+
access: {
|
|
145
|
+
delete: true,
|
|
146
|
+
manage: true,
|
|
147
|
+
update: true
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
151
|
+
fileMenuComponent.find('button').simulate('click');
|
|
152
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Translate…').simulate('click');
|
|
153
|
+
expect(fileMenuComponent.find(_index.TranslationDialog)).toHaveLength(1);
|
|
326
154
|
});
|
|
327
|
-
it('renders the
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
155
|
+
it('renders the SharingDialog when the Share button is clicked', () => {
|
|
156
|
+
props.fileObject = {
|
|
157
|
+
id: 'test',
|
|
158
|
+
access: {
|
|
159
|
+
delete: true,
|
|
160
|
+
manage: true,
|
|
161
|
+
update: true
|
|
334
162
|
}
|
|
335
163
|
};
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
expect(await _react.screen.findByText('Save visualization as', {
|
|
342
|
-
selector: 'h1'
|
|
343
|
-
})).toBeVisible();
|
|
164
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
165
|
+
fileMenuComponent.find('button').simulate('click');
|
|
166
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Share…').simulate('click');
|
|
167
|
+
expect(fileMenuComponent.find(_ui.SharingDialog)).toHaveLength(1);
|
|
344
168
|
});
|
|
345
|
-
it('
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
169
|
+
it('renders the GetLinkDialog when the Get link button is clicked', () => {
|
|
170
|
+
props.fileObject = {
|
|
171
|
+
id: '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') === 'Get link…').simulate('click');
|
|
181
|
+
expect(fileMenuComponent.find(_GetLinkDialog.GetLinkDialog)).toHaveLength(1);
|
|
182
|
+
});
|
|
183
|
+
it('renders the DeleteDialog when the Delete button is clicked', () => {
|
|
184
|
+
props.fileObject = {
|
|
185
|
+
id: 'delete-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') === 'Delete').simulate('click');
|
|
195
|
+
expect(fileMenuComponent.find(_DeleteDialog.DeleteDialog)).toHaveLength(1);
|
|
353
196
|
});
|
|
354
|
-
it('
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
197
|
+
it('renders the SaveAsDialog when the Save as… button is clicked', () => {
|
|
198
|
+
props.fileObject = {
|
|
199
|
+
id: 'test',
|
|
200
|
+
access: {
|
|
201
|
+
delete: true,
|
|
202
|
+
manage: true,
|
|
203
|
+
update: true
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
207
|
+
fileMenuComponent.find('button').simulate('click');
|
|
208
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Save as…').simulate('click');
|
|
209
|
+
expect(fileMenuComponent.find(_SaveAsDialog.SaveAsDialog)).toHaveLength(1);
|
|
210
|
+
});
|
|
211
|
+
it('renders the SaveAsDialog when the Save… button is clicked but no fileObject is present', () => {
|
|
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(_SaveAsDialog.SaveAsDialog)).toHaveLength(1);
|
|
216
|
+
});
|
|
217
|
+
it('calls the onSave callback when the Save button is clicked and a fileObject is present', () => {
|
|
218
|
+
props.fileObject = {
|
|
219
|
+
id: 'test',
|
|
220
|
+
access: {
|
|
221
|
+
delete: true,
|
|
222
|
+
manage: true,
|
|
223
|
+
update: true
|
|
224
|
+
}
|
|
225
|
+
};
|
|
226
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
227
|
+
fileMenuComponent.find('button').simulate('click');
|
|
228
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'Save').simulate('click');
|
|
229
|
+
expect(fileMenuComponent.find(_OpenFileDialog.OpenFileDialog).prop('open')).toBe(false);
|
|
230
|
+
expect(onSave).toHaveBeenCalled();
|
|
231
|
+
});
|
|
232
|
+
it('calls the onNew callback when the New button is clicked', () => {
|
|
233
|
+
const fileMenuComponent = getFileMenuComponent(props);
|
|
234
|
+
fileMenuComponent.find('button').simulate('click');
|
|
235
|
+
fileMenuComponent.findWhere(n => n.prop('label') === 'New').simulate('click');
|
|
236
|
+
expect(fileMenuComponent.find(_OpenFileDialog.OpenFileDialog).prop('open')).toBe(false);
|
|
237
|
+
expect(onNew).toHaveBeenCalled();
|
|
362
238
|
});
|
|
363
239
|
});
|
|
@@ -23,12 +23,11 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
23
|
|
|
24
24
|
const VisualizationOptions = _ref => {
|
|
25
25
|
let {
|
|
26
|
-
initiallyActiveTabKey,
|
|
27
26
|
optionsConfig,
|
|
28
27
|
onClose,
|
|
29
28
|
onUpdate
|
|
30
29
|
} = _ref;
|
|
31
|
-
const [activeTabKey, setActiveTabKey] = (0, _react.useState)(
|
|
30
|
+
const [activeTabKey, setActiveTabKey] = (0, _react.useState)();
|
|
32
31
|
|
|
33
32
|
const generateTabContent = sections => sections.map(_ref2 => {
|
|
34
33
|
let {
|
|
@@ -110,7 +109,6 @@ const VisualizationOptions = _ref => {
|
|
|
110
109
|
|
|
111
110
|
VisualizationOptions.propTypes = {
|
|
112
111
|
optionsConfig: _propTypes.default.array.isRequired,
|
|
113
|
-
initiallyActiveTabKey: _propTypes.default.string,
|
|
114
112
|
onClose: _propTypes.default.func,
|
|
115
113
|
onUpdate: _propTypes.default.func
|
|
116
114
|
};
|