@civicactions/cmsds-open-data-components 2.1.0 → 2.1.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/README.md +20 -0
- package/dist/main.css +5 -0
- package/dist/main.css.map +1 -1
- package/dist/main.js +75 -29
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +0 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/scss/components/additional-information-table.scss +0 -9
- package/dist/scss/components/breadcrumb.scss +0 -32
- package/dist/scss/components/dataset-downloads.scss +0 -0
- package/dist/scss/components/dataset-search-facets.scss +0 -10
- package/dist/scss/components/dataset-search-list-item.scss +0 -20
- package/dist/scss/components/dataset-tags.scss +0 -4
- package/dist/scss/components/datatable.scss +0 -24
- package/dist/scss/components/index.scss +0 -9
- package/dist/scss/components/pagination.scss +0 -59
- package/dist/scss/components/resource-information-table.scss +0 -5
- package/dist/scss/index.scss +0 -24
- package/dist/scss/templates/dataset-search.scss +0 -38
- package/dist/scss/templates/dataset.scss +0 -44
- package/dist/scss/templates/filtered-resource.scss +0 -19
- package/dist/scss/templates/footer.scss +0 -83
- package/dist/scss/templates/header.scss +0 -402
- package/dist/scss/templates/index.scss +0 -7
- package/dist/scss/templates/query-builder.scss +0 -22
- package/dist/scss/templates/swagger.scss +0 -21
- package/lib/assets/frequencyMap.js +0 -22
- package/lib/assets/icons/close.js +0 -33
- package/lib/assets/icons/close.jsx +0 -24
- package/lib/assets/icons/copy.js +0 -33
- package/lib/assets/icons/copy.jsx +0 -23
- package/lib/assets/icons/download.js +0 -33
- package/lib/assets/icons/download.jsx +0 -23
- package/lib/assets/icons/settings.js +0 -34
- package/lib/assets/icons/settings.jsx +0 -24
- package/lib/assets/images/CMSGovLogo-O.png +0 -0
- package/lib/assets/images/CMSgov@2x-white-O.png +0 -0
- package/lib/assets/metadataMapping.js +0 -161
- package/lib/assets/metadataMapping.jsx +0 -110
- package/lib/commands/index.js +0 -7
- package/lib/commands/templates/footer.js +0 -61
- package/lib/commands/templates/header.js +0 -84
- package/lib/commands/templates/page_not_found.js +0 -14
- package/lib/components/ApiDocumentation/index.js +0 -24
- package/lib/components/Breadcrumb/index.js +0 -47
- package/lib/components/DataTableDensity/datatabledensity.test.js +0 -30
- package/lib/components/DataTableDensity/index.js +0 -47
- package/lib/components/DataTableRowChanger/datatablerowchanger.test.js +0 -49
- package/lib/components/DataTableRowChanger/index.js +0 -46
- package/lib/components/DatasetAdditionalInformation/index.js +0 -59
- package/lib/components/DatasetDownloads/datasetdownloads.test.js +0 -30
- package/lib/components/DatasetDownloads/index.js +0 -34
- package/lib/components/DatasetSearchFacets/dataset_search_facets.test.js +0 -103
- package/lib/components/DatasetSearchFacets/index.js +0 -104
- package/lib/components/DatasetSearchListItem/datasetsearchlistitem.test.js +0 -44
- package/lib/components/DatasetSearchListItem/index.js +0 -86
- package/lib/components/DatasetTags/datasettags.test.js +0 -40
- package/lib/components/DatasetTags/index.js +0 -38
- package/lib/components/Hero/index.js +0 -92
- package/lib/components/ManageColumns/index.js +0 -36
- package/lib/components/NavBar/index.js +0 -55
- package/lib/components/NavLink/index.js +0 -60
- package/lib/components/NavLink/navlink.test.js +0 -35
- package/lib/components/Pagination/index.js +0 -263
- package/lib/components/Pagination/pagination.test.js +0 -541
- package/lib/components/ResourceConditionField/ResourceConditionalField.test.js +0 -20
- package/lib/components/ResourceConditionField/index.js +0 -246
- package/lib/components/ResourceFilter/index.js +0 -174
- package/lib/components/ResourceFilter/resourcefilter.test.js +0 -440
- package/lib/components/ResourceFooter/index.js +0 -34
- package/lib/components/ResourceHeader/index.js +0 -149
- package/lib/components/ResourceInformation/index.js +0 -37
- package/lib/components/ResourcePreview/index.js +0 -139
- package/lib/components/SearchModal/index.js +0 -116
- package/lib/components/SubMenu/index.js +0 -86
- package/lib/components/TransformedDate/index.js +0 -34
- package/lib/components/useAddLoginLink/index.js +0 -44
- package/lib/components/useScrollToTop/index.js +0 -22
- package/lib/index.js +0 -247
- package/lib/templates/APIPage/index.js +0 -30
- package/lib/templates/Dataset/DatasetBody.js +0 -189
- package/lib/templates/Dataset/index.js +0 -83
- package/lib/templates/DatasetSearch/datasetsearch.test.js +0 -122
- package/lib/templates/DatasetSearch/index.js +0 -356
- package/lib/templates/DrupalPage/index.js +0 -37
- package/lib/templates/FilteredResource/FilteredResourceBody.js +0 -160
- package/lib/templates/FilteredResource/QueryBuilder.js +0 -235
- package/lib/templates/FilteredResource/QueryRow.js +0 -175
- package/lib/templates/FilteredResource/QueryTitle.js +0 -89
- package/lib/templates/FilteredResource/functions.js +0 -142
- package/lib/templates/FilteredResource/index.js +0 -95
- package/lib/templates/Footer/footer.test.js +0 -48
- package/lib/templates/Footer/index.js +0 -366
- package/lib/templates/PageNotFound/index.js +0 -25
- package/lib/templates/header/index.js +0 -112
- package/lib/templates/mobile_header/index.js +0 -199
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
const SettingsIcon = () => (
|
|
4
|
-
<svg
|
|
5
|
-
width="15px"
|
|
6
|
-
height="15px"
|
|
7
|
-
// viewBox="0 0 15 15"
|
|
8
|
-
viewBox="0 0 512 512"
|
|
9
|
-
version="1.1"
|
|
10
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
11
|
-
xmlnsXlink="http://www.w3.org/1999/xlink"
|
|
12
|
-
>
|
|
13
|
-
<title>Settings Icon</title>
|
|
14
|
-
<g stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
|
|
15
|
-
<path
|
|
16
|
-
fill="#112E51"
|
|
17
|
-
fillRule="nonzero"
|
|
18
|
-
d="M495.9 166.6C499.2 175.2 496.4 184.9 489.6 191.2L446.3 230.6C447.4 238.9 448 247.4 448 256C448 264.6 447.4 273.1 446.3 281.4L489.6 320.8C496.4 327.1 499.2 336.8 495.9 345.4C491.5 357.3 486.2 368.8 480.2 379.7L475.5 387.8C468.9 398.8 461.5 409.2 453.4 419.1C447.4 426.2 437.7 428.7 428.9 425.9L373.2 408.1C359.8 418.4 344.1 427 329.2 433.6L316.7 490.7C314.7 499.7 307.7 506.1 298.5 508.5C284.7 510.8 270.5 512 255.1 512C241.5 512 227.3 510.8 213.5 508.5C204.3 506.1 197.3 499.7 195.3 490.7L182.8 433.6C167 427 152.2 418.4 138.8 408.1L83.14 425.9C74.3 428.7 64.55 426.2 58.63 419.1C50.52 409.2 43.12 398.8 36.52 387.8L31.84 379.7C25.77 368.8 20.49 357.3 16.06 345.4C12.82 336.8 15.55 327.1 22.41 320.8L65.67 281.4C64.57 273.1 64 264.6 64 256C64 247.4 64.57 238.9 65.67 230.6L22.41 191.2C15.55 184.9 12.82 175.3 16.06 166.6C20.49 154.7 25.78 143.2 31.84 132.3L36.51 124.2C43.12 113.2 50.52 102.8 58.63 92.95C64.55 85.8 74.3 83.32 83.14 86.14L138.8 103.9C152.2 93.56 167 84.96 182.8 78.43L195.3 21.33C197.3 12.25 204.3 5.04 213.5 3.51C227.3 1.201 241.5 0 256 0C270.5 0 284.7 1.201 298.5 3.51C307.7 5.04 314.7 12.25 316.7 21.33L329.2 78.43C344.1 84.96 359.8 93.56 373.2 103.9L428.9 86.14C437.7 83.32 447.4 85.8 453.4 92.95C461.5 102.8 468.9 113.2 475.5 124.2L480.2 132.3C486.2 143.2 491.5 154.7 495.9 166.6V166.6zM256 336C300.2 336 336 300.2 336 255.1C336 211.8 300.2 175.1 256 175.1C211.8 175.1 176 211.8 176 255.1C176 300.2 211.8 336 256 336z"
|
|
19
|
-
/>
|
|
20
|
-
</g>
|
|
21
|
-
</svg>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export default SettingsIcon;
|
|
Binary file
|
|
Binary file
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.defaultMetadataMapping = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _reactRouterDom = require("react-router-dom");
|
|
13
|
-
|
|
14
|
-
var _TransformedDate = _interopRequireDefault(require("../components/TransformedDate"));
|
|
15
|
-
|
|
16
|
-
var _frequencyMap = require("./frequencyMap");
|
|
17
|
-
|
|
18
|
-
var defaultMetadataMapping = {
|
|
19
|
-
modified: function modified(data) {
|
|
20
|
-
return [{
|
|
21
|
-
label: 'Modified',
|
|
22
|
-
value: /*#__PURE__*/_react["default"].createElement(_TransformedDate["default"], {
|
|
23
|
-
date: data
|
|
24
|
-
})
|
|
25
|
-
}];
|
|
26
|
-
},
|
|
27
|
-
issued: function issued(data) {
|
|
28
|
-
return [{
|
|
29
|
-
label: 'Issued',
|
|
30
|
-
value: /*#__PURE__*/_react["default"].createElement(_TransformedDate["default"], {
|
|
31
|
-
date: data
|
|
32
|
-
})
|
|
33
|
-
}];
|
|
34
|
-
},
|
|
35
|
-
accrualPeriodicity: function accrualPeriodicity(data) {
|
|
36
|
-
return [{
|
|
37
|
-
label: 'Frequency',
|
|
38
|
-
value: _frequencyMap.frequencyMap[data].name
|
|
39
|
-
}];
|
|
40
|
-
},
|
|
41
|
-
publisher: function publisher(data) {
|
|
42
|
-
if (data.data && data.data.name) {
|
|
43
|
-
return [{
|
|
44
|
-
label: 'Publisher',
|
|
45
|
-
value: data.data.name
|
|
46
|
-
}];
|
|
47
|
-
} else {
|
|
48
|
-
return [];
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
identifier: function identifier(data) {
|
|
52
|
-
return [{
|
|
53
|
-
label: 'Identifier',
|
|
54
|
-
value: data
|
|
55
|
-
}];
|
|
56
|
-
},
|
|
57
|
-
contactPoint: function contactPoint(data) {
|
|
58
|
-
var rows = [];
|
|
59
|
-
|
|
60
|
-
if (data.fn) {
|
|
61
|
-
rows.push({
|
|
62
|
-
label: 'Contact',
|
|
63
|
-
value: data.fn
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (data.hasEmail) {
|
|
68
|
-
rows.push({
|
|
69
|
-
label: 'Contact Email',
|
|
70
|
-
value: data.hasEmail
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
return rows;
|
|
75
|
-
},
|
|
76
|
-
bureauCode: function bureauCode(data) {
|
|
77
|
-
if (data.length) {
|
|
78
|
-
return [{
|
|
79
|
-
label: 'Bureau Code',
|
|
80
|
-
value: data[0]
|
|
81
|
-
}];
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
programCode: function programCode(data) {
|
|
85
|
-
if (data.length) {
|
|
86
|
-
return [{
|
|
87
|
-
label: 'Program Code',
|
|
88
|
-
value: data[0]
|
|
89
|
-
}];
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
theme: function theme(data) {
|
|
93
|
-
return [{
|
|
94
|
-
label: 'Category',
|
|
95
|
-
value: data.map(function (theme) {
|
|
96
|
-
return /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
|
|
97
|
-
key: theme.data,
|
|
98
|
-
to: "/datasets?theme[]=".concat(theme.data)
|
|
99
|
-
}, theme.data);
|
|
100
|
-
}).reduce(function (prev, curr) {
|
|
101
|
-
return [prev, ', ', curr];
|
|
102
|
-
})
|
|
103
|
-
}];
|
|
104
|
-
},
|
|
105
|
-
keyword: function keyword(data) {
|
|
106
|
-
return [{
|
|
107
|
-
label: 'Tags',
|
|
108
|
-
value: data.map(function (keyword) {
|
|
109
|
-
return /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
|
|
110
|
-
key: keyword.data,
|
|
111
|
-
to: "/datasets?keyword[]=".concat(keyword.data)
|
|
112
|
-
}, keyword.data);
|
|
113
|
-
}).reduce(function (prev, curr) {
|
|
114
|
-
return [prev, ', ', curr];
|
|
115
|
-
})
|
|
116
|
-
}];
|
|
117
|
-
},
|
|
118
|
-
license: function license(data) {
|
|
119
|
-
return [{
|
|
120
|
-
label: 'License',
|
|
121
|
-
value: /*#__PURE__*/_react["default"].createElement("a", {
|
|
122
|
-
href: data
|
|
123
|
-
}, data)
|
|
124
|
-
}];
|
|
125
|
-
},
|
|
126
|
-
accessLevel: function accessLevel(data) {
|
|
127
|
-
return [{
|
|
128
|
-
label: 'Public Access Level',
|
|
129
|
-
value: data
|
|
130
|
-
}];
|
|
131
|
-
},
|
|
132
|
-
temporal: function temporal(data) {
|
|
133
|
-
return [{
|
|
134
|
-
label: 'Temporal Coverage',
|
|
135
|
-
value: /*#__PURE__*/_react["default"].createElement("span", {
|
|
136
|
-
className: "dc-c-word-break--all"
|
|
137
|
-
}, data)
|
|
138
|
-
}];
|
|
139
|
-
},
|
|
140
|
-
spatial: function spatial(data) {
|
|
141
|
-
return [{
|
|
142
|
-
label: 'Spacial/Geographical Coverage',
|
|
143
|
-
value: data
|
|
144
|
-
}];
|
|
145
|
-
},
|
|
146
|
-
references: function references(data) {
|
|
147
|
-
return [{
|
|
148
|
-
label: 'Related Documents',
|
|
149
|
-
value: /*#__PURE__*/_react["default"].createElement("ul", {
|
|
150
|
-
className: "ds-u-margin--0 ds-u-padding-y--0 ds-u-padding-left--2 ds-u-padding-right--0"
|
|
151
|
-
}, data.map(function (item) {
|
|
152
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
153
|
-
key: item
|
|
154
|
-
}, /*#__PURE__*/_react["default"].createElement("a", {
|
|
155
|
-
href: item
|
|
156
|
-
}, item));
|
|
157
|
-
}))
|
|
158
|
-
}];
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
exports.defaultMetadataMapping = defaultMetadataMapping;
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Link } from 'react-router-dom';
|
|
3
|
-
import TransformedDate from '../components/TransformedDate';
|
|
4
|
-
import { frequencyMap } from './frequencyMap';
|
|
5
|
-
|
|
6
|
-
export const defaultMetadataMapping = {
|
|
7
|
-
modified: (data) => {
|
|
8
|
-
return [{ label: 'Modified', value: <TransformedDate date={data} /> }];
|
|
9
|
-
},
|
|
10
|
-
issued: (data) => {
|
|
11
|
-
return [{ label: 'Issued', value: <TransformedDate date={data} /> }];
|
|
12
|
-
},
|
|
13
|
-
accrualPeriodicity: (data) => {
|
|
14
|
-
return [
|
|
15
|
-
{
|
|
16
|
-
label: 'Frequency',
|
|
17
|
-
value: frequencyMap[data].name,
|
|
18
|
-
},
|
|
19
|
-
];
|
|
20
|
-
},
|
|
21
|
-
publisher: (data) => {
|
|
22
|
-
if (data.data && data.data.name) {
|
|
23
|
-
return [{ label: 'Publisher', value: data.data.name }];
|
|
24
|
-
} else {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
identifier: (data) => {
|
|
29
|
-
return [{ label: 'Identifier', value: data }];
|
|
30
|
-
},
|
|
31
|
-
contactPoint: (data) => {
|
|
32
|
-
let rows = [];
|
|
33
|
-
if (data.fn) {
|
|
34
|
-
rows.push({ label: 'Contact', value: data.fn });
|
|
35
|
-
}
|
|
36
|
-
if (data.hasEmail) {
|
|
37
|
-
rows.push({ label: 'Contact Email', value: data.hasEmail });
|
|
38
|
-
}
|
|
39
|
-
return rows;
|
|
40
|
-
},
|
|
41
|
-
bureauCode: (data) => {
|
|
42
|
-
if (data.length) {
|
|
43
|
-
return [{ label: 'Bureau Code', value: data[0] }];
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
programCode: (data) => {
|
|
47
|
-
if (data.length) {
|
|
48
|
-
return [{ label: 'Program Code', value: data[0] }];
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
theme: (data) => {
|
|
52
|
-
return [
|
|
53
|
-
{
|
|
54
|
-
label: 'Category',
|
|
55
|
-
value: data
|
|
56
|
-
.map((theme) => (
|
|
57
|
-
<Link key={theme.data} to={`/datasets?theme[]=${theme.data}`}>
|
|
58
|
-
{theme.data}
|
|
59
|
-
</Link>
|
|
60
|
-
))
|
|
61
|
-
.reduce((prev, curr) => [prev, ', ', curr]),
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
},
|
|
65
|
-
keyword: (data) => {
|
|
66
|
-
return [
|
|
67
|
-
{
|
|
68
|
-
label: 'Tags',
|
|
69
|
-
value: data
|
|
70
|
-
.map((keyword) => (
|
|
71
|
-
<Link key={keyword.data} to={`/datasets?keyword[]=${keyword.data}`}>
|
|
72
|
-
{keyword.data}
|
|
73
|
-
</Link>
|
|
74
|
-
))
|
|
75
|
-
.reduce((prev, curr) => [prev, ', ', curr]),
|
|
76
|
-
},
|
|
77
|
-
];
|
|
78
|
-
},
|
|
79
|
-
license: (data) => {
|
|
80
|
-
return [{ label: 'License', value: <a href={data}>{data}</a> }];
|
|
81
|
-
},
|
|
82
|
-
accessLevel: (data) => {
|
|
83
|
-
return [{ label: 'Public Access Level', value: data }];
|
|
84
|
-
},
|
|
85
|
-
|
|
86
|
-
temporal: (data) => {
|
|
87
|
-
return [
|
|
88
|
-
{ label: 'Temporal Coverage', value: <span className="dc-c-word-break--all">{data}</span> },
|
|
89
|
-
];
|
|
90
|
-
},
|
|
91
|
-
spatial: (data) => {
|
|
92
|
-
return [{ label: 'Spacial/Geographical Coverage', value: data }];
|
|
93
|
-
},
|
|
94
|
-
references: (data) => {
|
|
95
|
-
return [
|
|
96
|
-
{
|
|
97
|
-
label: 'Related Documents',
|
|
98
|
-
value: (
|
|
99
|
-
<ul className="ds-u-margin--0 ds-u-padding-y--0 ds-u-padding-left--2 ds-u-padding-right--0">
|
|
100
|
-
{data.map((item) => (
|
|
101
|
-
<li key={item}>
|
|
102
|
-
<a href={item}>{item}</a>
|
|
103
|
-
</li>
|
|
104
|
-
))}
|
|
105
|
-
</ul>
|
|
106
|
-
),
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
},
|
|
110
|
-
};
|
package/lib/commands/index.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Cypress.Commands.add('testFooterGetUpdates', function (title, description, link) {
|
|
4
|
-
cy.findByRole('heading', {
|
|
5
|
-
name: title,
|
|
6
|
-
level: 2
|
|
7
|
-
}).should('exist');
|
|
8
|
-
cy.findByText(description).should('exist');
|
|
9
|
-
cy.findByRole('link', {
|
|
10
|
-
name: link.label
|
|
11
|
-
}).should('have.attr', 'href', link.url);
|
|
12
|
-
});
|
|
13
|
-
Cypress.Commands.add('testFooterCMSInfo', function () {
|
|
14
|
-
cy.findByRole('link', {
|
|
15
|
-
name: 'HHS Logo opens in new window'
|
|
16
|
-
}).should('have.attr', 'href', 'http://www.hhs.gov/'); //change to https when moving upstream
|
|
17
|
-
|
|
18
|
-
cy.findByAltText('HHS Logo').should('exist');
|
|
19
|
-
cy.findByRole('link', {
|
|
20
|
-
name: 'CMS Logo opens in new window'
|
|
21
|
-
}).should('have.attr', 'href', 'http://www.cms.gov/'); //change to https when moving upstream
|
|
22
|
-
|
|
23
|
-
cy.findByAltText('CMS Logo').should('exist');
|
|
24
|
-
cy.findByText('A federal government website managed and paid for by the U.S. Centers for Medicare & Medicaid Services.').should('exist');
|
|
25
|
-
cy.findByText('7500 Security Boulevard, Baltimore, MD 21244').should('exist');
|
|
26
|
-
});
|
|
27
|
-
Cypress.Commands.add('testFooterGlobalLinks', function (links) {
|
|
28
|
-
cy.get('.dc-c-footer__utility').findAllByRole('listitem').should('have.length', links.length);
|
|
29
|
-
links.forEach(function (link) {
|
|
30
|
-
cy.findByRole('link', {
|
|
31
|
-
name: link.label
|
|
32
|
-
}).should('have.attr', 'href', link.url);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
Cypress.Commands.add('testFooterSocialLinks', function (links) {
|
|
36
|
-
cy.get('.dc-c-footer__cms-information').findAllByRole('listitem').should('have.length', links.length);
|
|
37
|
-
links.forEach(function (link) {
|
|
38
|
-
var currentLink = cy.findByRole('link', {
|
|
39
|
-
name: link.label
|
|
40
|
-
});
|
|
41
|
-
currentLink.should('have.attr', 'href', link.url);
|
|
42
|
-
currentLink.within(function () {
|
|
43
|
-
// The background circle SVG doesn't have a role of img.
|
|
44
|
-
cy.findAllByRole('img').should('have.length', 1);
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
Cypress.Commands.add('testFooterResource', function (links, title) {
|
|
49
|
-
var heading = cy.findByRole('heading', {
|
|
50
|
-
name: title,
|
|
51
|
-
level: 2
|
|
52
|
-
});
|
|
53
|
-
heading.should('exist');
|
|
54
|
-
heading.parent().findAllByRole('listitem').should('have.length', links.length);
|
|
55
|
-
links.forEach(function (link) {
|
|
56
|
-
var currentLink = cy.findByRole('link', {
|
|
57
|
-
name: link.label
|
|
58
|
-
});
|
|
59
|
-
currentLink.should('have.attr', 'href', link.url);
|
|
60
|
-
});
|
|
61
|
-
});
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Cypress.Commands.add('testUSABanner', function () {
|
|
4
|
-
var buttonText = 'Here’s how you know';
|
|
5
|
-
cy.findByRole('img', {
|
|
6
|
-
name: 'U.S. Flag'
|
|
7
|
-
}).should('exist');
|
|
8
|
-
cy.findByText('An official website of the United States government').should('exist');
|
|
9
|
-
cy.findByRole('button', {
|
|
10
|
-
name: buttonText
|
|
11
|
-
}).should('exist');
|
|
12
|
-
cy.findByText(/Official websites use .gov/i).should('not.be.visible');
|
|
13
|
-
cy.findByText(/Secure .gov websites use HTTPS/i).should('not.be.visible');
|
|
14
|
-
cy.get('.ds-c-usa-banner__button .ds-c-icon--arrow-down').should('exist');
|
|
15
|
-
cy.get('.ds-c-usa-banner__button .ds-c-icon--arrow-up').should('not.exist');
|
|
16
|
-
cy.findByRole('button', {
|
|
17
|
-
name: buttonText
|
|
18
|
-
}).click();
|
|
19
|
-
cy.findByText(/Official websites use .gov/i).should('be.visible');
|
|
20
|
-
cy.findByText(/Secure .gov websites use HTTPS/i).should('be.visible');
|
|
21
|
-
cy.get('.ds-c-usa-banner__button .ds-c-icon--arrow-down').should('not.exist');
|
|
22
|
-
cy.get('.ds-c-usa-banner__button .ds-c-icon--arrow-up').should('exist');
|
|
23
|
-
cy.findByRole('button', {
|
|
24
|
-
name: buttonText
|
|
25
|
-
}).click();
|
|
26
|
-
cy.findByText(/Official websites use .gov/i).should('not.be.visible');
|
|
27
|
-
cy.findByText(/Secure .gov websites use HTTPS/i).should('not.be.visible');
|
|
28
|
-
cy.get('.ds-c-usa-banner__button .ds-c-icon--arrow-down').should('exist');
|
|
29
|
-
cy.get('.ds-c-usa-banner__button .ds-c-icon--arrow-up').should('not.exist');
|
|
30
|
-
});
|
|
31
|
-
Cypress.Commands.add('desktopCMSHeader', function (mainLink, tagline, cmsLinks) {
|
|
32
|
-
cy.viewport(1150, 720);
|
|
33
|
-
cy.get('.dc-c-cmsheader').within(function (div) {
|
|
34
|
-
cy.findByRole('link', {
|
|
35
|
-
name: mainLink.title
|
|
36
|
-
}).should('have.attr', 'href', mainLink.url);
|
|
37
|
-
cy.findByAltText(mainLink.altText).should('exist');
|
|
38
|
-
});
|
|
39
|
-
cy.findByText(tagline).should('exist');
|
|
40
|
-
cmsLinks.forEach(function (link) {
|
|
41
|
-
cy.findByRole('link', {
|
|
42
|
-
name: link.label
|
|
43
|
-
}).should('have.attr', 'href', link.url);
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
Cypress.Commands.add('tabletCMSHeader', function (mainLink, tagline, cmsLinks) {
|
|
47
|
-
cy.viewport(720, 720);
|
|
48
|
-
cy.get('.dc-c-cmsheader').within(function (div) {
|
|
49
|
-
cy.findByRole('link', {
|
|
50
|
-
name: mainLink.title
|
|
51
|
-
}).should('have.attr', 'href', mainLink.url);
|
|
52
|
-
cy.findByAltText(mainLink.altText).should('exist');
|
|
53
|
-
});
|
|
54
|
-
cy.findByText(tagline).should('not.exist');
|
|
55
|
-
cmsLinks.forEach(function (link) {
|
|
56
|
-
cy.findByRole('link', {
|
|
57
|
-
name: link.label
|
|
58
|
-
}).should('have.attr', 'href', link.url);
|
|
59
|
-
});
|
|
60
|
-
});
|
|
61
|
-
Cypress.Commands.add('mobileCMSHeader', function (mainLink, tagline, cmsLinks) {
|
|
62
|
-
cy.viewport(300, 720);
|
|
63
|
-
cy.get('.dc-c-cmsheader').within(function (div) {
|
|
64
|
-
cy.findByRole('link', {
|
|
65
|
-
name: mainLink.title
|
|
66
|
-
}).should('have.attr', 'href', mainLink.url);
|
|
67
|
-
cy.findByAltText(mainLink.altText).should('exist');
|
|
68
|
-
});
|
|
69
|
-
cy.findByText(tagline).should('not.exist');
|
|
70
|
-
cy.get('.dc-c-cmsheader-menu').should('not.exist');
|
|
71
|
-
cmsLinks.forEach(function (link) {
|
|
72
|
-
cy.findByRole('link', {
|
|
73
|
-
name: link.label
|
|
74
|
-
}).should('not.be.visible');
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
Cypress.Commands.add('testNoCMSHeader', function () {
|
|
78
|
-
cy.get('.dc-c-cmsheader').should('not.exist');
|
|
79
|
-
});
|
|
80
|
-
Cypress.Commands.add('testCMSHeader', function (mainLink, tagline, cmsLinks) {
|
|
81
|
-
cy.desktopCMSHeader(mainLink, tagline, cmsLinks);
|
|
82
|
-
cy.tabletCMSHeader(mainLink, tagline, cmsLinks);
|
|
83
|
-
cy.mobileCMSHeader(mainLink, tagline, cmsLinks);
|
|
84
|
-
});
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Cypress.Commands.add('testPageNotFound', function () {
|
|
4
|
-
cy.findByRole("heading", {
|
|
5
|
-
level: 1,
|
|
6
|
-
name: "Error: Page not found"
|
|
7
|
-
}).should("exist");
|
|
8
|
-
cy.findByText("We're sorry, but there is no web page that matches your entry. You may have been directed here because:").should("exist");
|
|
9
|
-
cy.get(".ds-l-container").findAllByRole("listitem").should("have.length", 3);
|
|
10
|
-
cy.findByText("The address you typed contains a typo;").should("exist");
|
|
11
|
-
cy.findByText("The requested page may have expired or;").should("exist");
|
|
12
|
-
cy.findByText("The requested page may have been moved.").should("exist");
|
|
13
|
-
cy.findByText("If you were using a bookmark, please reset it once you find the correct page.").should("exist");
|
|
14
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _swaggerUiReact = _interopRequireDefault(require("swagger-ui-react"));
|
|
13
|
-
|
|
14
|
-
require("swagger-ui-react/swagger-ui.css");
|
|
15
|
-
|
|
16
|
-
var ApiDocumentation = function ApiDocumentation(_ref) {
|
|
17
|
-
var endpoint = _ref.endpoint;
|
|
18
|
-
return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement(_swaggerUiReact["default"], {
|
|
19
|
-
url: endpoint
|
|
20
|
-
}));
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
var _default = ApiDocumentation;
|
|
24
|
-
exports["default"] = _default;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _reactRouterDom = require("react-router-dom");
|
|
15
|
-
|
|
16
|
-
var Breadcrumb = function Breadcrumb(_ref) {
|
|
17
|
-
var currentPage = _ref.currentPage,
|
|
18
|
-
_ref$pageTrail = _ref.pageTrail,
|
|
19
|
-
pageTrail = _ref$pageTrail === void 0 ? [] : _ref$pageTrail;
|
|
20
|
-
var pageTrailContent = pageTrail.map(function (page) {
|
|
21
|
-
return /*#__PURE__*/_react["default"].createElement("li", {
|
|
22
|
-
"class": "dc-c-breadcrumb__list-item"
|
|
23
|
-
}, /*#__PURE__*/_react["default"].createElement(_reactRouterDom.Link, {
|
|
24
|
-
to: page.path,
|
|
25
|
-
"class": "dc-c-breadcrumb__link"
|
|
26
|
-
}, /*#__PURE__*/_react["default"].createElement("span", null, page.title)));
|
|
27
|
-
});
|
|
28
|
-
return /*#__PURE__*/_react["default"].createElement("nav", {
|
|
29
|
-
"class": "dc-c-breadcrumb ds-u-margin-top--6",
|
|
30
|
-
"aria-label": "Breadcrumbs"
|
|
31
|
-
}, /*#__PURE__*/_react["default"].createElement("ol", {
|
|
32
|
-
"class": "dc-c-breadcrumb__list"
|
|
33
|
-
}, pageTrailContent, currentPage ? /*#__PURE__*/_react["default"].createElement("li", {
|
|
34
|
-
"class": "dc-c-breadcrumb__list-item dc-c-current",
|
|
35
|
-
"aria-current": "page"
|
|
36
|
-
}, /*#__PURE__*/_react["default"].createElement("span", null, currentPage)) : ''));
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
Breadcrumb.propTypes = {
|
|
40
|
-
currentPage: _propTypes["default"].string.isRequired,
|
|
41
|
-
pageTrail: _propTypes["default"].arrayOf(_propTypes["default"].shape({
|
|
42
|
-
path: _propTypes["default"].string.isRequired,
|
|
43
|
-
title: _propTypes["default"].string.isRequired
|
|
44
|
-
}))
|
|
45
|
-
};
|
|
46
|
-
var _default = Breadcrumb;
|
|
47
|
-
exports["default"] = _default;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
|
-
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
|
-
require("@testing-library/jest-dom/extend-expect");
|
|
10
|
-
|
|
11
|
-
var _index = _interopRequireDefault(require("./index"));
|
|
12
|
-
|
|
13
|
-
describe('<DataTableRowDetails />', function () {
|
|
14
|
-
test('Renders 3 buttons', function () {
|
|
15
|
-
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
16
|
-
setTablePadding: function setTablePadding(p) {
|
|
17
|
-
return console.log(p);
|
|
18
|
-
}
|
|
19
|
-
}));
|
|
20
|
-
expect(_react2.screen.getByRole('button', {
|
|
21
|
-
name: /Table padding Tight/i
|
|
22
|
-
})).toBeTruthy();
|
|
23
|
-
expect(_react2.screen.getByRole('button', {
|
|
24
|
-
name: /Table padding Normal/i
|
|
25
|
-
})).toBeTruthy();
|
|
26
|
-
expect(_react2.screen.getByRole('button', {
|
|
27
|
-
name: /Table padding Expanded/i
|
|
28
|
-
})).toBeTruthy();
|
|
29
|
-
});
|
|
30
|
-
});
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
|
-
var _designSystem = require("@cmsgov/design-system");
|
|
15
|
-
|
|
16
|
-
var DataTableDensity = function DataTableDensity(_ref) {
|
|
17
|
-
var setTablePadding = _ref.setTablePadding,
|
|
18
|
-
tablePadding = _ref.tablePadding;
|
|
19
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
20
|
-
className: "ds-u-display--flex"
|
|
21
|
-
}, /*#__PURE__*/_react["default"].createElement(_designSystem.Dropdown, {
|
|
22
|
-
options: [{
|
|
23
|
-
label: 'Tight',
|
|
24
|
-
value: 'ds-u-padding-y--0'
|
|
25
|
-
}, {
|
|
26
|
-
label: 'Normal',
|
|
27
|
-
value: 'ds-u-padding-y--1'
|
|
28
|
-
}, {
|
|
29
|
-
label: 'Expanded',
|
|
30
|
-
value: 'ds-u-padding-y--2'
|
|
31
|
-
}],
|
|
32
|
-
size: "small",
|
|
33
|
-
label: "Display density:",
|
|
34
|
-
labelClassName: "ds-u-margin-top--0",
|
|
35
|
-
name: "datatable_display_density",
|
|
36
|
-
onChange: function onChange(e) {
|
|
37
|
-
return setTablePadding(e.target.value);
|
|
38
|
-
},
|
|
39
|
-
defaultValue: 'ds-u-padding-y--1'
|
|
40
|
-
}));
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
DataTableDensity.propTypes = {
|
|
44
|
-
setTablePadding: _propTypes["default"].func.isRequired
|
|
45
|
-
};
|
|
46
|
-
var _default = DataTableDensity;
|
|
47
|
-
exports["default"] = _default;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _react = _interopRequireDefault(require("react"));
|
|
6
|
-
|
|
7
|
-
var _react2 = require("@testing-library/react");
|
|
8
|
-
|
|
9
|
-
require("@testing-library/jest-dom/extend-expect");
|
|
10
|
-
|
|
11
|
-
var _index = _interopRequireDefault(require("./index"));
|
|
12
|
-
|
|
13
|
-
describe('<DataTableRowChanger />', function () {
|
|
14
|
-
test('Renders 4 buttons by default', function () {
|
|
15
|
-
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
16
|
-
setTablePadding: function setTablePadding(p) {
|
|
17
|
-
return console.log(p);
|
|
18
|
-
}
|
|
19
|
-
}));
|
|
20
|
-
expect(_react2.screen.getByText(/Rows per page:/i)).toBeTruthy();
|
|
21
|
-
expect(_react2.screen.getByRole('button', {
|
|
22
|
-
name: /10 rows per page/i
|
|
23
|
-
})).toBeTruthy();
|
|
24
|
-
expect(_react2.screen.getByRole('button', {
|
|
25
|
-
name: /25 rows per page/i
|
|
26
|
-
})).toBeTruthy();
|
|
27
|
-
expect(_react2.screen.getByRole('button', {
|
|
28
|
-
name: /50 rows per page/i
|
|
29
|
-
})).toBeTruthy();
|
|
30
|
-
expect(_react2.screen.getByRole('button', {
|
|
31
|
-
name: /100 rows per page/i
|
|
32
|
-
})).toBeTruthy();
|
|
33
|
-
});
|
|
34
|
-
test('Renders 2 buttons when given an array of 2 rowOptions', function () {
|
|
35
|
-
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_index["default"], {
|
|
36
|
-
setTablePadding: function setTablePadding(p) {
|
|
37
|
-
return console.log(p);
|
|
38
|
-
},
|
|
39
|
-
rowOptions: [5, 8]
|
|
40
|
-
}));
|
|
41
|
-
expect(_react2.screen.getByText(/Rows per page:/i)).toBeTruthy();
|
|
42
|
-
expect(_react2.screen.getByRole('button', {
|
|
43
|
-
name: /5 rows per page/i
|
|
44
|
-
})).toBeTruthy();
|
|
45
|
-
expect(_react2.screen.getByRole('button', {
|
|
46
|
-
name: /8 rows per page/i
|
|
47
|
-
})).toBeTruthy();
|
|
48
|
-
});
|
|
49
|
-
});
|