@openneuro/app 4.2.3 → 4.3.0-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 +8 -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/dataset/dataset-query-fragments.js +6 -0
- 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-query.jsx +2 -4
- package/src/scripts/refactor_2021/dataset/dataset-routes.jsx +6 -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 +6 -23
- 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__/dataset-alert-draft.spec.tsx +72 -0
- 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/dataset-alert-draft.tsx +79 -0
- package/src/scripts/refactor_2021/dataset/fragments/dataset-alert-version.tsx +24 -0
- package/src/scripts/refactor_2021/dataset/fragments/select-input.tsx +1 -1
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/deprecate-snapshot.spec.tsx.snap +14 -0
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/deprecate-version.spec.tsx.snap +14 -0
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/__snapshots__/description.spec.jsx.snap +3 -277
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/deprecate-snapshot.spec.tsx +71 -0
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/deprecate-version.spec.tsx +71 -0
- package/src/scripts/refactor_2021/dataset/mutations/__tests__/description.spec.jsx +22 -9
- package/src/scripts/refactor_2021/dataset/mutations/deprecate-version.tsx +46 -0
- package/src/scripts/refactor_2021/dataset/mutations/description.jsx +1 -1
- package/src/scripts/refactor_2021/dataset/mutations/readme.jsx +1 -1
- package/src/scripts/refactor_2021/dataset/mutations/submit-metadata.jsx +1 -1
- package/src/scripts/refactor_2021/dataset/mutations/undo-deprecate-version.tsx +43 -0
- 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/routes/add-metadata.jsx +0 -1
- package/src/scripts/refactor_2021/dataset/routes/deprecate-snapshot-page.tsx +46 -0
- package/src/scripts/refactor_2021/dataset/snapshot-container.tsx +19 -23
- 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
- package/src/scripts/refactor_2021/dataset/dataset-query-fragments.js +0 -220
- package/src/scripts/refactor_2021/dataset/queries/dataset-query-fragments.js +0 -220
|
@@ -1,79 +1,104 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`File Viewer - JSON renders with invalid JSON 1`] = `
|
|
4
|
-
<
|
|
5
|
-
className="container"
|
|
6
|
-
>
|
|
4
|
+
<DocumentFragment>
|
|
7
5
|
<div
|
|
8
|
-
|
|
6
|
+
class="container"
|
|
9
7
|
>
|
|
10
8
|
<div
|
|
11
|
-
|
|
9
|
+
class="grid"
|
|
12
10
|
>
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
11
|
+
<div
|
|
12
|
+
class="col col-lg"
|
|
13
|
+
>
|
|
14
|
+
<h3>
|
|
15
|
+
Tree
|
|
16
|
+
</h3>
|
|
17
|
+
<hr />
|
|
18
|
+
<p>
|
|
19
|
+
JSON failed to parse
|
|
20
|
+
</p>
|
|
21
|
+
<pre>
|
|
22
|
+
Unexpected token ; in JSON at position 4
|
|
23
|
+
</pre>
|
|
24
|
+
</div>
|
|
25
|
+
<div
|
|
26
|
+
class="col"
|
|
27
|
+
>
|
|
28
|
+
<h3>
|
|
29
|
+
Raw
|
|
30
|
+
</h3>
|
|
31
|
+
<hr />
|
|
32
|
+
<pre
|
|
33
|
+
class="css-ffm88e"
|
|
34
|
+
>
|
|
35
|
+
1234;
|
|
36
|
+
</pre>
|
|
37
|
+
</div>
|
|
34
38
|
</div>
|
|
35
39
|
</div>
|
|
36
|
-
</
|
|
40
|
+
</DocumentFragment>
|
|
37
41
|
`;
|
|
38
42
|
|
|
39
43
|
exports[`File Viewer - JSON renders with valid JSON 1`] = `
|
|
40
|
-
<
|
|
41
|
-
className="container"
|
|
42
|
-
>
|
|
44
|
+
<DocumentFragment>
|
|
43
45
|
<div
|
|
44
|
-
|
|
46
|
+
class="container"
|
|
45
47
|
>
|
|
46
48
|
<div
|
|
47
|
-
|
|
48
|
-
>
|
|
49
|
-
<h3>
|
|
50
|
-
Tree
|
|
51
|
-
</h3>
|
|
52
|
-
<hr />
|
|
53
|
-
<RecursiveProperty
|
|
54
|
-
emptyPropertyLabel="Property is empty"
|
|
55
|
-
property={
|
|
56
|
-
Object {
|
|
57
|
-
"name": "string",
|
|
58
|
-
"thing": 1,
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
propertyName="Root Property"
|
|
62
|
-
propertyNameProcessor={[Function]}
|
|
63
|
-
rootProperty={true}
|
|
64
|
-
/>
|
|
65
|
-
</div>
|
|
66
|
-
<div
|
|
67
|
-
className="col"
|
|
49
|
+
class="grid"
|
|
68
50
|
>
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
<div
|
|
52
|
+
class="col col-lg"
|
|
53
|
+
>
|
|
54
|
+
<h3>
|
|
55
|
+
Tree
|
|
56
|
+
</h3>
|
|
57
|
+
<hr />
|
|
58
|
+
<div
|
|
59
|
+
class="json-container"
|
|
60
|
+
>
|
|
61
|
+
<div
|
|
62
|
+
class="expand-prop-name"
|
|
63
|
+
>
|
|
64
|
+
Root Property-
|
|
65
|
+
</div>
|
|
66
|
+
<div
|
|
67
|
+
class="json-container"
|
|
68
|
+
>
|
|
69
|
+
<span
|
|
70
|
+
class="prop-name"
|
|
71
|
+
>
|
|
72
|
+
Thing:
|
|
73
|
+
</span>
|
|
74
|
+
1
|
|
75
|
+
</div>
|
|
76
|
+
<div
|
|
77
|
+
class="json-container"
|
|
78
|
+
>
|
|
79
|
+
<span
|
|
80
|
+
class="prop-name"
|
|
81
|
+
>
|
|
82
|
+
Name:
|
|
83
|
+
</span>
|
|
84
|
+
string
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
<div
|
|
89
|
+
class="col"
|
|
90
|
+
>
|
|
91
|
+
<h3>
|
|
92
|
+
Raw
|
|
93
|
+
</h3>
|
|
94
|
+
<hr />
|
|
95
|
+
<pre
|
|
96
|
+
class="css-ffm88e"
|
|
97
|
+
>
|
|
98
|
+
{"thing":1,"name":"string"}
|
|
99
|
+
</pre>
|
|
100
|
+
</div>
|
|
76
101
|
</div>
|
|
77
102
|
</div>
|
|
78
|
-
</
|
|
103
|
+
</DocumentFragment>
|
|
79
104
|
`;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
3
|
import { FileViewerJsonRaw } from '../file-viewer-json.jsx'
|
|
4
4
|
|
|
5
5
|
describe('File Viewer - JSON', () => {
|
|
6
6
|
it('renders with valid JSON', () => {
|
|
7
7
|
const validJson = JSON.stringify({ thing: 1, name: 'string' })
|
|
8
|
-
const
|
|
9
|
-
expect(
|
|
8
|
+
const { asFragment } = render(<FileViewerJsonRaw jsonRaw={validJson} />)
|
|
9
|
+
expect(asFragment()).toMatchSnapshot()
|
|
10
10
|
})
|
|
11
11
|
it('renders with invalid JSON', () => {
|
|
12
|
-
const
|
|
13
|
-
expect(
|
|
12
|
+
const { asFragment } = render(<FileViewerJsonRaw jsonRaw="1234;" />)
|
|
13
|
+
expect(asFragment()).toMatchSnapshot()
|
|
14
14
|
})
|
|
15
15
|
})
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`CancelButton component renders with default props 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<button
|
|
6
|
+
aria-label="Cancel"
|
|
7
|
+
class="on-button on-button--medium on-button--default icon-text description-btn description-button-cancel"
|
|
8
|
+
role="button"
|
|
9
|
+
type="button"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="fas fa-times css-0"
|
|
14
|
+
/>
|
|
15
|
+
Cancel
|
|
16
|
+
</button>
|
|
17
|
+
</DocumentFragment>
|
|
10
18
|
`;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`EditButton component renders with default props 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<button
|
|
6
|
+
aria-label="Edit"
|
|
7
|
+
class="on-button on-button--medium on-button--default icon-text description-btn description-button-edit"
|
|
8
|
+
role="button"
|
|
9
|
+
type="button"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="fas fa-edit css-0"
|
|
14
|
+
/>
|
|
15
|
+
Edit
|
|
16
|
+
</button>
|
|
17
|
+
</DocumentFragment>
|
|
10
18
|
`;
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`SaveButton component renders with default props 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<button
|
|
6
|
+
aria-label="Save"
|
|
7
|
+
class="on-button on-button--medium on-button--default icon-text description-btn description-button-save"
|
|
8
|
+
role="button"
|
|
9
|
+
type="button"
|
|
10
|
+
>
|
|
11
|
+
<i
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
class="fas fa-check css-0"
|
|
14
|
+
/>
|
|
15
|
+
Save
|
|
16
|
+
</button>
|
|
17
|
+
</DocumentFragment>
|
|
10
18
|
`;
|
|
@@ -1,154 +1,227 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`SelectInput handles boolean display 1`] = `
|
|
4
|
-
<
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
<DocumentFragment>
|
|
5
|
+
<div
|
|
6
|
+
class="css-1e7yhge"
|
|
7
|
+
>
|
|
8
|
+
<label
|
|
9
|
+
class="css-xlyr96"
|
|
10
|
+
for="Expected name"
|
|
9
11
|
>
|
|
10
12
|
Expected label
|
|
11
|
-
</
|
|
12
|
-
<
|
|
13
|
-
|
|
13
|
+
</label>
|
|
14
|
+
<i
|
|
15
|
+
class="fa fa-asterisk css-1gx6zd3"
|
|
14
16
|
/>
|
|
15
|
-
<
|
|
17
|
+
<div
|
|
18
|
+
class="css-1y7plm6"
|
|
19
|
+
>
|
|
16
20
|
true
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
<div
|
|
22
|
+
class="css-ul54qr"
|
|
23
|
+
>
|
|
24
|
+
<i
|
|
25
|
+
class="fa fa-caret-up"
|
|
26
|
+
/>
|
|
27
|
+
<i
|
|
28
|
+
class="fa fa-caret-down"
|
|
29
|
+
/>
|
|
30
|
+
</div>
|
|
31
|
+
</div>
|
|
32
|
+
<select
|
|
33
|
+
class="css-1m2rag2"
|
|
34
|
+
disabled=""
|
|
21
35
|
name="Expected name"
|
|
22
|
-
onChange={[Function]}
|
|
23
|
-
value="true"
|
|
24
36
|
>
|
|
25
|
-
<
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
<option
|
|
38
|
+
class="css-1xu3tth"
|
|
39
|
+
disabled=""
|
|
40
|
+
hidden=""
|
|
28
41
|
value=""
|
|
29
42
|
/>
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
value=
|
|
43
|
+
<option
|
|
44
|
+
class="css-1xu3tth"
|
|
45
|
+
value="true"
|
|
33
46
|
>
|
|
34
47
|
true-label
|
|
35
|
-
</
|
|
36
|
-
<
|
|
37
|
-
|
|
38
|
-
value=
|
|
48
|
+
</option>
|
|
49
|
+
<option
|
|
50
|
+
class="css-1xu3tth"
|
|
51
|
+
value="false"
|
|
39
52
|
>
|
|
40
53
|
false-label
|
|
41
|
-
</
|
|
42
|
-
</
|
|
43
|
-
</
|
|
44
|
-
<
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
</option>
|
|
55
|
+
</select>
|
|
56
|
+
</div>
|
|
57
|
+
<div
|
|
58
|
+
class="css-vzng66"
|
|
59
|
+
>
|
|
60
|
+
<div
|
|
61
|
+
class="css-1k9o271"
|
|
62
|
+
>
|
|
63
|
+
<label
|
|
64
|
+
class="css-1y4orcj"
|
|
65
|
+
for="Expected name"
|
|
66
|
+
>
|
|
67
|
+
Other Expected label
|
|
68
|
+
</label>
|
|
69
|
+
<input
|
|
70
|
+
class="css-1v4xkzy"
|
|
71
|
+
disabled=""
|
|
72
|
+
name="Expected name"
|
|
73
|
+
value="true"
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</DocumentFragment>
|
|
53
78
|
`;
|
|
54
79
|
|
|
55
80
|
exports[`SelectInput handles display as disabled 1`] = `
|
|
56
|
-
<
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
81
|
+
<DocumentFragment>
|
|
82
|
+
<div
|
|
83
|
+
class="css-1e7yhge"
|
|
84
|
+
>
|
|
85
|
+
<label
|
|
86
|
+
class="css-xlyr96"
|
|
87
|
+
for="Expected name"
|
|
61
88
|
>
|
|
62
89
|
Expected label
|
|
63
|
-
</
|
|
64
|
-
<
|
|
65
|
-
|
|
90
|
+
</label>
|
|
91
|
+
<i
|
|
92
|
+
class="fa fa-asterisk css-1gx6zd3"
|
|
66
93
|
/>
|
|
67
|
-
<
|
|
94
|
+
<div
|
|
95
|
+
class="css-1y7plm6"
|
|
96
|
+
>
|
|
68
97
|
hi
|
|
69
|
-
<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
98
|
+
<div
|
|
99
|
+
class="css-ul54qr"
|
|
100
|
+
>
|
|
101
|
+
<i
|
|
102
|
+
class="fa fa-caret-up"
|
|
103
|
+
/>
|
|
104
|
+
<i
|
|
105
|
+
class="fa fa-caret-down"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
<select
|
|
110
|
+
class="css-1m2rag2"
|
|
111
|
+
disabled=""
|
|
73
112
|
name="Expected name"
|
|
74
|
-
onChange={[Function]}
|
|
75
|
-
value="hi"
|
|
76
113
|
>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
114
|
+
<option
|
|
115
|
+
class="css-1xu3tth"
|
|
116
|
+
disabled=""
|
|
117
|
+
hidden=""
|
|
80
118
|
value=""
|
|
81
119
|
/>
|
|
82
|
-
<
|
|
83
|
-
|
|
120
|
+
<option
|
|
121
|
+
class="css-1xu3tth"
|
|
84
122
|
value="hi"
|
|
85
123
|
>
|
|
86
124
|
hi
|
|
87
|
-
</
|
|
88
|
-
<
|
|
89
|
-
|
|
125
|
+
</option>
|
|
126
|
+
<option
|
|
127
|
+
class="css-1xu3tth"
|
|
90
128
|
value="bye"
|
|
91
129
|
>
|
|
92
130
|
bye
|
|
93
|
-
</
|
|
94
|
-
</
|
|
95
|
-
</
|
|
96
|
-
<
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
131
|
+
</option>
|
|
132
|
+
</select>
|
|
133
|
+
</div>
|
|
134
|
+
<div
|
|
135
|
+
class="css-vzng66"
|
|
136
|
+
>
|
|
137
|
+
<div
|
|
138
|
+
class="css-1k9o271"
|
|
139
|
+
>
|
|
140
|
+
<label
|
|
141
|
+
class="css-1y4orcj"
|
|
142
|
+
for="Expected name"
|
|
143
|
+
>
|
|
144
|
+
Other Expected label
|
|
145
|
+
</label>
|
|
146
|
+
<input
|
|
147
|
+
class="css-1v4xkzy"
|
|
148
|
+
disabled=""
|
|
149
|
+
name="Expected name"
|
|
150
|
+
value="hi"
|
|
151
|
+
/>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
</DocumentFragment>
|
|
105
155
|
`;
|
|
106
156
|
|
|
107
157
|
exports[`SelectInput handles display as not disabled 1`] = `
|
|
108
|
-
<
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
158
|
+
<DocumentFragment>
|
|
159
|
+
<div
|
|
160
|
+
class="css-1e7yhge"
|
|
161
|
+
>
|
|
162
|
+
<label
|
|
163
|
+
class="css-xlyr96"
|
|
164
|
+
for="Expected name"
|
|
113
165
|
>
|
|
114
166
|
Expected label
|
|
115
|
-
</
|
|
116
|
-
<
|
|
167
|
+
</label>
|
|
168
|
+
<div
|
|
169
|
+
class="css-1y7plm6"
|
|
170
|
+
>
|
|
117
171
|
hi
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
172
|
+
<div
|
|
173
|
+
class="css-ul54qr"
|
|
174
|
+
>
|
|
175
|
+
<i
|
|
176
|
+
class="fa fa-caret-up"
|
|
177
|
+
/>
|
|
178
|
+
<i
|
|
179
|
+
class="fa fa-caret-down"
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
<select
|
|
184
|
+
class="css-1m2rag2"
|
|
122
185
|
name="Expected name"
|
|
123
|
-
onChange={[Function]}
|
|
124
|
-
value="hi"
|
|
125
186
|
>
|
|
126
|
-
<
|
|
127
|
-
|
|
128
|
-
|
|
187
|
+
<option
|
|
188
|
+
class="css-1xu3tth"
|
|
189
|
+
disabled=""
|
|
190
|
+
hidden=""
|
|
129
191
|
value=""
|
|
130
192
|
/>
|
|
131
|
-
<
|
|
132
|
-
|
|
193
|
+
<option
|
|
194
|
+
class="css-1xu3tth"
|
|
133
195
|
value="hi"
|
|
134
196
|
>
|
|
135
197
|
hi
|
|
136
|
-
</
|
|
137
|
-
<
|
|
138
|
-
|
|
198
|
+
</option>
|
|
199
|
+
<option
|
|
200
|
+
class="css-1xu3tth"
|
|
139
201
|
value="bye"
|
|
140
202
|
>
|
|
141
203
|
bye
|
|
142
|
-
</
|
|
143
|
-
</
|
|
144
|
-
</
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
204
|
+
</option>
|
|
205
|
+
</select>
|
|
206
|
+
</div>
|
|
207
|
+
<div
|
|
208
|
+
class="css-vzng66"
|
|
209
|
+
>
|
|
210
|
+
<div
|
|
211
|
+
class="css-1k9o271"
|
|
212
|
+
>
|
|
213
|
+
<label
|
|
214
|
+
class="css-1y4orcj"
|
|
215
|
+
for="Expected name"
|
|
216
|
+
>
|
|
217
|
+
Other Expected label
|
|
218
|
+
</label>
|
|
219
|
+
<input
|
|
220
|
+
class="css-1v4xkzy"
|
|
221
|
+
name="Expected name"
|
|
222
|
+
value="hi"
|
|
223
|
+
/>
|
|
224
|
+
</div>
|
|
225
|
+
</div>
|
|
226
|
+
</DocumentFragment>
|
|
154
227
|
`;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import {
|
|
2
|
+
import { render } from '@testing-library/react'
|
|
3
3
|
import { CancelButton } from '../cancel-button'
|
|
4
4
|
|
|
5
5
|
describe('CancelButton component', () => {
|
|
6
6
|
it('renders with default props', () => {
|
|
7
|
-
const
|
|
8
|
-
expect(
|
|
7
|
+
const { asFragment } = render(<CancelButton action={() => {}} />)
|
|
8
|
+
expect(asFragment()).toMatchSnapshot()
|
|
9
9
|
})
|
|
10
10
|
})
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { render, screen } from '@testing-library/react'
|
|
3
|
+
import '@testing-library/jest-dom/extend-expect'
|
|
4
|
+
import { MemoryRouter } from 'react-router-dom'
|
|
5
|
+
import { DatasetAlertDraft } from '../dataset-alert-draft'
|
|
6
|
+
|
|
7
|
+
describe('DatasetAlertDraft component', () => {
|
|
8
|
+
it('renders the correct text for private drafts with changes', () => {
|
|
9
|
+
render(
|
|
10
|
+
<DatasetAlertDraft
|
|
11
|
+
isPrivate
|
|
12
|
+
hasSnapshot
|
|
13
|
+
hasDraftChanges
|
|
14
|
+
datasetId="test00001"
|
|
15
|
+
/>,
|
|
16
|
+
{ wrapper: MemoryRouter },
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
expect(
|
|
20
|
+
screen.queryByText(/there have been changes to the draft/i),
|
|
21
|
+
).toBeInTheDocument()
|
|
22
|
+
})
|
|
23
|
+
it('renders the correct text for private drafts with no snapshots', () => {
|
|
24
|
+
render(
|
|
25
|
+
<DatasetAlertDraft
|
|
26
|
+
isPrivate
|
|
27
|
+
hasDraftChanges
|
|
28
|
+
hasSnapshot={false}
|
|
29
|
+
datasetId="test00001"
|
|
30
|
+
/>,
|
|
31
|
+
{ wrapper: MemoryRouter },
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
expect(
|
|
35
|
+
screen.queryByText(/before it can be published/i),
|
|
36
|
+
).toBeInTheDocument()
|
|
37
|
+
})
|
|
38
|
+
it('renders the correct text for public drafts with changes', () => {
|
|
39
|
+
render(
|
|
40
|
+
<DatasetAlertDraft
|
|
41
|
+
hasDraftChanges
|
|
42
|
+
isPrivate={false}
|
|
43
|
+
hasSnapshot={false}
|
|
44
|
+
datasetId="test00001"
|
|
45
|
+
/>,
|
|
46
|
+
{
|
|
47
|
+
wrapper: MemoryRouter,
|
|
48
|
+
},
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
expect(
|
|
52
|
+
screen.queryByText(/there are currently unsaved changes to this draft/i),
|
|
53
|
+
).toBeInTheDocument()
|
|
54
|
+
})
|
|
55
|
+
it('renders the correct text for public drafts without changes', () => {
|
|
56
|
+
render(
|
|
57
|
+
<DatasetAlertDraft
|
|
58
|
+
hasDraftChanges={false}
|
|
59
|
+
isPrivate={false}
|
|
60
|
+
hasSnapshot={false}
|
|
61
|
+
datasetId="test00001"
|
|
62
|
+
/>,
|
|
63
|
+
{
|
|
64
|
+
wrapper: MemoryRouter,
|
|
65
|
+
},
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
expect(
|
|
69
|
+
screen.queryByText(/you can make changes to this draft page/i),
|
|
70
|
+
).toBeInTheDocument()
|
|
71
|
+
})
|
|
72
|
+
})
|