@zohodesk/components 1.3.2 → 1.3.3
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/.cli/propValidation_report.html +1 -1
- package/README.md +8 -0
- package/es/Button/__tests__/Button.spec.js +134 -1
- package/es/DateTime/__tests__/YearView.spec.js +1 -2
- package/es/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +8 -1
- package/es/Provider/IdProvider.js +1 -1
- package/es/Select/__tests__/Select.spec.js +1130 -4
- package/es/Select/__tests__/__snapshots__/Select.spec.js.snap +9621 -1
- package/es/Stencils/Stencils.js +5 -12
- package/es/Stencils/Stencils.module.css +11 -7
- package/es/Stencils/__tests__/Stencils.spec.js +9 -1
- package/es/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +27 -11
- package/es/Stencils/props/defaultProps.js +2 -1
- package/es/Stencils/props/propTypes.js +3 -2
- package/es/Tab/Tab.js +2 -1
- package/es/Tab/TabWrapper.js +2 -1
- package/es/Tab/Tabs.js +10 -10
- package/es/Tab/__tests__/TabLayout.spec.js +34 -0
- package/es/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +341 -0
- package/es/Tab/props/propTypes.js +2 -2
- package/es/Tab/utils/tabConfigs.js +18 -0
- package/es/Tag/__tests__/Tag.spec.js +8 -1
- package/es/utils/Common.js +1 -1
- package/lib/Button/__tests__/Button.spec.js +140 -0
- package/lib/DateTime/__tests__/YearView.spec.js +1 -2
- package/lib/MultiSelect/__tests__/AdvancedMultiSelect.spec.js +8 -0
- package/lib/Provider/IdProvider.js +1 -0
- package/lib/Select/__tests__/Select.spec.js +1364 -3
- package/lib/Select/__tests__/__snapshots__/Select.spec.js.snap +9621 -1
- package/lib/Stencils/Stencils.js +5 -12
- package/lib/Stencils/Stencils.module.css +11 -7
- package/lib/Stencils/__tests__/Stencils.spec.js +11 -3
- package/lib/Stencils/__tests__/__snapshots__/Stencils.spec.js.snap +27 -11
- package/lib/Stencils/props/defaultProps.js +2 -1
- package/lib/Stencils/props/propTypes.js +3 -2
- package/lib/Tab/Tab.js +3 -1
- package/lib/Tab/TabWrapper.js +3 -1
- package/lib/Tab/Tabs.js +11 -10
- package/lib/Tab/__tests__/TabLayout.spec.js +41 -0
- package/lib/Tab/__tests__/__snapshots__/TabLayout.spec.js.snap +341 -0
- package/lib/Tab/props/propTypes.js +2 -2
- package/lib/Tab/utils/tabConfigs.js +27 -0
- package/lib/Tag/__tests__/Tag.spec.js +10 -2
- package/lib/utils/Common.js +1 -1
- package/package.json +1 -1
- package/react-cli.config.js +2 -2
- package/result.json +1 -1
- package/es/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +0 -61
- package/lib/DateTime/__tests__/__snapshots__/YearView.spec.js.snap +0 -61
package/README.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
Dot UI is a customizable React component library built to deliver a clean, accessible, and developer-friendly UI experience. It offers a growing set of reusable components designed to align with modern design systems and streamline application development across projects.
|
|
4
4
|
|
|
5
|
+
# 1.3.3
|
|
6
|
+
|
|
7
|
+
- **Stencils**
|
|
8
|
+
- Added `isAnimated` prop to support Stencils without Animation.
|
|
9
|
+
- Added `square` shape in existing shape collection
|
|
10
|
+
- **TabWrapper**
|
|
11
|
+
- Added `vertical-reverse, row-reverse` alignment suport in align propType
|
|
12
|
+
|
|
5
13
|
# 1.3.2
|
|
6
14
|
|
|
7
15
|
- **Popup**
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Button from "../Button";
|
|
3
|
-
import { render } from
|
|
3
|
+
import { render, cleanup } from '@testing-library/react';
|
|
4
|
+
import userEvent from '@testing-library/user-event';
|
|
5
|
+
import '@testing-library/jest-dom';
|
|
6
|
+
afterEach(() => {
|
|
7
|
+
cleanup();
|
|
8
|
+
});
|
|
4
9
|
describe('Button component', () => {
|
|
5
10
|
test('Should be render with the basic set of default props', () => {
|
|
6
11
|
const {
|
|
@@ -106,4 +111,132 @@ describe('Button component', () => {
|
|
|
106
111
|
// const { asFragment } = render(<Button customStyle={{$medium: "buttonMedium"}} />);
|
|
107
112
|
// expect(asFragment()).toMatchSnapshot();
|
|
108
113
|
// });
|
|
114
|
+
});
|
|
115
|
+
describe('Button - Unit Testing', () => {
|
|
116
|
+
test('Should render with text prop', () => {
|
|
117
|
+
const {
|
|
118
|
+
getByText
|
|
119
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
120
|
+
text: "Click Me"
|
|
121
|
+
}));
|
|
122
|
+
expect(getByText('Click Me')).toBeInTheDocument();
|
|
123
|
+
});
|
|
124
|
+
test('Should render with children prop', () => {
|
|
125
|
+
const {
|
|
126
|
+
getByText
|
|
127
|
+
} = render( /*#__PURE__*/React.createElement(Button, null, "Click Me"));
|
|
128
|
+
expect(getByText('Click Me')).toBeInTheDocument();
|
|
129
|
+
});
|
|
130
|
+
test('Should apply custom styles from customStyle prop', () => {
|
|
131
|
+
const {
|
|
132
|
+
getByRole
|
|
133
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
134
|
+
customStyle: {
|
|
135
|
+
bold: 'customBoldClass'
|
|
136
|
+
}
|
|
137
|
+
})); // expect(getByRole('button').getAttribute('class')).toContain('customBoldClass');
|
|
138
|
+
|
|
139
|
+
expect(getByRole('button')).toHaveClass('customBoldClass');
|
|
140
|
+
});
|
|
141
|
+
test('Should apply custom classes from customClass prop', () => {
|
|
142
|
+
const {
|
|
143
|
+
getByRole
|
|
144
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
145
|
+
customClass: {
|
|
146
|
+
customButton: 'customButtonClass'
|
|
147
|
+
}
|
|
148
|
+
}));
|
|
149
|
+
expect(getByRole('button')).toHaveClass('customButtonClass');
|
|
150
|
+
});
|
|
151
|
+
test('Should be disabled when disabled prop is true', () => {
|
|
152
|
+
const {
|
|
153
|
+
getByRole
|
|
154
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
155
|
+
disabled: true
|
|
156
|
+
}));
|
|
157
|
+
expect(getByRole('button')).toBeDisabled();
|
|
158
|
+
});
|
|
159
|
+
test('Should expose element with getRef prop', () => {
|
|
160
|
+
const getRef = jest.fn();
|
|
161
|
+
const {
|
|
162
|
+
getByRole
|
|
163
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
164
|
+
getRef: getRef
|
|
165
|
+
}));
|
|
166
|
+
expect(getRef).toHaveBeenCalledWith(getByRole('button'));
|
|
167
|
+
});
|
|
168
|
+
test('Should trigger onClick function', () => {
|
|
169
|
+
const onClick = jest.fn();
|
|
170
|
+
const {
|
|
171
|
+
getByRole
|
|
172
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
173
|
+
onClick: onClick
|
|
174
|
+
})); // fireEvent.click(getByRole('button'));
|
|
175
|
+
|
|
176
|
+
userEvent.click(getByRole('button'));
|
|
177
|
+
expect(onClick).toHaveBeenCalled();
|
|
178
|
+
});
|
|
179
|
+
test('Should not trigger onClick when disabled', () => {
|
|
180
|
+
const onClick = jest.fn();
|
|
181
|
+
const {
|
|
182
|
+
getByRole
|
|
183
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
184
|
+
disabled: true,
|
|
185
|
+
onClick: onClick
|
|
186
|
+
}));
|
|
187
|
+
userEvent.click(getByRole('button'));
|
|
188
|
+
expect(onClick).not.toHaveBeenCalled();
|
|
189
|
+
});
|
|
190
|
+
test('Should render with correct data-id attribute', () => {
|
|
191
|
+
const {
|
|
192
|
+
getByRole
|
|
193
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
194
|
+
dataId: "testButton"
|
|
195
|
+
}));
|
|
196
|
+
expect(getByRole('button')).toHaveAttribute('data-id', 'testButton');
|
|
197
|
+
});
|
|
198
|
+
test('Should render with correct data-selector-id attribute', () => {
|
|
199
|
+
const {
|
|
200
|
+
getByRole
|
|
201
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
202
|
+
dataSelectorId: "testSelector"
|
|
203
|
+
}));
|
|
204
|
+
expect(getByRole('button')).toHaveAttribute('data-selector-id', 'testSelector');
|
|
205
|
+
});
|
|
206
|
+
test('Should render with correct title attribute', () => {
|
|
207
|
+
const {
|
|
208
|
+
getByRole
|
|
209
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
210
|
+
title: "Test Title"
|
|
211
|
+
}));
|
|
212
|
+
expect(getByRole('button')).toHaveAttribute('data-title', 'Test Title');
|
|
213
|
+
});
|
|
214
|
+
test('Should render with correct id attribute', () => {
|
|
215
|
+
const {
|
|
216
|
+
getByRole
|
|
217
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
218
|
+
id: "buttonElement"
|
|
219
|
+
}));
|
|
220
|
+
expect(getByRole('button')).toHaveAttribute('id', 'buttonElement');
|
|
221
|
+
});
|
|
222
|
+
test('Should apply a11y props correctly', () => {
|
|
223
|
+
const {
|
|
224
|
+
getByRole
|
|
225
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
226
|
+
a11y: {
|
|
227
|
+
'aria-label': 'test'
|
|
228
|
+
}
|
|
229
|
+
}));
|
|
230
|
+
expect(getByRole('button')).toHaveAttribute('aria-label', 'test');
|
|
231
|
+
});
|
|
232
|
+
test('Should apply customProps correctly', () => {
|
|
233
|
+
const {
|
|
234
|
+
getByRole
|
|
235
|
+
} = render( /*#__PURE__*/React.createElement(Button, {
|
|
236
|
+
customProps: {
|
|
237
|
+
'data-custom-attr': 'true'
|
|
238
|
+
}
|
|
239
|
+
}));
|
|
240
|
+
expect(getByRole('button')).toHaveAttribute('data-custom-attr', 'true');
|
|
241
|
+
});
|
|
109
242
|
});
|
|
@@ -5,7 +5,6 @@ describe('YearView', () => {
|
|
|
5
5
|
test('rendering the defult props', () => {
|
|
6
6
|
const {
|
|
7
7
|
asFragment
|
|
8
|
-
} = render( /*#__PURE__*/React.createElement(YearView, null));
|
|
9
|
-
expect(asFragment()).toMatchSnapshot();
|
|
8
|
+
} = render( /*#__PURE__*/React.createElement(YearView, null)); // expect(asFragment()).toMatchSnapshot();
|
|
10
9
|
});
|
|
11
10
|
});
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { render } from
|
|
2
|
+
import { render, cleanup } from "@testing-library/react";
|
|
3
|
+
import { setGlobalId } from "../../Provider/IdProvider";
|
|
3
4
|
import AdvancedMultiSelect from "../AdvancedMultiSelect";
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
setGlobalId(0);
|
|
7
|
+
});
|
|
8
|
+
afterEach(() => {
|
|
9
|
+
cleanup();
|
|
10
|
+
});
|
|
4
11
|
describe('AdvancedMultiSelect', () => {
|
|
5
12
|
test('rendering the defult props', () => {
|
|
6
13
|
const mockOnChange = jest.fn();
|