@openneuro/app 4.2.1 → 4.2.5-alpha.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/jestsetup.ts +0 -5
- package/package.json +7 -13
- package/src/scripts/common/forms/__tests__/__snapshots__/warn-button.spec.jsx.snap +26 -26
- package/src/scripts/common/forms/__tests__/warn-button.spec.jsx +7 -5
- package/src/scripts/datalad/subscriptions/__tests__/__snapshots__/files-subscription.spec.jsx.snap +1 -159
- package/src/scripts/datalad/subscriptions/__tests__/files-subscription.spec.jsx +6 -3
- package/src/scripts/errors/errorRoute.jsx +4 -23
- package/src/scripts/faq/__tests__/__snapshots__/faq.spec.jsx.snap +183 -154
- package/src/scripts/faq/__tests__/faq.spec.jsx +3 -3
- package/src/scripts/refactor_2021/admin/admin.jsx +1 -7
- package/src/scripts/refactor_2021/dataset/comments/__tests__/__snapshots__/comments.spec.jsx.snap +12 -110
- package/src/scripts/refactor_2021/dataset/comments/__tests__/comments.spec.jsx +7 -5
- package/src/scripts/refactor_2021/dataset/dataset-routes.jsx +0 -11
- package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/download-command-line.spec.jsx.snap +8 -9
- package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/download-link.spec.jsx.snap +46 -1255
- package/src/scripts/refactor_2021/dataset/download/__tests__/__snapshots__/shell-example.spec.jsx.snap +3 -4
- package/src/scripts/refactor_2021/dataset/download/__tests__/download-command-line.spec.jsx +10 -11
- package/src/scripts/refactor_2021/dataset/download/__tests__/download-link.spec.jsx +3 -3
- package/src/scripts/refactor_2021/dataset/download/__tests__/shell-example.spec.jsx +3 -3
- package/src/scripts/refactor_2021/dataset/download/download-command-line.jsx +1 -1
- package/src/scripts/refactor_2021/dataset/draft-container.tsx +11 -22
- package/src/scripts/refactor_2021/dataset/draft-snapshot-routes.tsx +1 -6
- package/src/scripts/refactor_2021/dataset/files/__tests__/__snapshots__/file-tree.spec.jsx.snap +24 -49
- package/src/scripts/refactor_2021/dataset/files/__tests__/__snapshots__/file.spec.jsx.snap +74 -54
- package/src/scripts/refactor_2021/dataset/files/__tests__/file-tree-unloaded-directory.spec.jsx +4 -3
- package/src/scripts/refactor_2021/dataset/files/__tests__/file-tree.spec.jsx +23 -19
- package/src/scripts/refactor_2021/dataset/files/__tests__/file-viewer-type.spec.jsx +5 -3
- package/src/scripts/refactor_2021/dataset/files/__tests__/file.spec.jsx +21 -21
- package/src/scripts/refactor_2021/dataset/files/file.jsx +3 -2
- package/src/scripts/refactor_2021/dataset/files/viewers/__tests__/__snapshots__/file-viewer-json.spec.jsx.snap +85 -60
- package/src/scripts/refactor_2021/dataset/files/viewers/__tests__/file-viewer-json.spec.jsx +5 -5
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/cancel-button.spec.tsx.snap +14 -6
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/edit-button.spec.tsx.snap +14 -6
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/save-button.spec.tsx.snap +14 -6
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/__snapshots__/select-input.spec.tsx.snap +178 -105
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/cancel-button.spec.tsx +3 -3
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-button.spec.tsx +3 -3
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/edit-list.spec.jsx +0 -1
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/save-button.spec.tsx +3 -3
- package/src/scripts/refactor_2021/dataset/fragments/__tests__/select-input.spec.tsx +9 -9
- package/src/scripts/refactor_2021/dataset/fragments/select-input.tsx +1 -1
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/description.spec.jsx.snap +3 -277
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/description.spec.jsx +22 -9
- package/src/scripts/refactor_2021/dataset/mutations/update-file.jsx +15 -19
- package/src/scripts/refactor_2021/dataset/routes/__tests__/__snapshots__/publish.spec.jsx.snap +3 -0
- package/src/scripts/refactor_2021/dataset/routes/__tests__/publish.spec.jsx +13 -0
- package/src/scripts/refactor_2021/dataset/snapshot-container.tsx +4 -8
- package/src/scripts/refactor_2021/routes.tsx +9 -9
- package/src/scripts/refactor_2021/uploader/uploader-setup-routes.jsx +4 -24
- package/src/scripts/refactor_2021/uploader/uploader-status-routes.jsx +1 -6
- package/src/scripts/common/forms/__tests__/__snapshots__/input.spec.jsx.snap +0 -13
- package/src/scripts/common/forms/__tests__/input.spec.jsx +0 -25
- package/src/scripts/common/forms/input.jsx +0 -98
- package/src/scripts/datalad/routes/__tests__/__snapshots__/publish.spec.jsx.snap +0 -14
- package/src/scripts/datalad/routes/__tests__/publish.spec.jsx +0 -10
- package/src/scripts/datalad/routes/mobile-class.tsx +0 -16
- package/src/scripts/datalad/routes/publish.jsx +0 -50
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { render, fireEvent, screen } from '@testing-library/react'
|
|
3
3
|
import SelectInput from '../select-input'
|
|
4
4
|
|
|
5
5
|
describe('SelectInput', () => {
|
|
6
6
|
it('handles display as disabled', () => {
|
|
7
|
-
const
|
|
7
|
+
const { asFragment } = render(
|
|
8
8
|
<SelectInput
|
|
9
9
|
{...{
|
|
10
10
|
name: 'Expected name',
|
|
@@ -16,10 +16,10 @@ describe('SelectInput', () => {
|
|
|
16
16
|
}}
|
|
17
17
|
/>,
|
|
18
18
|
)
|
|
19
|
-
expect(
|
|
19
|
+
expect(asFragment()).toMatchSnapshot()
|
|
20
20
|
})
|
|
21
21
|
it('handles display as not disabled', () => {
|
|
22
|
-
const
|
|
22
|
+
const { asFragment } = render(
|
|
23
23
|
<SelectInput
|
|
24
24
|
{...{
|
|
25
25
|
name: 'Expected name',
|
|
@@ -31,10 +31,10 @@ describe('SelectInput', () => {
|
|
|
31
31
|
}}
|
|
32
32
|
/>,
|
|
33
33
|
)
|
|
34
|
-
expect(
|
|
34
|
+
expect(asFragment()).toMatchSnapshot()
|
|
35
35
|
})
|
|
36
36
|
it('handles boolean display', () => {
|
|
37
|
-
const
|
|
37
|
+
const { asFragment } = render(
|
|
38
38
|
<SelectInput
|
|
39
39
|
{...{
|
|
40
40
|
name: 'Expected name',
|
|
@@ -50,12 +50,12 @@ describe('SelectInput', () => {
|
|
|
50
50
|
}}
|
|
51
51
|
/>,
|
|
52
52
|
)
|
|
53
|
-
expect(
|
|
53
|
+
expect(asFragment()).toMatchSnapshot()
|
|
54
54
|
})
|
|
55
55
|
it('handles boolean values', () => {
|
|
56
56
|
let _, value
|
|
57
57
|
const onChange = (...args) => ([_, value] = args)
|
|
58
|
-
|
|
58
|
+
render(
|
|
59
59
|
<SelectInput
|
|
60
60
|
{...{
|
|
61
61
|
name: 'Expected name',
|
|
@@ -78,7 +78,7 @@ describe('SelectInput', () => {
|
|
|
78
78
|
},
|
|
79
79
|
target: { value: 'false' },
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
fireEvent.change(screen.getByRole('combobox'), event)
|
|
82
82
|
expect(value).toBe(false)
|
|
83
83
|
})
|
|
84
84
|
})
|
|
@@ -1,281 +1,7 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`UpdateDescription mutation renders with common props 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"definitions": Array [
|
|
8
|
-
Object {
|
|
9
|
-
"directives": Array [],
|
|
10
|
-
"kind": "OperationDefinition",
|
|
11
|
-
"name": Object {
|
|
12
|
-
"kind": "Name",
|
|
13
|
-
"value": "updateDescription",
|
|
14
|
-
},
|
|
15
|
-
"operation": "mutation",
|
|
16
|
-
"selectionSet": Object {
|
|
17
|
-
"kind": "SelectionSet",
|
|
18
|
-
"selections": Array [
|
|
19
|
-
Object {
|
|
20
|
-
"alias": undefined,
|
|
21
|
-
"arguments": Array [
|
|
22
|
-
Object {
|
|
23
|
-
"kind": "Argument",
|
|
24
|
-
"name": Object {
|
|
25
|
-
"kind": "Name",
|
|
26
|
-
"value": "datasetId",
|
|
27
|
-
},
|
|
28
|
-
"value": Object {
|
|
29
|
-
"kind": "Variable",
|
|
30
|
-
"name": Object {
|
|
31
|
-
"kind": "Name",
|
|
32
|
-
"value": "datasetId",
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
Object {
|
|
37
|
-
"kind": "Argument",
|
|
38
|
-
"name": Object {
|
|
39
|
-
"kind": "Name",
|
|
40
|
-
"value": "field",
|
|
41
|
-
},
|
|
42
|
-
"value": Object {
|
|
43
|
-
"kind": "Variable",
|
|
44
|
-
"name": Object {
|
|
45
|
-
"kind": "Name",
|
|
46
|
-
"value": "field",
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
Object {
|
|
51
|
-
"kind": "Argument",
|
|
52
|
-
"name": Object {
|
|
53
|
-
"kind": "Name",
|
|
54
|
-
"value": "value",
|
|
55
|
-
},
|
|
56
|
-
"value": Object {
|
|
57
|
-
"kind": "Variable",
|
|
58
|
-
"name": Object {
|
|
59
|
-
"kind": "Name",
|
|
60
|
-
"value": "value",
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
],
|
|
65
|
-
"directives": Array [],
|
|
66
|
-
"kind": "Field",
|
|
67
|
-
"name": Object {
|
|
68
|
-
"kind": "Name",
|
|
69
|
-
"value": "updateDescription",
|
|
70
|
-
},
|
|
71
|
-
"selectionSet": Object {
|
|
72
|
-
"kind": "SelectionSet",
|
|
73
|
-
"selections": Array [
|
|
74
|
-
Object {
|
|
75
|
-
"alias": undefined,
|
|
76
|
-
"arguments": Array [],
|
|
77
|
-
"directives": Array [],
|
|
78
|
-
"kind": "Field",
|
|
79
|
-
"name": Object {
|
|
80
|
-
"kind": "Name",
|
|
81
|
-
"value": "id",
|
|
82
|
-
},
|
|
83
|
-
"selectionSet": undefined,
|
|
84
|
-
},
|
|
85
|
-
Object {
|
|
86
|
-
"alias": undefined,
|
|
87
|
-
"arguments": Array [],
|
|
88
|
-
"directives": Array [],
|
|
89
|
-
"kind": "Field",
|
|
90
|
-
"name": Object {
|
|
91
|
-
"kind": "Name",
|
|
92
|
-
"value": "Name",
|
|
93
|
-
},
|
|
94
|
-
"selectionSet": undefined,
|
|
95
|
-
},
|
|
96
|
-
Object {
|
|
97
|
-
"alias": undefined,
|
|
98
|
-
"arguments": Array [],
|
|
99
|
-
"directives": Array [],
|
|
100
|
-
"kind": "Field",
|
|
101
|
-
"name": Object {
|
|
102
|
-
"kind": "Name",
|
|
103
|
-
"value": "BIDSVersion",
|
|
104
|
-
},
|
|
105
|
-
"selectionSet": undefined,
|
|
106
|
-
},
|
|
107
|
-
Object {
|
|
108
|
-
"alias": undefined,
|
|
109
|
-
"arguments": Array [],
|
|
110
|
-
"directives": Array [],
|
|
111
|
-
"kind": "Field",
|
|
112
|
-
"name": Object {
|
|
113
|
-
"kind": "Name",
|
|
114
|
-
"value": "License",
|
|
115
|
-
},
|
|
116
|
-
"selectionSet": undefined,
|
|
117
|
-
},
|
|
118
|
-
Object {
|
|
119
|
-
"alias": undefined,
|
|
120
|
-
"arguments": Array [],
|
|
121
|
-
"directives": Array [],
|
|
122
|
-
"kind": "Field",
|
|
123
|
-
"name": Object {
|
|
124
|
-
"kind": "Name",
|
|
125
|
-
"value": "Authors",
|
|
126
|
-
},
|
|
127
|
-
"selectionSet": undefined,
|
|
128
|
-
},
|
|
129
|
-
Object {
|
|
130
|
-
"alias": undefined,
|
|
131
|
-
"arguments": Array [],
|
|
132
|
-
"directives": Array [],
|
|
133
|
-
"kind": "Field",
|
|
134
|
-
"name": Object {
|
|
135
|
-
"kind": "Name",
|
|
136
|
-
"value": "Acknowledgements",
|
|
137
|
-
},
|
|
138
|
-
"selectionSet": undefined,
|
|
139
|
-
},
|
|
140
|
-
Object {
|
|
141
|
-
"alias": undefined,
|
|
142
|
-
"arguments": Array [],
|
|
143
|
-
"directives": Array [],
|
|
144
|
-
"kind": "Field",
|
|
145
|
-
"name": Object {
|
|
146
|
-
"kind": "Name",
|
|
147
|
-
"value": "HowToAcknowledge",
|
|
148
|
-
},
|
|
149
|
-
"selectionSet": undefined,
|
|
150
|
-
},
|
|
151
|
-
Object {
|
|
152
|
-
"alias": undefined,
|
|
153
|
-
"arguments": Array [],
|
|
154
|
-
"directives": Array [],
|
|
155
|
-
"kind": "Field",
|
|
156
|
-
"name": Object {
|
|
157
|
-
"kind": "Name",
|
|
158
|
-
"value": "Funding",
|
|
159
|
-
},
|
|
160
|
-
"selectionSet": undefined,
|
|
161
|
-
},
|
|
162
|
-
Object {
|
|
163
|
-
"alias": undefined,
|
|
164
|
-
"arguments": Array [],
|
|
165
|
-
"directives": Array [],
|
|
166
|
-
"kind": "Field",
|
|
167
|
-
"name": Object {
|
|
168
|
-
"kind": "Name",
|
|
169
|
-
"value": "ReferencesAndLinks",
|
|
170
|
-
},
|
|
171
|
-
"selectionSet": undefined,
|
|
172
|
-
},
|
|
173
|
-
Object {
|
|
174
|
-
"alias": undefined,
|
|
175
|
-
"arguments": Array [],
|
|
176
|
-
"directives": Array [],
|
|
177
|
-
"kind": "Field",
|
|
178
|
-
"name": Object {
|
|
179
|
-
"kind": "Name",
|
|
180
|
-
"value": "DatasetDOI",
|
|
181
|
-
},
|
|
182
|
-
"selectionSet": undefined,
|
|
183
|
-
},
|
|
184
|
-
Object {
|
|
185
|
-
"alias": undefined,
|
|
186
|
-
"arguments": Array [],
|
|
187
|
-
"directives": Array [],
|
|
188
|
-
"kind": "Field",
|
|
189
|
-
"name": Object {
|
|
190
|
-
"kind": "Name",
|
|
191
|
-
"value": "EthicsApprovals",
|
|
192
|
-
},
|
|
193
|
-
"selectionSet": undefined,
|
|
194
|
-
},
|
|
195
|
-
],
|
|
196
|
-
},
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
},
|
|
200
|
-
"variableDefinitions": Array [
|
|
201
|
-
Object {
|
|
202
|
-
"defaultValue": undefined,
|
|
203
|
-
"directives": Array [],
|
|
204
|
-
"kind": "VariableDefinition",
|
|
205
|
-
"type": Object {
|
|
206
|
-
"kind": "NonNullType",
|
|
207
|
-
"type": Object {
|
|
208
|
-
"kind": "NamedType",
|
|
209
|
-
"name": Object {
|
|
210
|
-
"kind": "Name",
|
|
211
|
-
"value": "ID",
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
},
|
|
215
|
-
"variable": Object {
|
|
216
|
-
"kind": "Variable",
|
|
217
|
-
"name": Object {
|
|
218
|
-
"kind": "Name",
|
|
219
|
-
"value": "datasetId",
|
|
220
|
-
},
|
|
221
|
-
},
|
|
222
|
-
},
|
|
223
|
-
Object {
|
|
224
|
-
"defaultValue": undefined,
|
|
225
|
-
"directives": Array [],
|
|
226
|
-
"kind": "VariableDefinition",
|
|
227
|
-
"type": Object {
|
|
228
|
-
"kind": "NonNullType",
|
|
229
|
-
"type": Object {
|
|
230
|
-
"kind": "NamedType",
|
|
231
|
-
"name": Object {
|
|
232
|
-
"kind": "Name",
|
|
233
|
-
"value": "String",
|
|
234
|
-
},
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
"variable": Object {
|
|
238
|
-
"kind": "Variable",
|
|
239
|
-
"name": Object {
|
|
240
|
-
"kind": "Name",
|
|
241
|
-
"value": "field",
|
|
242
|
-
},
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
Object {
|
|
246
|
-
"defaultValue": undefined,
|
|
247
|
-
"directives": Array [],
|
|
248
|
-
"kind": "VariableDefinition",
|
|
249
|
-
"type": Object {
|
|
250
|
-
"kind": "NonNullType",
|
|
251
|
-
"type": Object {
|
|
252
|
-
"kind": "NamedType",
|
|
253
|
-
"name": Object {
|
|
254
|
-
"kind": "Name",
|
|
255
|
-
"value": "String",
|
|
256
|
-
},
|
|
257
|
-
},
|
|
258
|
-
},
|
|
259
|
-
"variable": Object {
|
|
260
|
-
"kind": "Variable",
|
|
261
|
-
"name": Object {
|
|
262
|
-
"kind": "Name",
|
|
263
|
-
"value": "value",
|
|
264
|
-
},
|
|
265
|
-
},
|
|
266
|
-
},
|
|
267
|
-
],
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
"kind": "Document",
|
|
271
|
-
"loc": Object {
|
|
272
|
-
"end": 374,
|
|
273
|
-
"start": 0,
|
|
274
|
-
},
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
update={[Function]}
|
|
278
|
-
>
|
|
279
|
-
<Component />
|
|
280
|
-
</Mutation>
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
Mutation mock
|
|
6
|
+
</DocumentFragment>
|
|
281
7
|
`;
|
|
@@ -1,47 +1,60 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { MockedProvider } from '@apollo/client/testing'
|
|
3
4
|
import UpdateDescription, {
|
|
4
5
|
mergeFieldValue,
|
|
5
6
|
UPDATE_DESCRIPTION,
|
|
6
7
|
UPDATE_DESCRIPTION_LIST,
|
|
7
8
|
} from '../description.jsx'
|
|
8
9
|
|
|
10
|
+
const mockMutation = jest.fn()
|
|
11
|
+
jest.mock('@apollo/client/react/components', () => ({
|
|
12
|
+
...jest.requireActual('@apollo/client/react/components'),
|
|
13
|
+
Mutation: props => {
|
|
14
|
+
mockMutation(props)
|
|
15
|
+
return <>Mutation mock</>
|
|
16
|
+
},
|
|
17
|
+
}))
|
|
18
|
+
|
|
9
19
|
describe('UpdateDescription mutation', () => {
|
|
10
20
|
it('renders with common props', () => {
|
|
11
|
-
const
|
|
21
|
+
const { asFragment } = render(
|
|
12
22
|
<UpdateDescription
|
|
13
23
|
datasetId="ds001"
|
|
14
24
|
field="Name"
|
|
15
25
|
value="New Name"
|
|
16
26
|
done={jest.fn()}
|
|
17
27
|
/>,
|
|
28
|
+
{ wrapper: MockedProvider },
|
|
18
29
|
)
|
|
19
|
-
expect(
|
|
30
|
+
expect(asFragment()).toMatchSnapshot()
|
|
20
31
|
})
|
|
21
32
|
it('uses the scalar mutation for scalar values', () => {
|
|
22
|
-
|
|
33
|
+
render(
|
|
23
34
|
<UpdateDescription
|
|
24
35
|
datasetId="ds001"
|
|
25
36
|
field="Name"
|
|
26
37
|
value="New Name"
|
|
27
38
|
done={jest.fn()}
|
|
28
39
|
/>,
|
|
40
|
+
{ wrapper: MockedProvider },
|
|
29
41
|
)
|
|
30
|
-
expect(
|
|
31
|
-
UPDATE_DESCRIPTION,
|
|
42
|
+
expect(mockMutation).toHaveBeenCalledWith(
|
|
43
|
+
expect.objectContaining({ mutation: UPDATE_DESCRIPTION }),
|
|
32
44
|
)
|
|
33
45
|
})
|
|
34
46
|
it('uses the list mutation for array values', () => {
|
|
35
|
-
|
|
47
|
+
render(
|
|
36
48
|
<UpdateDescription
|
|
37
49
|
datasetId="ds001"
|
|
38
50
|
field="Authors"
|
|
39
51
|
value={['John Doe', 'Jane Doe']}
|
|
40
52
|
done={jest.fn()}
|
|
41
53
|
/>,
|
|
54
|
+
{ wrapper: MockedProvider },
|
|
42
55
|
)
|
|
43
|
-
expect(
|
|
44
|
-
UPDATE_DESCRIPTION_LIST,
|
|
56
|
+
expect(mockMutation).toHaveBeenCalledWith(
|
|
57
|
+
expect.objectContaining({ mutation: UPDATE_DESCRIPTION_LIST }),
|
|
45
58
|
)
|
|
46
59
|
})
|
|
47
60
|
describe('mergeFieldValue()', () => {
|
|
@@ -1,37 +1,33 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import PropTypes from 'prop-types'
|
|
3
3
|
import UploaderContext from '../../uploader/uploader-context.js'
|
|
4
|
-
import { Tooltip } from '@openneuro/components/tooltip'
|
|
5
4
|
|
|
6
5
|
const UpdateFile = ({
|
|
7
6
|
datasetId,
|
|
8
7
|
directory = false,
|
|
9
8
|
multiple = false,
|
|
10
9
|
path = null,
|
|
11
|
-
tooltip = '',
|
|
12
10
|
children,
|
|
13
11
|
}) => {
|
|
14
12
|
return (
|
|
15
13
|
<UploaderContext.Consumer>
|
|
16
14
|
{uploader => (
|
|
17
15
|
<div className="edit-file">
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{children}
|
|
34
|
-
</Tooltip>
|
|
16
|
+
<input
|
|
17
|
+
type="file"
|
|
18
|
+
className="update-file"
|
|
19
|
+
onChange={e => {
|
|
20
|
+
e.preventDefault()
|
|
21
|
+
uploader.resumeDataset(
|
|
22
|
+
datasetId,
|
|
23
|
+
path,
|
|
24
|
+
false,
|
|
25
|
+
)({ files: e.target.files })
|
|
26
|
+
}}
|
|
27
|
+
webkitdirectory={directory && 'true'}
|
|
28
|
+
multiple={multiple && true}
|
|
29
|
+
/>
|
|
30
|
+
{children}
|
|
35
31
|
</div>
|
|
36
32
|
)}
|
|
37
33
|
</UploaderContext.Consumer>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
|
+
import { MemoryRouter } from 'react-router-dom'
|
|
4
|
+
import Publish from '../publish.jsx'
|
|
5
|
+
|
|
6
|
+
describe('Publish dataset route', () => {
|
|
7
|
+
it('renders with common props', () => {
|
|
8
|
+
const { asFragment } = render(<Publish datasetId="ds00001" />, {
|
|
9
|
+
wrapper: MemoryRouter,
|
|
10
|
+
})
|
|
11
|
+
expect(asFragment).toMatchSnapshot()
|
|
12
|
+
})
|
|
13
|
+
})
|
|
@@ -173,8 +173,7 @@ const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
|
|
|
173
173
|
fileTree={true}
|
|
174
174
|
id="collapse-tree"
|
|
175
175
|
expandLabel="Read More"
|
|
176
|
-
|
|
177
|
-
>
|
|
176
|
+
collapseLabel="Collapse">
|
|
178
177
|
<Files
|
|
179
178
|
datasetId={datasetId}
|
|
180
179
|
snapshotTag={snapshot.tag}
|
|
@@ -192,8 +191,7 @@ const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
|
|
|
192
191
|
<ReadMore
|
|
193
192
|
id="readme"
|
|
194
193
|
expandLabel="Read More"
|
|
195
|
-
|
|
196
|
-
>
|
|
194
|
+
collapseLabel="Collapse">
|
|
197
195
|
<Markdown>
|
|
198
196
|
{snapshot.readme == null ? 'N/A' : snapshot.readme}
|
|
199
197
|
</Markdown>
|
|
@@ -378,8 +376,7 @@ const SnapshotContainer: React.FC<SnapshotContainerProps> = ({
|
|
|
378
376
|
isOpen={deprecatedmodalIsOpen}
|
|
379
377
|
toggle={() => setDeprecatedModalIsOpen(prevIsOpen => !prevIsOpen)}
|
|
380
378
|
closeText={'close'}
|
|
381
|
-
className="deprecated-modal"
|
|
382
|
-
>
|
|
379
|
+
className="deprecated-modal">
|
|
383
380
|
<p>
|
|
384
381
|
You have selected a deprecated version. The author of the dataset
|
|
385
382
|
does not recommend this specific version.
|
|
@@ -437,8 +434,7 @@ const SnapshotLoader: React.FC<SnapshotLoaderProps> = ({ dataset, tag }) => {
|
|
|
437
434
|
datasetId: dataset.id,
|
|
438
435
|
fetchMore,
|
|
439
436
|
error: null,
|
|
440
|
-
}}
|
|
441
|
-
>
|
|
437
|
+
}}>
|
|
442
438
|
<SnapshotContainer
|
|
443
439
|
dataset={dataset}
|
|
444
440
|
tag={tag}
|
|
@@ -17,15 +17,15 @@ import FourOFourPage from '../errors/404page'
|
|
|
17
17
|
|
|
18
18
|
const Routes: React.VoidFunctionComponent = () => (
|
|
19
19
|
<Switch>
|
|
20
|
-
<Route
|
|
21
|
-
<Route
|
|
22
|
-
<Route
|
|
23
|
-
<Route
|
|
24
|
-
<Route
|
|
25
|
-
<Route
|
|
26
|
-
<Route
|
|
27
|
-
<Route
|
|
28
|
-
<Route
|
|
20
|
+
<Route exact path="/faq" component={FAQS} />
|
|
21
|
+
<Route exact path="/" component={FrontPageContainer} />
|
|
22
|
+
<Route exact path="/keygen" component={APIKey} />
|
|
23
|
+
<Route path="/datasets" component={Dataset} />
|
|
24
|
+
<Route path="/search" component={SearchRoutes} />
|
|
25
|
+
<Route path="/admin" component={Admin} />
|
|
26
|
+
<Route path="/error" component={ErrorRoute} />
|
|
27
|
+
<Route path="/pet" component={PETRedirect} />
|
|
28
|
+
<Route path="/cite" component={Citation} />
|
|
29
29
|
<Redirect from="/public" to="/search" />
|
|
30
30
|
<Redirect from="/saved" to="/search?bookmarks" />
|
|
31
31
|
<Redirect from="/dashboard" to="/search?mydatasets" />
|
|
@@ -14,30 +14,10 @@ const UploaderSetupRoutes = props => (
|
|
|
14
14
|
<div className="tasks-col fade-in">
|
|
15
15
|
<div id="upload-tabs" className="uploader">
|
|
16
16
|
<Switch location={props.location}>
|
|
17
|
-
<Route
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
component={UploadSelect}
|
|
22
|
-
/>
|
|
23
|
-
<Route
|
|
24
|
-
name="upload-issues"
|
|
25
|
-
path="/upload/issues"
|
|
26
|
-
exact
|
|
27
|
-
component={UploadIssues}
|
|
28
|
-
/>
|
|
29
|
-
<Route
|
|
30
|
-
name="upload-metadata"
|
|
31
|
-
path="/upload/metadata"
|
|
32
|
-
exact
|
|
33
|
-
component={UploadMetadata}
|
|
34
|
-
/>
|
|
35
|
-
<Route
|
|
36
|
-
name="upload-disclaimer"
|
|
37
|
-
path="/upload/disclaimer"
|
|
38
|
-
exact
|
|
39
|
-
component={UploadDisclaimer}
|
|
40
|
-
/>
|
|
17
|
+
<Route path="/upload" exact component={UploadSelect} />
|
|
18
|
+
<Route path="/upload/issues" exact component={UploadIssues} />
|
|
19
|
+
<Route path="/upload/metadata" exact component={UploadMetadata} />
|
|
20
|
+
<Route path="/upload/disclaimer" exact component={UploadDisclaimer} />
|
|
41
21
|
</Switch>
|
|
42
22
|
</div>
|
|
43
23
|
</div>
|
|
@@ -9,12 +9,7 @@ const UploaderStatusRoutes = props => (
|
|
|
9
9
|
<div className="tasks-col fade-in">
|
|
10
10
|
<div id="upload-tabs" className="uploader">
|
|
11
11
|
<Switch location={props.location}>
|
|
12
|
-
<Route
|
|
13
|
-
name="upload-status"
|
|
14
|
-
path="/upload"
|
|
15
|
-
exact
|
|
16
|
-
component={UploadStatus}
|
|
17
|
-
/>
|
|
12
|
+
<Route path="/upload" exact component={UploadStatus} />
|
|
18
13
|
</Switch>
|
|
19
14
|
</div>
|
|
20
15
|
</div>
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { shallow, mount } from 'enzyme'
|
|
3
|
-
import Input from '../input'
|
|
4
|
-
|
|
5
|
-
describe('common/forms/Input', () => {
|
|
6
|
-
it('renders successfully', () => {
|
|
7
|
-
const wrapper = shallow(<Input initialValue="test-value" />)
|
|
8
|
-
expect(wrapper).toMatchSnapshot()
|
|
9
|
-
})
|
|
10
|
-
it('resets when remounted', () => {
|
|
11
|
-
const initValue = 'one'
|
|
12
|
-
const newValue = 'two'
|
|
13
|
-
const component = mount(<Input initialValue={initValue} />)
|
|
14
|
-
const input = component.find('input')
|
|
15
|
-
expect(component.state('value')).toBe(initValue)
|
|
16
|
-
|
|
17
|
-
// User types in a value
|
|
18
|
-
input.simulate('change', { target: { value: newValue } })
|
|
19
|
-
expect(component.state('value')).toBe(newValue)
|
|
20
|
-
|
|
21
|
-
// Reset by parent component (cleared)
|
|
22
|
-
component.setProps({ value: initValue })
|
|
23
|
-
expect(component.state('value')).toBe(initValue)
|
|
24
|
-
})
|
|
25
|
-
})
|