@dxc-technology/halstack-react 0.0.0-89339f9 → 0.0.0-8c3739a
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/dist/ThemeContext.js +131 -99
- package/dist/accordion/Accordion.js +72 -59
- package/dist/accordion-group/AccordionGroup.js +1 -3
- package/dist/alert/Alert.js +126 -111
- package/dist/alert/index.d.ts +51 -0
- package/dist/badge/Badge.js +3 -1
- package/dist/box/Box.js +1 -9
- package/dist/button/Button.js +30 -20
- package/dist/card/Card.js +2 -4
- package/dist/checkbox/Checkbox.js +30 -21
- package/dist/chip/Chip.js +30 -28
- package/dist/common/variables.js +987 -572
- package/dist/date/Date.js +17 -29
- package/dist/date-input/DateInput.js +400 -0
- package/dist/date-input/index.d.ts +95 -0
- package/dist/dialog/Dialog.js +21 -39
- package/dist/dropdown/Dropdown.js +123 -71
- package/dist/file-input/FileInput.js +644 -0
- package/dist/file-input/FileItem.js +280 -0
- package/dist/file-input/index.d.ts +81 -0
- package/dist/footer/Footer.js +25 -35
- package/dist/footer/dxc_logo.svg +15 -0
- package/dist/header/Header.js +14 -42
- package/dist/header/dxc_logo_black.svg +8 -0
- package/dist/heading/Heading.js +1 -5
- package/dist/input-text/InputText.js +96 -58
- package/dist/layout/ApplicationLayout.js +1 -1
- package/dist/link/Link.js +23 -26
- package/dist/main.d.ts +8 -0
- package/dist/main.js +57 -1
- package/dist/new-select/NewSelect.js +836 -0
- package/dist/new-select/index.d.ts +53 -0
- package/dist/new-textarea/NewTextarea.js +369 -0
- package/dist/new-textarea/index.d.ts +117 -0
- package/dist/number-input/NumberInput.js +136 -0
- package/dist/number-input/NumberInputContext.js +16 -0
- package/dist/number-input/index.d.ts +113 -0
- package/dist/paginator/Paginator.js +10 -4
- package/dist/password-input/PasswordInput.js +198 -0
- package/dist/password-input/index.d.ts +94 -0
- package/dist/progress-bar/ProgressBar.js +63 -27
- package/dist/resultsetTable/ResultsetTable.js +5 -22
- package/dist/select/Select.js +189 -185
- package/dist/sidenav/Sidenav.js +11 -15
- package/dist/slider/Slider.js +145 -66
- package/dist/spinner/Spinner.js +226 -59
- package/dist/switch/Switch.js +3 -3
- package/dist/table/Table.js +15 -5
- package/dist/tabs/Tabs.js +4 -8
- package/dist/tag/Tag.js +38 -36
- package/dist/text-input/TextInput.js +971 -0
- package/dist/text-input/index.d.ts +135 -0
- package/dist/textarea/Textarea.js +26 -22
- package/dist/toggle-group/ToggleGroup.js +130 -44
- package/dist/upload/buttons-upload/ButtonsUpload.js +8 -4
- package/dist/upload/dragAndDropArea/DragAndDropArea.js +16 -12
- package/dist/upload/file-upload/FileToUpload.js +4 -4
- package/dist/upload/transaction/Transaction.js +13 -9
- package/dist/upload/transactions/Transactions.js +11 -11
- package/dist/wizard/Wizard.js +84 -56
- package/dist/wizard/invalid_icon.svg +4 -5
- package/dist/wizard/valid_icon.svg +4 -5
- package/package.json +4 -2
- package/test/DateInput.test.js +242 -0
- package/test/Dropdown.test.js +15 -0
- package/test/FileInput.test.js +201 -0
- package/test/InputText.test.js +24 -16
- package/test/NewTextarea.test.js +195 -0
- package/test/NumberInput.test.js +259 -0
- package/test/Paginator.test.js +1 -1
- package/test/PasswordInput.test.js +83 -0
- package/test/ResultsetTable.test.js +1 -2
- package/test/Select.test.js +44 -24
- package/test/Spinner.test.js +5 -0
- package/test/TextInput.test.js +732 -0
- package/test/ToggleGroup.test.js +5 -1
- package/dist/accordion/Accordion.stories.js +0 -207
- package/dist/accordion/readme.md +0 -96
- package/dist/accordion-group/AccordionGroup.stories.js +0 -207
- package/dist/accordion-group/readme.md +0 -70
- package/dist/alert/Alert.stories.js +0 -158
- package/dist/alert/close.svg +0 -4
- package/dist/alert/error.svg +0 -4
- package/dist/alert/info.svg +0 -4
- package/dist/alert/readme.md +0 -43
- package/dist/alert/success.svg +0 -4
- package/dist/alert/warning.svg +0 -4
- package/dist/button/Button.stories.js +0 -224
- package/dist/button/readme.md +0 -93
- package/dist/date/calendar.svg +0 -1
- package/dist/date/calendar_dark.svg +0 -1
- package/dist/dialog/Dialog.stories.js +0 -217
- package/dist/dialog/readme.md +0 -32
- package/dist/dropdown/Dropdown.stories.js +0 -249
- package/dist/dropdown/baseline-arrow_drop_down.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_down_wh.svg +0 -4
- package/dist/dropdown/baseline-arrow_drop_up.svg +0 -1
- package/dist/dropdown/baseline-arrow_drop_up_wh.svg +0 -4
- package/dist/dropdown/readme.md +0 -69
- package/dist/footer/Footer.stories.js +0 -94
- package/dist/footer/dxc_logo_wht.png +0 -0
- package/dist/header/dxc_logo_black.png +0 -0
- package/dist/header/dxc_logo_blk_rgb.svg +0 -6
- package/dist/header/dxc_logo_white.png +0 -0
- package/dist/input-text/InputText.stories.js +0 -209
- package/dist/select/Select.stories.js +0 -235
- package/dist/select/readme.md +0 -72
- package/dist/slider/Slider.stories.js +0 -241
- package/dist/toggle-group/readme.md +0 -82
package/test/Select.test.js
CHANGED
|
@@ -21,18 +21,43 @@ const optionsWithoutIcon = [
|
|
|
21
21
|
const optionsWithIcons = [
|
|
22
22
|
{
|
|
23
23
|
value: 1,
|
|
24
|
-
label: "
|
|
25
|
-
|
|
24
|
+
label: "Image 1",
|
|
25
|
+
icon: (
|
|
26
|
+
<svg
|
|
27
|
+
data-testid="image-1"
|
|
28
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
29
|
+
height="24px"
|
|
30
|
+
viewBox="0 0 24 24"
|
|
31
|
+
width="24px"
|
|
32
|
+
fill="currentColor"
|
|
33
|
+
>
|
|
34
|
+
<path d="M0 0h24v24H0V0z" fill="none" />
|
|
35
|
+
<path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z" />
|
|
36
|
+
</svg>
|
|
37
|
+
),
|
|
26
38
|
},
|
|
27
39
|
{
|
|
28
40
|
value: 2,
|
|
29
|
-
label: "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
41
|
+
label: "Image 2",
|
|
42
|
+
icon: (
|
|
43
|
+
<svg
|
|
44
|
+
data-testid="image-2"
|
|
45
|
+
version="1.1"
|
|
46
|
+
x="0px"
|
|
47
|
+
y="0px"
|
|
48
|
+
width="24px"
|
|
49
|
+
height="24px"
|
|
50
|
+
viewBox="0 0 24 24"
|
|
51
|
+
enable-background="new 0 0 24 24"
|
|
52
|
+
>
|
|
53
|
+
<g id="Bounding_Box">
|
|
54
|
+
<rect fill="none" width="24" height="24" />
|
|
55
|
+
</g>
|
|
56
|
+
<g id="Master">
|
|
57
|
+
<path d="M19,9.3V4h-3v2.6L12,3L2,12h3v8h5v-6h4v6h5v-8h3L19,9.3z M10,10c0-1.1,0.9-2,2-2s2,0.9,2,2H10z" />
|
|
58
|
+
</g>
|
|
59
|
+
</svg>
|
|
60
|
+
),
|
|
36
61
|
},
|
|
37
62
|
];
|
|
38
63
|
|
|
@@ -60,29 +85,27 @@ describe("Select component tests", () => {
|
|
|
60
85
|
});
|
|
61
86
|
|
|
62
87
|
test("Select renders options with icons before", () => {
|
|
63
|
-
const { getByRole,
|
|
88
|
+
const { getByRole, getByTestId } = render(
|
|
64
89
|
<DxcSelect label="test-select-name" options={optionsWithIcons}></DxcSelect>
|
|
65
90
|
);
|
|
66
91
|
const select = getByRole("button");
|
|
67
92
|
act(() => {
|
|
68
93
|
userEvent.click(select);
|
|
69
94
|
});
|
|
70
|
-
expect(
|
|
71
|
-
expect(
|
|
72
|
-
expect(getAllByRole("img")[2].getAttribute("src")).toEqual("/testIconLinkedin");
|
|
95
|
+
expect(getByTestId("image-1")).toBeTruthy();
|
|
96
|
+
expect(getByTestId("image-2")).toBeTruthy();
|
|
73
97
|
});
|
|
74
98
|
|
|
75
99
|
test("Select renders options with icons after", () => {
|
|
76
|
-
const { getByRole,
|
|
100
|
+
const { getByRole, getByTestId } = render(
|
|
77
101
|
<DxcSelect label="test-select-name" options={optionsWithIcons} iconPosition="after"></DxcSelect>
|
|
78
102
|
);
|
|
79
103
|
const select = getByRole("button");
|
|
80
104
|
act(() => {
|
|
81
105
|
userEvent.click(select);
|
|
82
106
|
});
|
|
83
|
-
expect(
|
|
84
|
-
expect(
|
|
85
|
-
expect(getAllByRole("img")[2].getAttribute("src")).toEqual("/testIconLinkedin");
|
|
107
|
+
expect(getByTestId("image-1")).toBeTruthy();
|
|
108
|
+
expect(getByTestId("image-2")).toBeTruthy();
|
|
86
109
|
});
|
|
87
110
|
|
|
88
111
|
test("Select renders with a default value", () => {
|
|
@@ -166,25 +189,22 @@ describe("Select component tests", () => {
|
|
|
166
189
|
act(() => {
|
|
167
190
|
userEvent.click(select);
|
|
168
191
|
});
|
|
169
|
-
const option1 = getByText("Amazon");
|
|
170
|
-
const option2 = getByText("Ebay");
|
|
171
|
-
const option3 = getByText("Apple");
|
|
172
192
|
act(() => {
|
|
173
|
-
userEvent.click(
|
|
193
|
+
userEvent.click(getByText("Amazon"));
|
|
174
194
|
});
|
|
175
195
|
expect(onChange).toHaveBeenCalledWith([1]);
|
|
176
196
|
act(() => {
|
|
177
|
-
userEvent.click(
|
|
197
|
+
userEvent.click(getByText("Ebay"));
|
|
178
198
|
});
|
|
179
199
|
expect(onChange).toHaveBeenCalledWith([1, 2]);
|
|
180
200
|
expect(getByText("Amazon, Ebay")).toBeTruthy();
|
|
181
201
|
act(() => {
|
|
182
|
-
userEvent.click(
|
|
202
|
+
userEvent.click(getByText("Apple"));
|
|
183
203
|
});
|
|
184
204
|
expect(onChange).toHaveBeenCalledWith([1, 2, 3]);
|
|
185
205
|
expect(getByText("Amazon, Ebay, Apple")).toBeTruthy();
|
|
186
206
|
act(() => {
|
|
187
|
-
userEvent.click(
|
|
207
|
+
userEvent.click(getByText("Amazon"));
|
|
188
208
|
});
|
|
189
209
|
expect(onChange).toHaveBeenCalledWith([2, 3]);
|
|
190
210
|
expect(getByText("Ebay, Apple")).toBeTruthy();
|
package/test/Spinner.test.js
CHANGED
|
@@ -24,4 +24,9 @@ describe("Spinner component tests", () => {
|
|
|
24
24
|
expect(getByText("test-loading")).toBeTruthy();
|
|
25
25
|
expect(getByText("75%")).toBeTruthy();
|
|
26
26
|
});
|
|
27
|
+
|
|
28
|
+
test("Get spinner by role", () => {
|
|
29
|
+
const { getByRole } = render(<DxcSpinner label="test-loading" value={75} showValue></DxcSpinner>);
|
|
30
|
+
expect(getByRole("progressbar")).toBeTruthy();
|
|
31
|
+
});
|
|
27
32
|
});
|