@instructure/ui-buttons 10.2.3-snapshot-13 → 10.2.3-snapshot-15
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/CHANGELOG.md +1 -1
- package/es/BaseButton/__new-tests__/BaseButton.test.js +16 -16
- package/es/Button/__new-tests__/Button.test.js +18 -18
- package/es/CloseButton/__new-tests__/CloseButton.test.js +1 -1
- package/es/CondensedButton/__new-tests__/CondensedButton.test.js +5 -5
- package/es/IconButton/__new-tests__/IconButton.test.js +4 -4
- package/es/ToggleButton/__new-tests__/ToggleButton.test.js +1 -1
- package/lib/BaseButton/__new-tests__/BaseButton.test.js +16 -16
- package/lib/Button/__new-tests__/Button.test.js +18 -18
- package/lib/CloseButton/__new-tests__/CloseButton.test.js +1 -1
- package/lib/CondensedButton/__new-tests__/CondensedButton.test.js +5 -5
- package/lib/IconButton/__new-tests__/IconButton.test.js +4 -4
- package/lib/ToggleButton/__new-tests__/ToggleButton.test.js +1 -1
- package/package.json +23 -23
- package/src/IconButton/README.md +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Button/index.d.ts.map +1 -1
- package/types/CloseButton/index.d.ts +4 -4
- package/types/CloseButton/index.d.ts.map +1 -1
- package/types/CondensedButton/index.d.ts.map +1 -1
- package/types/IconButton/index.d.ts.map +1 -1
- package/types/ToggleButton/index.d.ts.map +1 -1
|
@@ -60,7 +60,7 @@ describe('<Button/>', () => {
|
|
|
60
60
|
});
|
|
61
61
|
it('should render children', () => {
|
|
62
62
|
const children = 'Hello world';
|
|
63
|
-
(0, _react2.render)(
|
|
63
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, null, children));
|
|
64
64
|
const button = document.querySelector('button');
|
|
65
65
|
expect(button).toBeInTheDocument();
|
|
66
66
|
expect(button).toHaveTextContent(children);
|
|
@@ -75,7 +75,7 @@ describe('<Button/>', () => {
|
|
|
75
75
|
it('should provide a focused getter', () => {
|
|
76
76
|
var _componentRef;
|
|
77
77
|
let componentRef;
|
|
78
|
-
(0, _react2.render)(
|
|
78
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button
|
|
79
79
|
//@ts-expect-error TODO this is coming from ReactComponentWrapper
|
|
80
80
|
, {
|
|
81
81
|
ref: component => {
|
|
@@ -91,7 +91,7 @@ describe('<Button/>', () => {
|
|
|
91
91
|
it('should provide a focus function', () => {
|
|
92
92
|
var _componentRef2;
|
|
93
93
|
let componentRef;
|
|
94
|
-
(0, _react2.render)(
|
|
94
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button
|
|
95
95
|
//@ts-expect-error TODO this is coming from ReactComponentWrapper
|
|
96
96
|
, {
|
|
97
97
|
ref: component => {
|
|
@@ -116,7 +116,7 @@ describe('<Button/>', () => {
|
|
|
116
116
|
});
|
|
117
117
|
it('should pass the `elementRef` prop', () => {
|
|
118
118
|
const elementRef = _vitest.vi.fn();
|
|
119
|
-
(0, _react2.render)(
|
|
119
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
120
120
|
elementRef: elementRef
|
|
121
121
|
}, "Hello"));
|
|
122
122
|
const button = _react2.screen.getByRole('button', {
|
|
@@ -193,7 +193,7 @@ describe('<Button/>', () => {
|
|
|
193
193
|
});
|
|
194
194
|
it('should pass the `onClick` prop', async () => {
|
|
195
195
|
const onClick = _vitest.vi.fn();
|
|
196
|
-
(0, _react2.render)(
|
|
196
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
197
197
|
onClick: onClick
|
|
198
198
|
}, "Hello"));
|
|
199
199
|
const button = _react2.screen.getByRole('button', {
|
|
@@ -248,7 +248,7 @@ describe('<Button/>', () => {
|
|
|
248
248
|
});
|
|
249
249
|
it('should set role="button"', () => {
|
|
250
250
|
const onClick = _vitest.vi.fn();
|
|
251
|
-
const _render4 = (0, _react2.render)(
|
|
251
|
+
const _render4 = (0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
252
252
|
as: "span",
|
|
253
253
|
onClick: onClick
|
|
254
254
|
}, "Hello World")),
|
|
@@ -259,7 +259,7 @@ describe('<Button/>', () => {
|
|
|
259
259
|
});
|
|
260
260
|
it('should set tabIndex="0"', () => {
|
|
261
261
|
const onClick = _vitest.vi.fn();
|
|
262
|
-
(0, _react2.render)(
|
|
262
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
263
263
|
as: "span",
|
|
264
264
|
onClick: onClick
|
|
265
265
|
}, "Hello World"));
|
|
@@ -269,7 +269,7 @@ describe('<Button/>', () => {
|
|
|
269
269
|
});
|
|
270
270
|
it('should pass down the type prop to the button element', () => {
|
|
271
271
|
const onClick = _vitest.vi.fn();
|
|
272
|
-
(0, _react2.render)(
|
|
272
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
273
273
|
type: "submit",
|
|
274
274
|
onClick: onClick
|
|
275
275
|
}, "Hello World"));
|
|
@@ -279,7 +279,7 @@ describe('<Button/>', () => {
|
|
|
279
279
|
});
|
|
280
280
|
it('focuses with the focus helper', () => {
|
|
281
281
|
const onFocus = _vitest.vi.fn();
|
|
282
|
-
(0, _react2.render)(
|
|
282
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
283
283
|
onFocus: onFocus
|
|
284
284
|
}, "Hello World"));
|
|
285
285
|
const button = _react2.screen.getByRole('button');
|
|
@@ -290,7 +290,7 @@ describe('<Button/>', () => {
|
|
|
290
290
|
describe('onClick', () => {
|
|
291
291
|
it('should call onClick when clicked', async () => {
|
|
292
292
|
const onClick = _vitest.vi.fn();
|
|
293
|
-
(0, _react2.render)(
|
|
293
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
294
294
|
onClick: onClick
|
|
295
295
|
}, "Hello World"));
|
|
296
296
|
const button = _react2.screen.getByRole('button', {
|
|
@@ -303,7 +303,7 @@ describe('<Button/>', () => {
|
|
|
303
303
|
});
|
|
304
304
|
it('should not call onClick when button is disabled', async () => {
|
|
305
305
|
const onClick = _vitest.vi.fn();
|
|
306
|
-
(0, _react2.render)(
|
|
306
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
307
307
|
disabled: true,
|
|
308
308
|
onClick: onClick
|
|
309
309
|
}, "Hello World"));
|
|
@@ -317,7 +317,7 @@ describe('<Button/>', () => {
|
|
|
317
317
|
});
|
|
318
318
|
it('should not call onClick when button is readOnly', async () => {
|
|
319
319
|
const onClick = _vitest.vi.fn();
|
|
320
|
-
(0, _react2.render)(
|
|
320
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
321
321
|
readOnly: true,
|
|
322
322
|
onClick: onClick
|
|
323
323
|
}, "Hello World"));
|
|
@@ -344,7 +344,7 @@ describe('<Button/>', () => {
|
|
|
344
344
|
});
|
|
345
345
|
it('should not call onClick when button is readOnly and an href prop is provided', async () => {
|
|
346
346
|
const onClick = _vitest.vi.fn();
|
|
347
|
-
(0, _react2.render)(
|
|
347
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
348
348
|
readOnly: true,
|
|
349
349
|
onClick: onClick,
|
|
350
350
|
href: "#"
|
|
@@ -359,7 +359,7 @@ describe('<Button/>', () => {
|
|
|
359
359
|
});
|
|
360
360
|
it('should call onClick when space key is pressed if href is provided', async () => {
|
|
361
361
|
const onClick = _vitest.vi.fn();
|
|
362
|
-
(0, _react2.render)(
|
|
362
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
363
363
|
onClick: onClick,
|
|
364
364
|
href: "#"
|
|
365
365
|
}, "Hello World"));
|
|
@@ -373,7 +373,7 @@ describe('<Button/>', () => {
|
|
|
373
373
|
});
|
|
374
374
|
it('should call onClick when enter key is pressed when not a button or link', async () => {
|
|
375
375
|
const onClick = _vitest.vi.fn();
|
|
376
|
-
(0, _react2.render)(
|
|
376
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
377
377
|
as: "span",
|
|
378
378
|
onClick: onClick
|
|
379
379
|
}, "Hello World"));
|
|
@@ -387,7 +387,7 @@ describe('<Button/>', () => {
|
|
|
387
387
|
});
|
|
388
388
|
it('should not call onClick when button is disabled and space key is pressed', async () => {
|
|
389
389
|
const onClick = _vitest.vi.fn();
|
|
390
|
-
(0, _react2.render)(
|
|
390
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
391
391
|
disabled: true,
|
|
392
392
|
onClick: onClick,
|
|
393
393
|
href: "#"
|
|
@@ -402,7 +402,7 @@ describe('<Button/>', () => {
|
|
|
402
402
|
});
|
|
403
403
|
it('should not call onClick when button is readOnly and space key is pressed', async () => {
|
|
404
404
|
const onClick = _vitest.vi.fn();
|
|
405
|
-
(0, _react2.render)(
|
|
405
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
406
406
|
readOnly: true,
|
|
407
407
|
onClick: onClick,
|
|
408
408
|
href: "#"
|
|
@@ -419,7 +419,7 @@ describe('<Button/>', () => {
|
|
|
419
419
|
describe('for a11y', () => {
|
|
420
420
|
it('should meet standards when onClick is given', async () => {
|
|
421
421
|
const onClick = _vitest.vi.fn();
|
|
422
|
-
(0, _react2.render)(
|
|
422
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.Button, {
|
|
423
423
|
onClick: onClick
|
|
424
424
|
}, "Hello World"));
|
|
425
425
|
const button = _react2.screen.getByRole('button', {
|
|
@@ -53,7 +53,7 @@ describe('<CloseButton />', () => {
|
|
|
53
53
|
});
|
|
54
54
|
it('should pass the `onClick` prop', async () => {
|
|
55
55
|
const onClick = _vitest.vi.fn();
|
|
56
|
-
(0, _react2.render)(
|
|
56
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.CloseButton, {
|
|
57
57
|
onClick: onClick,
|
|
58
58
|
screenReaderLabel: "Hello"
|
|
59
59
|
}));
|
|
@@ -48,7 +48,7 @@ describe('<CondensedButton/>', () => {
|
|
|
48
48
|
const iconSelector = 'svg[data-title="myIcon"]';
|
|
49
49
|
it('should render children', () => {
|
|
50
50
|
const children = 'Hello world';
|
|
51
|
-
(0, _react2.render)(
|
|
51
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.CondensedButton, null, children));
|
|
52
52
|
const button = document.querySelector('button');
|
|
53
53
|
expect(button).toBeInTheDocument();
|
|
54
54
|
expect(button).toHaveTextContent(children);
|
|
@@ -56,7 +56,7 @@ describe('<CondensedButton/>', () => {
|
|
|
56
56
|
it('should provide a focused getter', () => {
|
|
57
57
|
var _componentRef;
|
|
58
58
|
let componentRef;
|
|
59
|
-
(0, _react2.render)(
|
|
59
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.CondensedButton, {
|
|
60
60
|
ref: component => {
|
|
61
61
|
componentRef = component;
|
|
62
62
|
}
|
|
@@ -70,7 +70,7 @@ describe('<CondensedButton/>', () => {
|
|
|
70
70
|
it('should provide a focus function', () => {
|
|
71
71
|
var _componentRef2;
|
|
72
72
|
let componentRef;
|
|
73
|
-
(0, _react2.render)(
|
|
73
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.CondensedButton, {
|
|
74
74
|
ref: component => {
|
|
75
75
|
componentRef = component;
|
|
76
76
|
}
|
|
@@ -93,7 +93,7 @@ describe('<CondensedButton/>', () => {
|
|
|
93
93
|
});
|
|
94
94
|
it('should pass the `elementRef` prop', async () => {
|
|
95
95
|
const elementRef = _vitest.vi.fn();
|
|
96
|
-
(0, _react2.render)(
|
|
96
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.CondensedButton, {
|
|
97
97
|
elementRef: elementRef
|
|
98
98
|
}, "Hello"));
|
|
99
99
|
const button = _react2.screen.getByRole('button', {
|
|
@@ -170,7 +170,7 @@ describe('<CondensedButton/>', () => {
|
|
|
170
170
|
});
|
|
171
171
|
it('should pass the `onClick` prop', async () => {
|
|
172
172
|
const onClick = _vitest.vi.fn();
|
|
173
|
-
(0, _react2.render)(
|
|
173
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.CondensedButton, {
|
|
174
174
|
onClick: onClick
|
|
175
175
|
}, "Hello"));
|
|
176
176
|
const button = _react2.screen.getByRole('button', {
|
|
@@ -69,7 +69,7 @@ describe('<IconButton/>', () => {
|
|
|
69
69
|
it('should provide a focused getter', () => {
|
|
70
70
|
var _componentRef;
|
|
71
71
|
let componentRef;
|
|
72
|
-
(0, _react2.render)(
|
|
72
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.IconButton, {
|
|
73
73
|
screenReaderLabel: "some action",
|
|
74
74
|
renderIcon: icon,
|
|
75
75
|
ref: component => {
|
|
@@ -83,7 +83,7 @@ describe('<IconButton/>', () => {
|
|
|
83
83
|
it('should provide a focus function', () => {
|
|
84
84
|
var _componentRef2;
|
|
85
85
|
let componentRef;
|
|
86
|
-
(0, _react2.render)(
|
|
86
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.IconButton, {
|
|
87
87
|
screenReaderLabel: "some action",
|
|
88
88
|
renderIcon: icon,
|
|
89
89
|
ref: component => {
|
|
@@ -116,7 +116,7 @@ describe('<IconButton/>', () => {
|
|
|
116
116
|
});
|
|
117
117
|
it('should pass the `elementRef` prop', () => {
|
|
118
118
|
const elementRef = _vitest.vi.fn();
|
|
119
|
-
(0, _react2.render)(
|
|
119
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.IconButton, {
|
|
120
120
|
screenReaderLabel: "some action",
|
|
121
121
|
renderIcon: icon,
|
|
122
122
|
elementRef: elementRef
|
|
@@ -174,7 +174,7 @@ describe('<IconButton/>', () => {
|
|
|
174
174
|
});
|
|
175
175
|
it('should pass the `onClick` prop', async () => {
|
|
176
176
|
const onClick = _vitest.vi.fn();
|
|
177
|
-
(0, _react2.render)(
|
|
177
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.IconButton, {
|
|
178
178
|
screenReaderLabel: "some action",
|
|
179
179
|
renderIcon: icon,
|
|
180
180
|
onClick: onClick
|
|
@@ -150,7 +150,7 @@ describe('<ToggleButton />', () => {
|
|
|
150
150
|
});
|
|
151
151
|
it('should pass the `onClick` prop', async () => {
|
|
152
152
|
const onClick = _vitest.vi.fn();
|
|
153
|
-
(0, _react2.render)(
|
|
153
|
+
(0, _react2.render)(/*#__PURE__*/_react.default.createElement(_index.ToggleButton, {
|
|
154
154
|
screenReaderLabel: "This is a screen reader label",
|
|
155
155
|
renderIcon: icon,
|
|
156
156
|
renderTooltipContent: "This is tooltip content",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-buttons",
|
|
3
|
-
"version": "10.2.3-snapshot-
|
|
3
|
+
"version": "10.2.3-snapshot-15",
|
|
4
4
|
"description": "Accessible button components",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -23,32 +23,32 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@instructure/ui-axe-check": "10.2.3-snapshot-
|
|
27
|
-
"@instructure/ui-babel-preset": "10.2.3-snapshot-
|
|
28
|
-
"@instructure/ui-test-utils": "10.2.3-snapshot-
|
|
29
|
-
"@instructure/ui-themes": "10.2.3-snapshot-
|
|
26
|
+
"@instructure/ui-axe-check": "10.2.3-snapshot-15",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.2.3-snapshot-15",
|
|
28
|
+
"@instructure/ui-test-utils": "10.2.3-snapshot-15",
|
|
29
|
+
"@instructure/ui-themes": "10.2.3-snapshot-15",
|
|
30
30
|
"@testing-library/jest-dom": "^6.4.6",
|
|
31
|
-
"@testing-library/react": "^
|
|
31
|
+
"@testing-library/react": "^16.0.1",
|
|
32
32
|
"@testing-library/user-event": "^14.5.2",
|
|
33
|
-
"vitest": "^2.
|
|
33
|
+
"vitest": "^2.1.1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@babel/runtime": "^7.
|
|
37
|
-
"@instructure/console": "10.2.3-snapshot-
|
|
38
|
-
"@instructure/emotion": "10.2.3-snapshot-
|
|
39
|
-
"@instructure/shared-types": "10.2.3-snapshot-
|
|
40
|
-
"@instructure/ui-a11y-content": "10.2.3-snapshot-
|
|
41
|
-
"@instructure/ui-a11y-utils": "10.2.3-snapshot-
|
|
42
|
-
"@instructure/ui-color-utils": "10.2.3-snapshot-
|
|
43
|
-
"@instructure/ui-dom-utils": "10.2.3-snapshot-
|
|
44
|
-
"@instructure/ui-icons": "10.2.3-snapshot-
|
|
45
|
-
"@instructure/ui-position": "10.2.3-snapshot-
|
|
46
|
-
"@instructure/ui-prop-types": "10.2.3-snapshot-
|
|
47
|
-
"@instructure/ui-react-utils": "10.2.3-snapshot-
|
|
48
|
-
"@instructure/ui-testable": "10.2.3-snapshot-
|
|
49
|
-
"@instructure/ui-tooltip": "10.2.3-snapshot-
|
|
50
|
-
"@instructure/ui-utils": "10.2.3-snapshot-
|
|
51
|
-
"@instructure/ui-view": "10.2.3-snapshot-
|
|
36
|
+
"@babel/runtime": "^7.25.6",
|
|
37
|
+
"@instructure/console": "10.2.3-snapshot-15",
|
|
38
|
+
"@instructure/emotion": "10.2.3-snapshot-15",
|
|
39
|
+
"@instructure/shared-types": "10.2.3-snapshot-15",
|
|
40
|
+
"@instructure/ui-a11y-content": "10.2.3-snapshot-15",
|
|
41
|
+
"@instructure/ui-a11y-utils": "10.2.3-snapshot-15",
|
|
42
|
+
"@instructure/ui-color-utils": "10.2.3-snapshot-15",
|
|
43
|
+
"@instructure/ui-dom-utils": "10.2.3-snapshot-15",
|
|
44
|
+
"@instructure/ui-icons": "10.2.3-snapshot-15",
|
|
45
|
+
"@instructure/ui-position": "10.2.3-snapshot-15",
|
|
46
|
+
"@instructure/ui-prop-types": "10.2.3-snapshot-15",
|
|
47
|
+
"@instructure/ui-react-utils": "10.2.3-snapshot-15",
|
|
48
|
+
"@instructure/ui-testable": "10.2.3-snapshot-15",
|
|
49
|
+
"@instructure/ui-tooltip": "10.2.3-snapshot-15",
|
|
50
|
+
"@instructure/ui-utils": "10.2.3-snapshot-15",
|
|
51
|
+
"@instructure/ui-view": "10.2.3-snapshot-15",
|
|
52
52
|
"keycode": "^2",
|
|
53
53
|
"prop-types": "^15.8.1"
|
|
54
54
|
},
|
package/src/IconButton/README.md
CHANGED
|
@@ -3,6 +3,7 @@ describes: IconButton
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
An IconButton can be used when the Button only renders an Icon and does not have other visual elements or text content.
|
|
6
|
+
It is not recommended to set the size of an icon inside an IconButton. Only use the `size` property of the IconButton.
|
|
6
7
|
|
|
7
8
|
```js
|
|
8
9
|
---
|