@dxc-technology/halstack-react 0.0.0-e832ef8 → 0.0.0-e884f9f
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/BackgroundColorContext.js +50 -0
- package/ThemeContext.js +246 -0
- package/{dist/select/Select.js → V3Select/V3Select.js} +38 -132
- package/V3Select/index.d.ts +27 -0
- package/{dist/V3Textarea → V3Textarea}/V3Textarea.js +10 -14
- package/V3Textarea/index.d.ts +27 -0
- package/accordion/Accordion.d.ts +4 -0
- package/{dist/accordion → accordion}/Accordion.js +35 -130
- package/accordion/types.d.ts +68 -0
- package/accordion/types.js +5 -0
- package/accordion-group/AccordionGroup.d.ts +7 -0
- package/accordion-group/AccordionGroup.js +170 -0
- package/accordion-group/types.d.ts +72 -0
- package/accordion-group/types.js +5 -0
- package/alert/Alert.d.ts +4 -0
- package/{dist/alert → alert}/Alert.js +38 -151
- package/alert/Alert.stories.tsx +170 -0
- package/alert/types.d.ts +49 -0
- package/alert/types.js +5 -0
- package/badge/Badge.js +59 -0
- package/box/Box.d.ts +4 -0
- package/{dist/box → box}/Box.js +13 -43
- package/box/Box.stories.tsx +132 -0
- package/box/types.d.ts +43 -0
- package/box/types.js +5 -0
- package/button/Button.d.ts +4 -0
- package/{dist/button → button}/Button.js +23 -84
- package/button/Button.stories.tsx +276 -0
- package/button/types.d.ts +57 -0
- package/button/types.js +5 -0
- package/card/Card.d.ts +4 -0
- package/{dist/card → card}/Card.js +33 -123
- package/card/Card.stories.tsx +201 -0
- package/card/ice-cream.jpg +0 -0
- package/card/types.d.ts +67 -0
- package/card/types.js +5 -0
- package/checkbox/Checkbox.d.ts +4 -0
- package/{dist/checkbox → checkbox}/Checkbox.js +16 -63
- package/checkbox/Checkbox.stories.tsx +192 -0
- package/checkbox/types.d.ts +60 -0
- package/checkbox/types.js +5 -0
- package/{dist/chip → chip}/Chip.js +17 -61
- package/chip/Chip.stories.tsx +121 -0
- package/chip/index.d.ts +22 -0
- package/{dist/common → common}/OpenSans.css +0 -0
- package/{dist/common → common}/RequiredComponent.js +3 -11
- package/{dist/common → common}/fonts/OpenSans-Bold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-BoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-ExtraBoldItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Italic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Light.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-LightItalic.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-Regular.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBold.ttf +0 -0
- package/{dist/common → common}/fonts/OpenSans-SemiBoldItalic.ttf +0 -0
- package/{dist/common → common}/utils.js +0 -0
- package/{dist/common → common}/variables.js +160 -152
- package/{dist/date → date}/Date.js +21 -27
- package/date/index.d.ts +27 -0
- package/date-input/DateInput.d.ts +4 -0
- package/{dist/date-input → date-input}/DateInput.js +22 -61
- package/date-input/DateInput.stories.tsx +138 -0
- package/date-input/types.d.ts +100 -0
- package/date-input/types.js +5 -0
- package/dialog/Dialog.d.ts +4 -0
- package/{dist/dialog → dialog}/Dialog.js +20 -73
- package/dialog/Dialog.stories.tsx +212 -0
- package/dialog/types.d.ts +43 -0
- package/dialog/types.js +5 -0
- package/dropdown/Dropdown.d.ts +4 -0
- package/{dist/dropdown → dropdown}/Dropdown.js +44 -171
- package/dropdown/types.d.ts +89 -0
- package/dropdown/types.js +5 -0
- package/file-input/FileInput.d.ts +4 -0
- package/{dist/file-input → file-input}/FileInput.js +56 -189
- package/file-input/FileItem.d.ts +14 -0
- package/file-input/FileItem.js +182 -0
- package/file-input/types.d.ts +87 -0
- package/file-input/types.js +5 -0
- package/footer/Footer.d.ts +4 -0
- package/{dist/footer → footer}/Footer.js +38 -193
- package/footer/Footer.stories.jsx +151 -0
- package/{dist/footer → footer}/Icons.js +13 -13
- package/footer/types.d.ts +61 -0
- package/footer/types.js +5 -0
- package/header/Header.d.ts +7 -0
- package/header/Header.js +324 -0
- package/header/Header.stories.tsx +162 -0
- package/{dist/header → header}/Icons.js +7 -32
- package/header/types.d.ts +47 -0
- package/header/types.js +5 -0
- package/heading/Heading.d.ts +4 -0
- package/{dist/heading → heading}/Heading.js +30 -89
- package/heading/Heading.stories.tsx +53 -0
- package/heading/types.d.ts +33 -0
- package/heading/types.js +5 -0
- package/{dist/input-text → input-text}/Icons.js +2 -2
- package/{dist/input-text → input-text}/InputText.js +36 -130
- package/input-text/index.d.ts +36 -0
- package/{dist/layout → layout}/ApplicationLayout.js +31 -123
- package/{dist/layout → layout}/Icons.js +7 -7
- package/link/Link.d.ts +3 -0
- package/{dist/link → link}/Link.js +18 -94
- package/link/Link.stories.tsx +146 -0
- package/link/types.d.ts +74 -0
- package/link/types.js +5 -0
- package/main.d.ts +44 -0
- package/{dist/main.js → main.js} +93 -97
- package/number-input/NumberInput.d.ts +4 -0
- package/number-input/NumberInput.js +86 -0
- package/number-input/NumberInput.stories.tsx +115 -0
- package/{dist/number-input → number-input}/NumberInputContext.js +1 -1
- package/number-input/types.d.ts +117 -0
- package/number-input/types.js +5 -0
- package/package.json +32 -25
- package/{dist/paginator → paginator}/Icons.js +9 -9
- package/paginator/Paginator.d.ts +4 -0
- package/paginator/Paginator.js +198 -0
- package/paginator/Paginator.stories.tsx +63 -0
- package/paginator/types.d.ts +38 -0
- package/paginator/types.js +5 -0
- package/password-input/PasswordInput.d.ts +4 -0
- package/{dist/password-input → password-input}/PasswordInput.js +24 -60
- package/password-input/PasswordInput.stories.tsx +131 -0
- package/password-input/types.d.ts +100 -0
- package/password-input/types.js +5 -0
- package/progress-bar/ProgressBar.d.ts +4 -0
- package/{dist/progress-bar → progress-bar}/ProgressBar.js +20 -92
- package/progress-bar/ProgressBar.stories.jsx +58 -0
- package/progress-bar/types.d.ts +37 -0
- package/progress-bar/types.js +5 -0
- package/radio/Radio.d.ts +4 -0
- package/{dist/radio → radio}/Radio.js +15 -50
- package/radio/Radio.stories.tsx +192 -0
- package/radio/types.d.ts +54 -0
- package/radio/types.js +5 -0
- package/{dist/resultsetTable → resultsetTable}/ResultsetTable.js +35 -119
- package/resultsetTable/index.d.ts +19 -0
- package/select/Select.js +865 -0
- package/select/Select.stories.tsx +572 -0
- package/select/index.d.ts +131 -0
- package/sidenav/Sidenav.d.ts +9 -0
- package/{dist/sidenav → sidenav}/Sidenav.js +19 -62
- package/sidenav/Sidenav.stories.tsx +165 -0
- package/sidenav/types.d.ts +50 -0
- package/sidenav/types.js +5 -0
- package/slider/Slider.d.ts +4 -0
- package/{dist/slider → slider}/Slider.js +71 -158
- package/slider/Slider.stories.tsx +177 -0
- package/slider/types.d.ts +78 -0
- package/slider/types.js +5 -0
- package/spinner/Spinner.d.ts +4 -0
- package/spinner/Spinner.js +250 -0
- package/spinner/Spinner.stories.jsx +102 -0
- package/spinner/types.d.ts +32 -0
- package/spinner/types.js +5 -0
- package/switch/Switch.d.ts +4 -0
- package/{dist/switch → switch}/Switch.js +26 -69
- package/switch/Switch.stories.tsx +160 -0
- package/switch/types.d.ts +58 -0
- package/switch/types.js +5 -0
- package/table/Table.d.ts +4 -0
- package/{dist/table → table}/Table.js +10 -24
- package/table/Table.stories.jsx +276 -0
- package/table/types.d.ts +21 -0
- package/table/types.js +5 -0
- package/tabs/Tabs.d.ts +4 -0
- package/tabs/Tabs.js +213 -0
- package/tabs/types.d.ts +70 -0
- package/tabs/types.js +5 -0
- package/tag/Tag.d.ts +4 -0
- package/tag/Tag.js +193 -0
- package/tag/Tag.stories.tsx +145 -0
- package/tag/types.d.ts +60 -0
- package/tag/types.js +5 -0
- package/{dist/text-input → text-input}/TextInput.js +244 -390
- package/{dist/text-input → text-input}/index.d.ts +2 -2
- package/{dist/textarea → textarea}/Textarea.js +20 -72
- package/textarea/Textarea.stories.jsx +135 -0
- package/{dist/textarea → textarea}/index.d.ts +0 -0
- package/{dist/toggle → toggle}/Toggle.js +15 -49
- package/toggle/index.d.ts +21 -0
- package/{dist/toggle-group → toggle-group}/ToggleGroup.js +23 -107
- package/toggle-group/ToggleGroup.stories.tsx +178 -0
- package/toggle-group/index.d.ts +21 -0
- package/{dist/upload → upload}/Upload.js +14 -18
- package/{dist/upload → upload}/buttons-upload/ButtonsUpload.js +13 -37
- package/{dist/upload → upload}/buttons-upload/Icons.js +7 -7
- package/upload/dragAndDropArea/DragAndDropArea.js +225 -0
- package/upload/dragAndDropArea/Icons.js +39 -0
- package/upload/file-upload/FileToUpload.js +115 -0
- package/{dist/upload → upload}/file-upload/Icons.js +13 -13
- package/{dist/upload → upload}/files-upload/FilesToUpload.js +12 -26
- package/upload/index.d.ts +15 -0
- package/{dist/upload → upload}/transaction/Icons.js +31 -31
- package/upload/transaction/Transaction.js +104 -0
- package/upload/transactions/Transactions.js +94 -0
- package/{dist/useTheme.js → useTheme.js} +0 -0
- package/{dist/wizard → wizard}/Icons.js +8 -8
- package/wizard/Wizard.d.ts +4 -0
- package/{dist/wizard → wizard}/Wizard.js +32 -206
- package/wizard/Wizard.stories.jsx +224 -0
- package/wizard/types.d.ts +64 -0
- package/wizard/types.js +5 -0
- package/README.md +0 -66
- package/babel.config.js +0 -8
- package/dist/BackgroundColorContext.js +0 -46
- package/dist/ThemeContext.js +0 -248
- package/dist/accordion-group/AccordionGroup.js +0 -186
- package/dist/alert/index.d.ts +0 -51
- package/dist/badge/Badge.js +0 -63
- package/dist/checkbox/Checkbox.stories.js +0 -144
- package/dist/checkbox/readme.md +0 -116
- package/dist/date/Date.stories.js +0 -205
- package/dist/date/readme.md +0 -73
- package/dist/date-input/index.d.ts +0 -95
- package/dist/file-input/FileItem.js +0 -280
- package/dist/file-input/index.d.ts +0 -81
- package/dist/header/Header.js +0 -434
- package/dist/link/readme.md +0 -51
- package/dist/main.d.ts +0 -8
- package/dist/new-select/NewSelect.js +0 -836
- package/dist/new-select/index.d.ts +0 -53
- package/dist/number-input/NumberInput.js +0 -136
- package/dist/number-input/index.d.ts +0 -113
- package/dist/paginator/Paginator.js +0 -283
- package/dist/password-input/index.d.ts +0 -94
- package/dist/progress-bar/ProgressBar.stories.js +0 -280
- package/dist/progress-bar/readme.md +0 -63
- package/dist/radio/Radio.stories.js +0 -166
- package/dist/radio/readme.md +0 -70
- package/dist/slider/readme.md +0 -64
- package/dist/spinner/Spinner.js +0 -381
- package/dist/spinner/Spinner.stories.js +0 -183
- package/dist/spinner/readme.md +0 -65
- package/dist/switch/Switch.stories.js +0 -134
- package/dist/switch/readme.md +0 -133
- package/dist/tabs/Tabs.js +0 -343
- package/dist/tabs/Tabs.stories.js +0 -130
- package/dist/tabs/readme.md +0 -78
- package/dist/tabs-for-sections/TabsForSections.js +0 -92
- package/dist/tabs-for-sections/readme.md +0 -78
- package/dist/tag/Tag.js +0 -282
- package/dist/toggle/Toggle.stories.js +0 -297
- package/dist/toggle/readme.md +0 -80
- package/dist/upload/Upload.stories.js +0 -72
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +0 -329
- package/dist/upload/dragAndDropArea/upload_drop.svg +0 -4
- package/dist/upload/dragAndDropArea/upload_file.svg +0 -4
- package/dist/upload/file-upload/FileToUpload.js +0 -189
- package/dist/upload/readme.md +0 -37
- package/dist/upload/transaction/Transaction.js +0 -148
- package/dist/upload/transactions/Transactions.js +0 -138
- package/test/Accordion.test.js +0 -33
- package/test/AccordionGroup.test.js +0 -125
- package/test/Alert.test.js +0 -53
- package/test/Box.test.js +0 -10
- package/test/Button.test.js +0 -18
- package/test/Card.test.js +0 -30
- package/test/Checkbox.test.js +0 -45
- package/test/Chip.test.js +0 -25
- package/test/Date.test.js +0 -397
- package/test/DateInput.test.js +0 -242
- package/test/Dialog.test.js +0 -23
- package/test/Dropdown.test.js +0 -145
- package/test/FileInput.test.js +0 -201
- package/test/Footer.test.js +0 -94
- package/test/Header.test.js +0 -34
- package/test/Heading.test.js +0 -35
- package/test/InputText.test.js +0 -248
- package/test/Link.test.js +0 -43
- package/test/NumberInput.test.js +0 -259
- package/test/Paginator.test.js +0 -177
- package/test/PasswordInput.test.js +0 -83
- package/test/ProgressBar.test.js +0 -35
- package/test/Radio.test.js +0 -37
- package/test/ResultsetTable.test.js +0 -329
- package/test/Select.test.js +0 -212
- package/test/Sidenav.test.js +0 -45
- package/test/Slider.test.js +0 -74
- package/test/Spinner.test.js +0 -32
- package/test/Switch.test.js +0 -45
- package/test/Table.test.js +0 -36
- package/test/Tabs.test.js +0 -109
- package/test/TabsForSections.test.js +0 -34
- package/test/Tag.test.js +0 -32
- package/test/TextInput.test.js +0 -732
- package/test/Textarea.test.js +0 -193
- package/test/ToggleGroup.test.js +0 -85
- package/test/Upload.test.js +0 -60
- package/test/V3TextArea.test.js +0 -51
- package/test/Wizard.test.js +0 -130
- package/test/mocks/pngMock.js +0 -1
- package/test/mocks/svgMock.js +0 -1
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
17
|
-
|
|
18
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
19
|
-
|
|
20
|
-
var _Tooltip = _interopRequireDefault(require("@material-ui/core/Tooltip"));
|
|
21
|
-
|
|
22
|
-
var _Icons = require("./Icons");
|
|
23
|
-
|
|
24
|
-
var _Spinner = _interopRequireDefault(require("../../spinner/Spinner"));
|
|
25
|
-
|
|
26
|
-
var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
|
|
27
|
-
|
|
28
|
-
var _BackgroundColorContext = require("../../BackgroundColorContext.js");
|
|
29
|
-
|
|
30
|
-
function _templateObject5() {
|
|
31
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: row;\n width: 80%;\n"]);
|
|
32
|
-
|
|
33
|
-
_templateObject5 = function _templateObject5() {
|
|
34
|
-
return data;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
return data;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function _templateObject4() {
|
|
41
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n width: 25px;\n height: 20px;\n max-width: 20%;\n"]);
|
|
42
|
-
|
|
43
|
-
_templateObject4 = function _templateObject4() {
|
|
44
|
-
return data;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
return data;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function _templateObject3() {
|
|
51
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-right: 16px;\n width: 80%;\n text-overflow: ellipsis;\n white-space: nowrap;\n overflow: hidden;\n"]);
|
|
52
|
-
|
|
53
|
-
_templateObject3 = function _templateObject3() {
|
|
54
|
-
return data;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return data;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function _templateObject2() {
|
|
61
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n mask-size: ", ";\n height: ", ";\n width: ", ";\n margin-right: 16px;\n max-width: 20%;\n & svg {\n fill: ", ";\n }\n"]);
|
|
62
|
-
|
|
63
|
-
_templateObject2 = function _templateObject2() {
|
|
64
|
-
return data;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
return data;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function _templateObject() {
|
|
71
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n max-width: 100%;\n display: flex;\n flex-direction: row;\n margin-bottom: 16px;\n color: ", ";\n .MuiCircularProgress-root {\n width: 28px !important;\n height: 28px !important;\n }\n"]);
|
|
72
|
-
|
|
73
|
-
_templateObject = function _templateObject() {
|
|
74
|
-
return data;
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
return data;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
var DxcTransaction = function DxcTransaction(_ref) {
|
|
81
|
-
var _ref$name = _ref.name,
|
|
82
|
-
name = _ref$name === void 0 ? "" : _ref$name,
|
|
83
|
-
_ref$type = _ref.type,
|
|
84
|
-
type = _ref$type === void 0 ? "" : _ref$type,
|
|
85
|
-
_ref$status = _ref.status,
|
|
86
|
-
status = _ref$status === void 0 ? "" : _ref$status,
|
|
87
|
-
_ref$message = _ref.message,
|
|
88
|
-
message = _ref$message === void 0 ? "" : _ref$message;
|
|
89
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
90
|
-
|
|
91
|
-
var icon = status === "error" && (type.includes("image") && _Icons.imageIconError || type.includes("video") && _Icons.videoIconError || type.includes("audio") && _Icons.audioIconError || _Icons.defaultIconError) || type.includes("image") && _Icons.imageIcon || type.includes("video") && _Icons.videoIcon || type.includes("audio") && _Icons.audioIcon || _Icons.defaultIcon;
|
|
92
|
-
|
|
93
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
94
|
-
theme: colorsTheme.upload
|
|
95
|
-
}, _react["default"].createElement(DXCTransaction, {
|
|
96
|
-
status: status
|
|
97
|
-
}, _react["default"].createElement(FileImage, {
|
|
98
|
-
status: status
|
|
99
|
-
}, icon), status === "processing" && _react["default"].createElement(FileData, null, _react["default"].createElement(FileName, null, name), _react["default"].createElement(_BackgroundColorContext.BackgroundColorProvider, {
|
|
100
|
-
color: colorsTheme.upload.backgroundColor
|
|
101
|
-
}, _react["default"].createElement(_Spinner["default"], {
|
|
102
|
-
mode: "small"
|
|
103
|
-
}))) || status === "success" && _react["default"].createElement(FileData, null, _react["default"].createElement(FileName, null, name), _react["default"].createElement(FileStatus, null, _Icons.successIcon)) || status === "error" && _react["default"].createElement(FileData, null, _react["default"].createElement(_Tooltip["default"], {
|
|
104
|
-
title: message
|
|
105
|
-
}, _react["default"].createElement(FileName, null, name)), _react["default"].createElement(FileStatus, null, _Icons.errorIcon), " ")));
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
DxcTransaction.propTypes = {
|
|
109
|
-
name: _propTypes["default"].string,
|
|
110
|
-
type: _propTypes["default"].string,
|
|
111
|
-
status: _propTypes["default"].string,
|
|
112
|
-
message: _propTypes["default"].string
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
var DXCTransaction = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
116
|
-
return props.theme.fontFamily;
|
|
117
|
-
}, function (props) {
|
|
118
|
-
return props.status === "error" && props.theme.errorColor;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
var FileImage = _styledComponents["default"].div(_templateObject2(), function (props) {
|
|
122
|
-
return "".concat(props.theme.uploadedFileIconSize, " ").concat(props.theme.uploadedFileIconSize);
|
|
123
|
-
}, function (props) {
|
|
124
|
-
return props.theme.uploadedFileIconSize;
|
|
125
|
-
}, function (props) {
|
|
126
|
-
return props.theme.uploadedFileIconSize;
|
|
127
|
-
}, function (props) {
|
|
128
|
-
return props.status === "error" && props.theme.errorColor || props.theme.uploadedFileIconColor;
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
var FileName = _styledComponents["default"].div(_templateObject3(), function (props) {
|
|
132
|
-
return props.theme.fileNameFontSize;
|
|
133
|
-
}, function (props) {
|
|
134
|
-
return props.theme.fileNameFontStyle;
|
|
135
|
-
}, function (props) {
|
|
136
|
-
return props.theme.fileNameFontWeight;
|
|
137
|
-
}, function (props) {
|
|
138
|
-
return props.theme.fileNameFontTextTransform;
|
|
139
|
-
}, function (props) {
|
|
140
|
-
return props.theme.fileNameFontColor;
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
var FileStatus = _styledComponents["default"].div(_templateObject4());
|
|
144
|
-
|
|
145
|
-
var FileData = _styledComponents["default"].div(_templateObject5());
|
|
146
|
-
|
|
147
|
-
var _default = DxcTransaction;
|
|
148
|
-
exports["default"] = _default;
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
|
|
4
|
-
|
|
5
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports["default"] = void 0;
|
|
11
|
-
|
|
12
|
-
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
|
|
13
|
-
|
|
14
|
-
var _react = _interopRequireDefault(require("react"));
|
|
15
|
-
|
|
16
|
-
var _styledComponents = _interopRequireWildcard(require("styled-components"));
|
|
17
|
-
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
|
|
20
|
-
var _Transaction = _interopRequireDefault(require("../transaction/Transaction"));
|
|
21
|
-
|
|
22
|
-
var _useTheme = _interopRequireDefault(require("../../useTheme.js"));
|
|
23
|
-
|
|
24
|
-
function _templateObject5() {
|
|
25
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-weight: ", ";\n"]);
|
|
26
|
-
|
|
27
|
-
_templateObject5 = function _templateObject5() {
|
|
28
|
-
return data;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
return data;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function _templateObject4() {
|
|
35
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n"]);
|
|
36
|
-
|
|
37
|
-
_templateObject4 = function _templateObject4() {
|
|
38
|
-
return data;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
return data;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function _templateObject3() {
|
|
45
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-size: ", ";\n font-style: ", ";\n font-weight: ", ";\n text-transform: ", ";\n color: ", ";\n margin-bottom: 4px;\n"]);
|
|
46
|
-
|
|
47
|
-
_templateObject3 = function _templateObject3() {
|
|
48
|
-
return data;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return data;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function _templateObject2() {
|
|
55
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n display: flex;\n flex-direction: column;\n padding-bottom: 35px;\n"]);
|
|
56
|
-
|
|
57
|
-
_templateObject2 = function _templateObject2() {
|
|
58
|
-
return data;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return data;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function _templateObject() {
|
|
65
|
-
var data = (0, _taggedTemplateLiteral2["default"])(["\n font-family: ", ";\n max-width: 100%;\n width: 35%;\n padding-top: 46px;\n padding-left: 65px;\n border-radius: 4px 0px 4px 4px;\n box-shadow: 0px 0px 1px ", ";\n background-color: ", ";\n overflow: auto;\n ::-webkit-scrollbar {\n width: 3px;\n height: 3px;\n }\n ::-webkit-scrollbar-track {\n border-radius: 3px;\n background-color: ", ";\n }\n ::-webkit-scrollbar-thumb {\n border-radius: 3px;\n background-color: ", ";\n }\n"]);
|
|
66
|
-
|
|
67
|
-
_templateObject = function _templateObject() {
|
|
68
|
-
return data;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return data;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
var DxcTransactions = function DxcTransactions(_ref) {
|
|
75
|
-
var transactions = _ref.transactions;
|
|
76
|
-
var colorsTheme = (0, _useTheme["default"])();
|
|
77
|
-
return _react["default"].createElement(_styledComponents.ThemeProvider, {
|
|
78
|
-
theme: colorsTheme.upload
|
|
79
|
-
}, _react["default"].createElement(DXCTransactions, null, _react["default"].createElement(TransactionsText, null, _react["default"].createElement(TransactionsTitle, null, "Files uploaded"), _react["default"].createElement(TransactionsSubTitle, null, _react["default"].createElement(TransactionsNumber, null, transactions && transactions.filter(function (file) {
|
|
80
|
-
return file.status === "success";
|
|
81
|
-
}).length), " ", "documents in total")), transactions.map(function (transaction) {
|
|
82
|
-
return _react["default"].createElement(_Transaction["default"], {
|
|
83
|
-
name: transaction.name,
|
|
84
|
-
type: transaction.type,
|
|
85
|
-
status: transaction.status,
|
|
86
|
-
message: transaction.message
|
|
87
|
-
});
|
|
88
|
-
})));
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
DxcTransactions.propTypes = {
|
|
92
|
-
transactions: _propTypes["default"].array
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
var DXCTransactions = _styledComponents["default"].div(_templateObject(), function (props) {
|
|
96
|
-
return props.theme.fontFamily;
|
|
97
|
-
}, function (props) {
|
|
98
|
-
return props.theme.shadowColor;
|
|
99
|
-
}, function (props) {
|
|
100
|
-
return props.theme.backgroundColor;
|
|
101
|
-
}, function (props) {
|
|
102
|
-
return props.theme.scrollBarTrackColor;
|
|
103
|
-
}, function (props) {
|
|
104
|
-
return props.theme.scrollBarThumbColor;
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
var TransactionsText = _styledComponents["default"].span(_templateObject2());
|
|
108
|
-
|
|
109
|
-
var TransactionsTitle = _styledComponents["default"].span(_templateObject3(), function (props) {
|
|
110
|
-
return props.theme.uploadedFilesTitleFontSize;
|
|
111
|
-
}, function (props) {
|
|
112
|
-
return props.theme.uploadedFilesTitleFontStyle;
|
|
113
|
-
}, function (props) {
|
|
114
|
-
return props.theme.uploadedFilesTitleFontWeight;
|
|
115
|
-
}, function (props) {
|
|
116
|
-
return props.theme.uploadedFilesTitleFontTextTransform;
|
|
117
|
-
}, function (props) {
|
|
118
|
-
return props.theme.uploadedFilesTitleFontColor;
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
var TransactionsSubTitle = _styledComponents["default"].span(_templateObject4(), function (props) {
|
|
122
|
-
return props.theme.uploadedFilesSubtitleFontSize;
|
|
123
|
-
}, function (props) {
|
|
124
|
-
return props.theme.uploadedFilesSubtitleFontStyle;
|
|
125
|
-
}, function (props) {
|
|
126
|
-
return props.theme.uploadedFilesSubtitleFontWeight;
|
|
127
|
-
}, function (props) {
|
|
128
|
-
return props.theme.uploadedFilesSubtitleFontTextTransform;
|
|
129
|
-
}, function (props) {
|
|
130
|
-
return props.theme.uploadedFilesSubtitleFontColor;
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
var TransactionsNumber = _styledComponents["default"].span(_templateObject5(), function (props) {
|
|
134
|
-
return props.theme.uploadedFilesNumberFontWeight;
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
var _default = DxcTransactions;
|
|
138
|
-
exports["default"] = _default;
|
package/test/Accordion.test.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import DxcAccordion from "../src/accordion/Accordion";
|
|
4
|
-
|
|
5
|
-
describe("Accordion component tests", () => {
|
|
6
|
-
test("Accordion renders with correct text", () => {
|
|
7
|
-
const onChange = jest.fn();
|
|
8
|
-
const { getByText } = render(<DxcAccordion label="Accordion" onChange={onChange} />);
|
|
9
|
-
|
|
10
|
-
expect(getByText("Accordion")).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test("Calls correct function on click", () => {
|
|
14
|
-
const onChange = jest.fn();
|
|
15
|
-
const { getByText } = render(<DxcAccordion label="Accordion" onChange={onChange} />);
|
|
16
|
-
|
|
17
|
-
fireEvent.click(getByText("Accordion"));
|
|
18
|
-
expect(onChange).toHaveBeenCalled();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("Controlled accordion", () => {
|
|
22
|
-
const onChange = jest.fn();
|
|
23
|
-
const { getByText } = render(<DxcAccordion label="Accordion" onChange={onChange} isExpanded={true} />);
|
|
24
|
-
|
|
25
|
-
fireEvent.click(getByText("Accordion"));
|
|
26
|
-
fireEvent.click(getByText("Accordion"));
|
|
27
|
-
fireEvent.click(getByText("Accordion"));
|
|
28
|
-
expect(onChange).toHaveBeenCalledTimes(3);
|
|
29
|
-
expect(onChange.mock.calls[0][0]).toBe(false);
|
|
30
|
-
expect(onChange.mock.calls[1][0]).toBe(false);
|
|
31
|
-
expect(onChange.mock.calls[2][0]).toBe(false);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import DxcAccordionGroup from "../src/accordion-group/AccordionGroup";
|
|
4
|
-
|
|
5
|
-
describe("Accordion component tests", () => {
|
|
6
|
-
test("Uncontrolled accordion group renders with children", () => {
|
|
7
|
-
const { getByText, getAllByRole } = render(
|
|
8
|
-
<DxcAccordionGroup>
|
|
9
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
|
|
10
|
-
<div>
|
|
11
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
12
|
-
leo lobortis eget.
|
|
13
|
-
</div>
|
|
14
|
-
</DxcAccordionGroup.Accordion>
|
|
15
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
16
|
-
<div>
|
|
17
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
18
|
-
leo lobortis eget.
|
|
19
|
-
</div>
|
|
20
|
-
</DxcAccordionGroup.Accordion>
|
|
21
|
-
</DxcAccordionGroup>
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
expect(getByText("Accordion1")).toBeTruthy();
|
|
25
|
-
expect(getByText("Accordion2")).toBeTruthy();
|
|
26
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
27
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("false");
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test("Uncontrolled accordion group renders with only one children", () => {
|
|
31
|
-
const { getByText, getAllByRole } = render(
|
|
32
|
-
<DxcAccordionGroup>
|
|
33
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium">
|
|
34
|
-
<div>
|
|
35
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
36
|
-
leo lobortis eget.
|
|
37
|
-
</div>
|
|
38
|
-
</DxcAccordionGroup.Accordion>
|
|
39
|
-
</DxcAccordionGroup>
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
expect(getByText("Accordion1")).toBeTruthy();
|
|
43
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
test("Uncontrolled accordion group calls correct function on click", () => {
|
|
47
|
-
const onActiveChange = jest.fn();
|
|
48
|
-
const { getByText, getAllByRole } = render(
|
|
49
|
-
<DxcAccordionGroup margin="large" onActiveChange={onActiveChange}>
|
|
50
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium" margin="large">
|
|
51
|
-
<div>
|
|
52
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
53
|
-
leo lobortis eget.
|
|
54
|
-
</div>
|
|
55
|
-
</DxcAccordionGroup.Accordion>
|
|
56
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
57
|
-
<div>
|
|
58
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse malesuada lacus ex, sit amet blandit
|
|
59
|
-
leo lobortis eget.
|
|
60
|
-
</div>
|
|
61
|
-
</DxcAccordionGroup.Accordion>
|
|
62
|
-
</DxcAccordionGroup>
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
66
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("false");
|
|
67
|
-
fireEvent.click(getByText("Accordion1"));
|
|
68
|
-
expect(onActiveChange).toHaveBeenCalled();
|
|
69
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("true");
|
|
70
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("false");
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
test("Controlled accordion with indexActive change", () => {
|
|
74
|
-
const onActiveChange = jest.fn();
|
|
75
|
-
const { getByText, getAllByRole, rerender } = render(
|
|
76
|
-
<DxcAccordionGroup margin="large" indexActive={1} onActiveChange={onActiveChange}>
|
|
77
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium" margin="large">
|
|
78
|
-
<div>Text1</div>
|
|
79
|
-
</DxcAccordionGroup.Accordion>
|
|
80
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
81
|
-
<div>Text2</div>
|
|
82
|
-
</DxcAccordionGroup.Accordion>
|
|
83
|
-
</DxcAccordionGroup>
|
|
84
|
-
);
|
|
85
|
-
expect(getByText("Text1")).toBeTruthy();
|
|
86
|
-
expect(getByText("Text2")).toBeTruthy();
|
|
87
|
-
fireEvent.click(getByText("Accordion1"));
|
|
88
|
-
fireEvent.click(getByText("Accordion2"));
|
|
89
|
-
expect(onActiveChange.mock.calls[0][0]).toBe(0);
|
|
90
|
-
expect(onActiveChange.mock.calls[1][0]).toBe(1);
|
|
91
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("false");
|
|
92
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("true");
|
|
93
|
-
|
|
94
|
-
rerender(
|
|
95
|
-
<DxcAccordionGroup margin="large" indexActive={0} onActiveChange={onActiveChange}>
|
|
96
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium" margin="large">
|
|
97
|
-
<div>Text1</div>
|
|
98
|
-
</DxcAccordionGroup.Accordion>
|
|
99
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
100
|
-
<div>Text2</div>
|
|
101
|
-
</DxcAccordionGroup.Accordion>
|
|
102
|
-
</DxcAccordionGroup>
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
expect(getAllByRole("button")[0].getAttribute("aria-expanded")).toBe("true");
|
|
106
|
-
expect(getAllByRole("button")[1].getAttribute("aria-expanded")).toBe("false");
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
test("Disabled uncontrolled accordion group", () => {
|
|
110
|
-
const onActiveChange = jest.fn();
|
|
111
|
-
const { getByText } = render(
|
|
112
|
-
<DxcAccordionGroup margin="large" onActiveChange={onActiveChange} disabled={true}>
|
|
113
|
-
<DxcAccordionGroup.Accordion label="Accordion1" padding="medium" margin="large">
|
|
114
|
-
<div>Text1</div>
|
|
115
|
-
</DxcAccordionGroup.Accordion>
|
|
116
|
-
<DxcAccordionGroup.Accordion label="Accordion2" padding="medium">
|
|
117
|
-
<div>Text2</div>
|
|
118
|
-
</DxcAccordionGroup.Accordion>
|
|
119
|
-
</DxcAccordionGroup>
|
|
120
|
-
);
|
|
121
|
-
fireEvent.click(getByText("Accordion1"));
|
|
122
|
-
fireEvent.click(getByText("Accordion2"));
|
|
123
|
-
expect(onActiveChange).toHaveBeenCalledTimes(0);
|
|
124
|
-
});
|
|
125
|
-
});
|
package/test/Alert.test.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import DxcAlert from "../src/alert/Alert";
|
|
4
|
-
|
|
5
|
-
describe("Alert component tests", () => {
|
|
6
|
-
test("Info alert renders with correct text", () => {
|
|
7
|
-
const { getByText } = render(<DxcAlert type="info" inlineText="info-alert-text" />);
|
|
8
|
-
expect(getByText("information")).toBeTruthy();
|
|
9
|
-
expect(getByText("info-alert-text")).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test("Confirm alert renders with correct text", () => {
|
|
13
|
-
const { getByText } = render(<DxcAlert type="confirm" inlineText="confirm-alert-text" />);
|
|
14
|
-
expect(getByText("success")).toBeTruthy();
|
|
15
|
-
expect(getByText("confirm-alert-text")).toBeTruthy();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test("Warning alert renders with correct text", () => {
|
|
19
|
-
const { getByText } = render(<DxcAlert type="warning" inlineText="warning-alert-text" />);
|
|
20
|
-
expect(getByText("warning")).toBeTruthy();
|
|
21
|
-
expect(getByText("warning-alert-text")).toBeTruthy();
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test("Error alert renders with correct text", () => {
|
|
25
|
-
const { getByText } = render(<DxcAlert type="error" inlineText="error-alert-text" />);
|
|
26
|
-
expect(getByText("error")).toBeTruthy();
|
|
27
|
-
expect(getByText("error-alert-text")).toBeTruthy();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test("Alert renders with correct children", () => {
|
|
31
|
-
const { getByText } = render(<DxcAlert inlineText="alert-text"><p>sample-children</p></DxcAlert>);
|
|
32
|
-
expect(getByText("alert-text")).toBeTruthy();
|
|
33
|
-
expect(getByText("sample-children")).toBeTruthy();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test("Calls correct function on close", () => {
|
|
37
|
-
const onClose = jest.fn();
|
|
38
|
-
const { getByRole } = render(<DxcAlert onClose={onClose} inlineText="info-alert-text" />);
|
|
39
|
-
|
|
40
|
-
const closeButton = getByRole("button");
|
|
41
|
-
fireEvent.click(closeButton);
|
|
42
|
-
expect(onClose).toHaveBeenCalled();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test("Modal alert calls correct function on close", () => {
|
|
46
|
-
const onClose = jest.fn();
|
|
47
|
-
const { getByRole } = render(<DxcAlert onClose={onClose} mode="modal" inlineText="info-alert-text" />);
|
|
48
|
-
|
|
49
|
-
const closeButton = getByRole("button");
|
|
50
|
-
fireEvent.click(closeButton);
|
|
51
|
-
expect(onClose).toHaveBeenCalled();
|
|
52
|
-
});
|
|
53
|
-
});
|
package/test/Box.test.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@testing-library/react";
|
|
3
|
-
import DxcBox from "../src/card/Card";
|
|
4
|
-
|
|
5
|
-
describe("Box component tests", () => {
|
|
6
|
-
test("Box renders with correct text", () => {
|
|
7
|
-
const { getByText } = render(<DxcBox>test-box</DxcBox>);
|
|
8
|
-
expect(getByText("test-box")).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
});
|
package/test/Button.test.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import DxcButton from "../src/button/Button";
|
|
4
|
-
|
|
5
|
-
describe("Button component tests", () => {
|
|
6
|
-
test("Button renders with correct text", () => {
|
|
7
|
-
const { getByText } = render(<DxcButton label="Button" />);
|
|
8
|
-
expect(getByText("Button")).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
test("Calls correct function on click", () => {
|
|
11
|
-
const onClick = jest.fn();
|
|
12
|
-
const { getByText } = render(<DxcButton label="Button" onClick={onClick} />);
|
|
13
|
-
|
|
14
|
-
const button = getByText("Button");
|
|
15
|
-
fireEvent.click(button);
|
|
16
|
-
expect(onClick).toHaveBeenCalled();
|
|
17
|
-
});
|
|
18
|
-
});
|
package/test/Card.test.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import DxcCard from "../src/card/Card";
|
|
4
|
-
|
|
5
|
-
describe("Card component tests", () => {
|
|
6
|
-
test("Card renders with correct content", () => {
|
|
7
|
-
const { getByText } = render(<DxcCard>test-card</DxcCard>);
|
|
8
|
-
expect(getByText("test-card")).toBeTruthy();
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test("Card renders with correct href", () => {
|
|
12
|
-
const { getByRole } = render(<DxcCard linkHref="/testPage">test-card</DxcCard>);
|
|
13
|
-
const card = getByRole("link");
|
|
14
|
-
expect(card.getAttribute("href")).toEqual("/testPage");
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test("Card renders with correct image", () => {
|
|
18
|
-
const { getByRole } = render(<DxcCard imageSrc="/testImage">test-card</DxcCard>);
|
|
19
|
-
const card = getByRole("img");
|
|
20
|
-
expect(card.getAttribute("src")).toEqual("/testImage");
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("OnClick function is called", () => {
|
|
24
|
-
const onClick = jest.fn();
|
|
25
|
-
const { getByText } = render(<DxcCard onClick={onClick}>test-card</DxcCard>);
|
|
26
|
-
const card = getByText("test-card");
|
|
27
|
-
fireEvent.click(card);
|
|
28
|
-
expect(onClick).toHaveBeenCalled();
|
|
29
|
-
});
|
|
30
|
-
});
|
package/test/Checkbox.test.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
|
|
4
|
-
import DxcCheckbox from "../src/checkbox/Checkbox";
|
|
5
|
-
|
|
6
|
-
describe("Checkbox component tests", () => {
|
|
7
|
-
test("Checkbox renders with correct text", () => {
|
|
8
|
-
const { getByText } = render(<DxcCheckbox label="Checkbox" />);
|
|
9
|
-
|
|
10
|
-
expect(getByText("Checkbox")).toBeTruthy();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test("Calls correct function on click", () => {
|
|
14
|
-
const onChange = jest.fn();
|
|
15
|
-
const { getByText } = render(<DxcCheckbox label="Checkbox" onChange={onChange} />);
|
|
16
|
-
|
|
17
|
-
fireEvent.click(getByText("Checkbox"));
|
|
18
|
-
expect(onChange).toHaveBeenCalled();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("Uncontrolled checkbox", () => {
|
|
22
|
-
const onChange = jest.fn();
|
|
23
|
-
const component = render(<DxcCheckbox label="Checkbox" onChange={onChange} />);
|
|
24
|
-
const visibleCheckbox = component.getByText("Checkbox");
|
|
25
|
-
const input = component.getByRole("checkbox");
|
|
26
|
-
expect(input.checked).toBe(false);
|
|
27
|
-
fireEvent.click(visibleCheckbox);
|
|
28
|
-
expect(onChange).toHaveBeenCalled();
|
|
29
|
-
expect(onChange).toHaveBeenCalledWith(true);
|
|
30
|
-
expect(input.checked).toBe(true);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test("Controlled checkbox", () => {
|
|
34
|
-
const onChange = jest.fn();
|
|
35
|
-
const component = render(<DxcCheckbox label="Checkbox" checked={false} onChange={onChange} />);
|
|
36
|
-
|
|
37
|
-
const input = component.getByRole("checkbox");
|
|
38
|
-
const visibleCheckbox = component.getByText("Checkbox");
|
|
39
|
-
|
|
40
|
-
fireEvent.click(visibleCheckbox);
|
|
41
|
-
expect(onChange).toHaveBeenCalled();
|
|
42
|
-
expect(onChange).toHaveBeenCalledWith(true);
|
|
43
|
-
expect(input.checked).toBe(false);
|
|
44
|
-
});
|
|
45
|
-
});
|
package/test/Chip.test.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render, fireEvent } from "@testing-library/react";
|
|
3
|
-
import DxcChip from "../src/chip/Chip";
|
|
4
|
-
import icon from "../../app/src/images/invision.svg";
|
|
5
|
-
|
|
6
|
-
describe("Chip component tests", () => {
|
|
7
|
-
test("Chip renders with correct text", () => {
|
|
8
|
-
const { getByText } = render(<DxcChip label="Chip" />);
|
|
9
|
-
expect(getByText("Chip")).toBeTruthy();
|
|
10
|
-
});
|
|
11
|
-
test("Calls correct function when clicking on prefix icon", () => {
|
|
12
|
-
const onClick = jest.fn();
|
|
13
|
-
const { getByText, getByRole } = render(<DxcChip label="Chip" prefixIconSrc={icon} onClickPrefix={onClick} />);
|
|
14
|
-
expect(getByText("Chip")).toBeTruthy();
|
|
15
|
-
fireEvent.click(getByRole("img"));
|
|
16
|
-
expect(onClick).toHaveBeenCalled();
|
|
17
|
-
});
|
|
18
|
-
test("Calls correct function when clicking on suffix icon", () => {
|
|
19
|
-
const onClick = jest.fn();
|
|
20
|
-
const { getByText, getByRole } = render(<DxcChip label="Chip" suffixIconSrc={icon} onClickSuffix={onClick} />);
|
|
21
|
-
expect(getByText("Chip")).toBeTruthy();
|
|
22
|
-
fireEvent.click(getByRole("img"));
|
|
23
|
-
expect(onClick).toHaveBeenCalled();
|
|
24
|
-
});
|
|
25
|
-
});
|