@instructure/ui-checkbox 8.46.2-snapshot-0 → 8.46.2-snapshot-1

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/es/Checkbox/{locator.js → CheckboxFacade/__new-tests__/CheckboxFacade.test.js} +20 -3
  3. package/es/Checkbox/{CheckboxLocator.js → ToggleFacade/__new-tests__/ToggleFacade.test.js} +20 -5
  4. package/es/Checkbox/__new-tests__/Checkbox.test.js +210 -0
  5. package/es/CheckboxGroup/__new-tests__/CheckboxGroup.test.js +196 -0
  6. package/lib/Checkbox/{locator.js → CheckboxFacade/__new-tests__/CheckboxFacade.test.js} +21 -13
  7. package/lib/Checkbox/{CheckboxLocator.js → ToggleFacade/__new-tests__/ToggleFacade.test.js} +21 -10
  8. package/lib/Checkbox/__new-tests__/Checkbox.test.js +213 -0
  9. package/lib/CheckboxGroup/__new-tests__/CheckboxGroup.test.js +198 -0
  10. package/package.json +22 -19
  11. package/src/{CheckboxGroup/CheckboxGroupLocator.ts → Checkbox/CheckboxFacade/__new-tests__/CheckboxFacade.test.tsx} +22 -4
  12. package/src/Checkbox/{CheckboxLocator.ts → ToggleFacade/__new-tests__/ToggleFacade.test.tsx} +22 -4
  13. package/src/Checkbox/__new-tests__/Checkbox.test.tsx +221 -0
  14. package/src/CheckboxGroup/__new-tests__/CheckboxGroup.test.tsx +202 -0
  15. package/tsconfig.build.json +2 -2
  16. package/tsconfig.build.tsbuildinfo +1 -1
  17. package/types/Checkbox/CheckboxFacade/__new-tests__/CheckboxFacade.test.d.ts +2 -0
  18. package/types/Checkbox/CheckboxFacade/__new-tests__/CheckboxFacade.test.d.ts.map +1 -0
  19. package/types/Checkbox/ToggleFacade/__new-tests__/ToggleFacade.test.d.ts +2 -0
  20. package/types/Checkbox/ToggleFacade/__new-tests__/ToggleFacade.test.d.ts.map +1 -0
  21. package/types/Checkbox/__new-tests__/Checkbox.test.d.ts +2 -0
  22. package/types/Checkbox/__new-tests__/Checkbox.test.d.ts.map +1 -0
  23. package/types/CheckboxGroup/__new-tests__/CheckboxGroup.test.d.ts +2 -0
  24. package/types/CheckboxGroup/__new-tests__/CheckboxGroup.test.d.ts.map +1 -0
  25. package/es/CheckboxGroup/CheckboxGroupLocator.js +0 -29
  26. package/es/CheckboxGroup/locator.js +0 -27
  27. package/lib/CheckboxGroup/CheckboxGroupLocator.js +0 -35
  28. package/lib/CheckboxGroup/locator.js +0 -38
  29. package/src/Checkbox/locator.ts +0 -28
  30. package/src/CheckboxGroup/locator.ts +0 -28
  31. package/types/Checkbox/CheckboxLocator.d.ts +0 -566
  32. package/types/Checkbox/CheckboxLocator.d.ts.map +0 -1
  33. package/types/Checkbox/locator.d.ts +0 -4
  34. package/types/Checkbox/locator.d.ts.map +0 -1
  35. package/types/CheckboxGroup/CheckboxGroupLocator.d.ts +0 -566
  36. package/types/CheckboxGroup/CheckboxGroupLocator.d.ts.map +0 -1
  37. package/types/CheckboxGroup/locator.d.ts +0 -4
  38. package/types/CheckboxGroup/locator.d.ts.map +0 -1
@@ -0,0 +1,213 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _react = _interopRequireDefault(require("react"));
5
+ var _react2 = require("@testing-library/react");
6
+ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
7
+ require("@testing-library/jest-dom/extend-expect");
8
+ var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
9
+ var _index = require("../index");
10
+ /*
11
+ * The MIT License (MIT)
12
+ *
13
+ * Copyright (c) 2015 - present Instructure, Inc.
14
+ *
15
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ * of this software and associated documentation files (the "Software"), to deal
17
+ * in the Software without restriction, including without limitation the rights
18
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ * copies of the Software, and to permit persons to whom the Software is
20
+ * furnished to do so, subject to the following conditions:
21
+ *
22
+ * The above copyright notice and this permission notice shall be included in all
23
+ * copies or substantial portions of the Software.
24
+ *
25
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ * SOFTWARE.
32
+ */
33
+
34
+ const TEST_VALUE = 'test-value';
35
+ const TEST_NAME = 'test-name';
36
+ const TEST_LABEL = 'test-label';
37
+ const initProps = {
38
+ label: TEST_LABEL,
39
+ defaultChecked: true,
40
+ value: TEST_VALUE,
41
+ name: TEST_NAME
42
+ };
43
+ const renderCheckbox = props => {
44
+ const allProps = {
45
+ ...initProps,
46
+ ...props
47
+ };
48
+ return (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.Checkbox, allProps));
49
+ };
50
+ describe('<Checkbox />', () => {
51
+ it('renders an input with type "checkbox"', () => {
52
+ renderCheckbox();
53
+ const inputElem = _react2.screen.getByRole('checkbox');
54
+ expect(inputElem).toBeInTheDocument();
55
+ expect(inputElem.tagName).toBe('INPUT');
56
+ expect(inputElem).toHaveAttribute('type', 'checkbox');
57
+ });
58
+ it('`simple` variant only displays a checkmark when checked', async () => {
59
+ const _renderCheckbox = renderCheckbox({
60
+ variant: 'simple',
61
+ defaultChecked: false
62
+ }),
63
+ container = _renderCheckbox.container;
64
+ const checkboxElement = container.querySelector('input[type="checkbox"]');
65
+ const svgElement = container.querySelector('svg');
66
+ expect(svgElement).not.toBeInTheDocument();
67
+ _userEvent.default.click(checkboxElement);
68
+ await (0, _react2.waitFor)(() => {
69
+ const svgElementAfterClick = container.querySelector('svg');
70
+ expect(svgElementAfterClick).toBeInTheDocument();
71
+ });
72
+ });
73
+ it('`simple` variant supports indeterminate/mixed state', () => {
74
+ renderCheckbox({
75
+ variant: 'simple',
76
+ indeterminate: true
77
+ });
78
+ const inputElem = _react2.screen.getByRole('checkbox');
79
+ expect(inputElem).toBeInTheDocument();
80
+ expect(inputElem).toHaveAttribute('aria-checked', 'mixed');
81
+ });
82
+ describe('events', () => {
83
+ it('when clicked, fires onClick and onChange events', async () => {
84
+ const onClick = jest.fn();
85
+ const onChange = jest.fn();
86
+ renderCheckbox({
87
+ onClick,
88
+ onChange
89
+ });
90
+ const checkboxElement = _react2.screen.getByRole('checkbox');
91
+ _userEvent.default.click(checkboxElement);
92
+ await (0, _react2.waitFor)(() => {
93
+ expect(onClick).toHaveBeenCalled();
94
+ expect(onChange).toHaveBeenCalled();
95
+ });
96
+ });
97
+ it('when clicked, does not call onClick or onChange when disabled', async () => {
98
+ const onClick = jest.fn();
99
+ const onChange = jest.fn();
100
+ renderCheckbox({
101
+ onClick,
102
+ onChange,
103
+ disabled: true
104
+ });
105
+ const checkboxElement = _react2.screen.getByRole('checkbox');
106
+ _react2.fireEvent.click(checkboxElement);
107
+ await (0, _react2.waitFor)(() => {
108
+ expect(onClick).not.toHaveBeenCalled();
109
+ expect(onChange).not.toHaveBeenCalled();
110
+ expect(checkboxElement).toBeDisabled();
111
+ });
112
+ });
113
+ it('when clicked, does not call onClick or onChange when readOnly', async () => {
114
+ const onClick = jest.fn();
115
+ const onChange = jest.fn();
116
+ renderCheckbox({
117
+ onClick,
118
+ onChange,
119
+ readOnly: true
120
+ });
121
+ const checkboxElement = _react2.screen.getByRole('checkbox');
122
+ _react2.fireEvent.click(checkboxElement);
123
+ await (0, _react2.waitFor)(() => {
124
+ expect(onClick).not.toHaveBeenCalled();
125
+ expect(onChange).not.toHaveBeenCalled();
126
+ });
127
+ });
128
+ it('calls onChange when enter key is pressed', async () => {
129
+ const onChange = jest.fn();
130
+ renderCheckbox({
131
+ onChange
132
+ });
133
+ const checkboxElement = _react2.screen.getByRole('checkbox');
134
+ _userEvent.default.type(checkboxElement, '{enter}');
135
+ await (0, _react2.waitFor)(() => {
136
+ expect(onChange).toHaveBeenCalled();
137
+ });
138
+ });
139
+ it('responds to onBlur event', async () => {
140
+ const onBlur = jest.fn();
141
+ renderCheckbox({
142
+ onBlur
143
+ });
144
+ _userEvent.default.tab();
145
+ _userEvent.default.tab();
146
+ await (0, _react2.waitFor)(() => {
147
+ expect(onBlur).toHaveBeenCalled();
148
+ });
149
+ });
150
+ it('responds to onFocus event', async () => {
151
+ const onFocus = jest.fn();
152
+ renderCheckbox({
153
+ onFocus
154
+ });
155
+ _userEvent.default.tab();
156
+ await (0, _react2.waitFor)(() => {
157
+ expect(onFocus).toHaveBeenCalled();
158
+ });
159
+ });
160
+ it('focuses with the focus helper', () => {
161
+ var _checkboxRef$current;
162
+ const checkboxRef = /*#__PURE__*/_react.default.createRef();
163
+ (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.Checkbox, Object.assign({
164
+ ref: checkboxRef
165
+ }, initProps)));
166
+ const checkboxElement = _react2.screen.getByRole('checkbox');
167
+ expect(checkboxElement).not.toHaveFocus();
168
+ (_checkboxRef$current = checkboxRef.current) === null || _checkboxRef$current === void 0 ? void 0 : _checkboxRef$current.focus();
169
+ expect(checkboxElement).toHaveFocus();
170
+ });
171
+ it('calls onMouseOver', async () => {
172
+ const onMouseOver = jest.fn();
173
+ renderCheckbox({
174
+ onMouseOver
175
+ });
176
+ const checkboxElement = _react2.screen.getByRole('checkbox');
177
+ _userEvent.default.hover(checkboxElement);
178
+ await (0, _react2.waitFor)(() => {
179
+ expect(onMouseOver).toHaveBeenCalled();
180
+ });
181
+ });
182
+ it('calls onMouseOut', async () => {
183
+ const onMouseOut = jest.fn();
184
+ renderCheckbox({
185
+ onMouseOut
186
+ });
187
+ const checkboxElement = _react2.screen.getByRole('checkbox');
188
+ _userEvent.default.hover(checkboxElement);
189
+ _userEvent.default.unhover(checkboxElement);
190
+ await (0, _react2.waitFor)(() => {
191
+ expect(onMouseOut).toHaveBeenCalled();
192
+ });
193
+ });
194
+ });
195
+ describe('for a11y', () => {
196
+ it('`simple` variant should meet standards', async () => {
197
+ const _renderCheckbox2 = renderCheckbox({
198
+ variant: 'simple'
199
+ }),
200
+ container = _renderCheckbox2.container;
201
+ const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
202
+ expect(axeCheck).toBe(true);
203
+ });
204
+ it('`toggle` variant should meet standards', async () => {
205
+ const _renderCheckbox3 = renderCheckbox({
206
+ variant: 'toggle'
207
+ }),
208
+ container = _renderCheckbox3.container;
209
+ const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
210
+ expect(axeCheck).toBe(true);
211
+ });
212
+ });
213
+ });
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ var _react = _interopRequireDefault(require("react"));
5
+ var _react2 = require("@testing-library/react");
6
+ var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
7
+ require("@testing-library/jest-dom/extend-expect");
8
+ var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
9
+ var _index = require("../index");
10
+ var _Checkbox3 = require("../../Checkbox");
11
+ var _Checkbox, _Checkbox2;
12
+ /*
13
+ * The MIT License (MIT)
14
+ *
15
+ * Copyright (c) 2015 - present Instructure, Inc.
16
+ *
17
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
18
+ * of this software and associated documentation files (the "Software"), to deal
19
+ * in the Software without restriction, including without limitation the rights
20
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
21
+ * copies of the Software, and to permit persons to whom the Software is
22
+ * furnished to do so, subject to the following conditions:
23
+ *
24
+ * The above copyright notice and this permission notice shall be included in all
25
+ * copies or substantial portions of the Software.
26
+ *
27
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
28
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
29
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
30
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
31
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
32
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
+ * SOFTWARE.
34
+ */
35
+ const TEST_NAME = 'test-name';
36
+ const TEST_DESCRIPTION = 'test-description';
37
+ const TEST_ERROR_MESSAGE = 'test-error-message';
38
+ const TEST_VALUE_1 = 'test-value-1';
39
+ const TEST_VALUE_2 = 'test-value-2';
40
+ const TEST_LABEL_1 = 'test-label-1';
41
+ const TEST_LABEL_2 = 'test-label-2';
42
+ const renderCheckboxGroup = props => {
43
+ const allProps = {
44
+ name: TEST_NAME,
45
+ description: TEST_DESCRIPTION,
46
+ ...props
47
+ };
48
+ return (0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.CheckboxGroup, allProps, _Checkbox || (_Checkbox = /*#__PURE__*/_react.default.createElement(_Checkbox3.Checkbox, {
49
+ label: TEST_LABEL_1,
50
+ value: TEST_VALUE_1
51
+ })), _Checkbox2 || (_Checkbox2 = /*#__PURE__*/_react.default.createElement(_Checkbox3.Checkbox, {
52
+ label: TEST_LABEL_2,
53
+ value: TEST_VALUE_2
54
+ }))));
55
+ };
56
+ describe('<CheckboxGroup />', () => {
57
+ it('adds the name props to all Checkbox types', () => {
58
+ renderCheckboxGroup({
59
+ name: TEST_NAME
60
+ });
61
+ const checkboxes = _react2.screen.getAllByRole('checkbox');
62
+ expect(checkboxes.length).toBe(2);
63
+ expect(checkboxes[0]).toHaveAttribute('name', TEST_NAME);
64
+ expect(checkboxes[1]).toHaveAttribute('name', TEST_NAME);
65
+ });
66
+ it('links the messages to the fieldset via aria-describedby', () => {
67
+ const _renderCheckboxGroup = renderCheckboxGroup({
68
+ messages: [{
69
+ text: TEST_ERROR_MESSAGE,
70
+ type: 'error'
71
+ }]
72
+ }),
73
+ container = _renderCheckboxGroup.container;
74
+ const fieldset = _react2.screen.getByRole('group');
75
+ const ariaDesc = fieldset.getAttribute('aria-describedby');
76
+ const messageById = container.querySelector(`[id="${ariaDesc}"]`);
77
+ expect(messageById).toBeInTheDocument();
78
+ expect(messageById).toHaveTextContent(TEST_ERROR_MESSAGE);
79
+ });
80
+ it('displays description message inside the legend', () => {
81
+ const _renderCheckboxGroup2 = renderCheckboxGroup({
82
+ description: TEST_DESCRIPTION
83
+ }),
84
+ container = _renderCheckboxGroup2.container;
85
+ const legend = container.querySelector('legend');
86
+ expect(legend).toBeInTheDocument();
87
+ expect(legend).toHaveTextContent(TEST_DESCRIPTION);
88
+ });
89
+ it('does not call the onChange prop when disabled', async () => {
90
+ const onChange = jest.fn();
91
+ renderCheckboxGroup({
92
+ onChange,
93
+ disabled: true
94
+ });
95
+ const checkboxElement = _react2.screen.getAllByRole('checkbox')[0];
96
+ _react2.fireEvent.click(checkboxElement);
97
+ await (0, _react2.waitFor)(() => {
98
+ expect(onChange).not.toHaveBeenCalled();
99
+ expect(checkboxElement).toBeDisabled();
100
+ });
101
+ });
102
+ it('does not call the onChange prop when readOnly', async () => {
103
+ const onChange = jest.fn();
104
+ renderCheckboxGroup({
105
+ onChange,
106
+ readOnly: true
107
+ });
108
+ const checkboxElement = _react2.screen.getAllByRole('checkbox')[0];
109
+ _react2.fireEvent.click(checkboxElement);
110
+ await (0, _react2.waitFor)(() => {
111
+ expect(onChange).not.toHaveBeenCalled();
112
+ expect(checkboxElement).toBeDisabled();
113
+ });
114
+ });
115
+ it('should not update the value when the value prop is set', async () => {
116
+ const onChange = jest.fn();
117
+ renderCheckboxGroup({
118
+ onChange,
119
+ value: ['tester']
120
+ });
121
+ const checkboxes = _react2.screen.getAllByRole('checkbox');
122
+ expect(checkboxes[0]).not.toBeChecked();
123
+ expect(checkboxes[1]).not.toBeChecked();
124
+ _userEvent.default.click(checkboxes[0]);
125
+ await (0, _react2.waitFor)(() => {
126
+ expect(onChange).not.toHaveBeenCalled();
127
+ expect(checkboxes[0]).not.toBeChecked();
128
+ expect(checkboxes[1]).not.toBeChecked();
129
+ });
130
+ });
131
+ it('should add the checkbox value to the value list when it is checked', async () => {
132
+ const onChange = jest.fn();
133
+ renderCheckboxGroup({
134
+ onChange
135
+ });
136
+ const checkboxes = _react2.screen.getAllByRole('checkbox');
137
+ expect(checkboxes[0]).not.toBeChecked();
138
+ expect(checkboxes[1]).not.toBeChecked();
139
+ _userEvent.default.click(checkboxes[0]);
140
+ _userEvent.default.click(checkboxes[1]);
141
+ await (0, _react2.waitFor)(() => {
142
+ expect(checkboxes[0]).toBeChecked();
143
+ expect(checkboxes[1]).toBeChecked();
144
+ expect(onChange).toHaveBeenCalledWith([TEST_VALUE_1, TEST_VALUE_2]);
145
+ });
146
+ });
147
+ it('should check the checkboxes based on the defaultValue prop', () => {
148
+ const defaultValue = [TEST_VALUE_2];
149
+ renderCheckboxGroup({
150
+ defaultValue
151
+ });
152
+ const checkboxes = _react2.screen.getAllByRole('checkbox');
153
+ expect(checkboxes[0]).not.toBeChecked();
154
+ expect(checkboxes[1]).toBeChecked();
155
+ });
156
+ it('should remove the checkbox value from the value list when it is unchecked', async () => {
157
+ const onChange = jest.fn();
158
+ const defaultValue = [TEST_VALUE_1, TEST_VALUE_2];
159
+ renderCheckboxGroup({
160
+ onChange,
161
+ defaultValue
162
+ });
163
+ const checkboxes = _react2.screen.getAllByRole('checkbox');
164
+ expect(checkboxes[0]).toBeChecked();
165
+ expect(checkboxes[1]).toBeChecked();
166
+ _userEvent.default.click(checkboxes[0]);
167
+ await (0, _react2.waitFor)(() => {
168
+ expect(checkboxes[0]).not.toBeChecked();
169
+ expect(checkboxes[1]).toBeChecked();
170
+ expect(onChange).toHaveBeenCalledWith([TEST_VALUE_2]);
171
+ });
172
+ });
173
+ it('passes the array of selected values to onChange handler', async () => {
174
+ const onChange = jest.fn();
175
+ const defaultValue = [TEST_VALUE_2];
176
+ renderCheckboxGroup({
177
+ onChange,
178
+ defaultValue
179
+ });
180
+ const checkboxes = _react2.screen.getAllByRole('checkbox');
181
+ expect(checkboxes[0]).not.toBeChecked();
182
+ expect(checkboxes[1]).toBeChecked();
183
+ _userEvent.default.click(checkboxes[0]);
184
+ await (0, _react2.waitFor)(() => {
185
+ expect(checkboxes[0]).toBeChecked();
186
+ expect(checkboxes[1]).toBeChecked();
187
+ expect(onChange).toHaveBeenCalledWith([TEST_VALUE_2, TEST_VALUE_1]);
188
+ });
189
+ });
190
+ describe('for a11y', () => {
191
+ it('should meet standards', async () => {
192
+ const _renderCheckboxGroup3 = renderCheckboxGroup(),
193
+ container = _renderCheckboxGroup3.container;
194
+ const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
195
+ expect(axeCheck).toBe(true);
196
+ });
197
+ });
198
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-checkbox",
3
- "version": "8.46.2-snapshot-0",
3
+ "version": "8.46.2-snapshot-1",
4
4
  "description": " styled HTML input type='checkbox' component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,28 +24,31 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.22.15",
27
- "@instructure/console": "8.46.2-snapshot-0",
28
- "@instructure/emotion": "8.46.2-snapshot-0",
29
- "@instructure/shared-types": "8.46.2-snapshot-0",
30
- "@instructure/ui-dom-utils": "8.46.2-snapshot-0",
31
- "@instructure/ui-form-field": "8.46.2-snapshot-0",
32
- "@instructure/ui-icons": "8.46.2-snapshot-0",
33
- "@instructure/ui-prop-types": "8.46.2-snapshot-0",
34
- "@instructure/ui-react-utils": "8.46.2-snapshot-0",
35
- "@instructure/ui-svg-images": "8.46.2-snapshot-0",
36
- "@instructure/ui-testable": "8.46.2-snapshot-0",
37
- "@instructure/ui-utils": "8.46.2-snapshot-0",
38
- "@instructure/ui-view": "8.46.2-snapshot-0",
39
- "@instructure/uid": "8.46.2-snapshot-0",
27
+ "@instructure/console": "8.46.2-snapshot-1",
28
+ "@instructure/emotion": "8.46.2-snapshot-1",
29
+ "@instructure/shared-types": "8.46.2-snapshot-1",
30
+ "@instructure/ui-dom-utils": "8.46.2-snapshot-1",
31
+ "@instructure/ui-form-field": "8.46.2-snapshot-1",
32
+ "@instructure/ui-icons": "8.46.2-snapshot-1",
33
+ "@instructure/ui-prop-types": "8.46.2-snapshot-1",
34
+ "@instructure/ui-react-utils": "8.46.2-snapshot-1",
35
+ "@instructure/ui-svg-images": "8.46.2-snapshot-1",
36
+ "@instructure/ui-testable": "8.46.2-snapshot-1",
37
+ "@instructure/ui-utils": "8.46.2-snapshot-1",
38
+ "@instructure/ui-view": "8.46.2-snapshot-1",
39
+ "@instructure/uid": "8.46.2-snapshot-1",
40
40
  "keycode": "^2.2.1",
41
41
  "prop-types": "^15.8.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@instructure/ui-babel-preset": "8.46.2-snapshot-0",
45
- "@instructure/ui-color-utils": "8.46.2-snapshot-0",
46
- "@instructure/ui-test-locator": "8.46.2-snapshot-0",
47
- "@instructure/ui-test-utils": "8.46.2-snapshot-0",
48
- "@instructure/ui-themes": "8.46.2-snapshot-0"
44
+ "@instructure/ui-axe-check": "8.46.2-snapshot-1",
45
+ "@instructure/ui-babel-preset": "8.46.2-snapshot-1",
46
+ "@instructure/ui-color-utils": "8.46.2-snapshot-1",
47
+ "@instructure/ui-test-utils": "8.46.2-snapshot-1",
48
+ "@instructure/ui-themes": "8.46.2-snapshot-1",
49
+ "@testing-library/jest-dom": "^5.17.0",
50
+ "@testing-library/react": "^14.0.0",
51
+ "@testing-library/user-event": "^14.4.3"
49
52
  },
50
53
  "peerDependencies": {
51
54
  "react": ">=16.8 <=18"
@@ -22,9 +22,27 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { locator } from '@instructure/ui-test-locator'
25
+ import React from 'react'
26
+ import { render, screen } from '@testing-library/react'
27
+ import '@testing-library/jest-dom/extend-expect'
26
28
 
27
- import { CheckboxGroup } from './index'
29
+ import { runAxeCheck } from '@instructure/ui-axe-check'
30
+ import { CheckboxFacade } from '../index'
28
31
 
29
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
30
- export const CheckboxGroupLocator = locator(CheckboxGroup.selector)
32
+ const TEST_TEXT = 'test-text'
33
+
34
+ describe('<CheckboxFacade />', () => {
35
+ it('should render', () => {
36
+ render(<CheckboxFacade>{TEST_TEXT}</CheckboxFacade>)
37
+ const facade = screen.getByText(TEST_TEXT)
38
+
39
+ expect(facade).toBeInTheDocument()
40
+ })
41
+
42
+ it('should meet a11y standards', async () => {
43
+ const { container } = render(<CheckboxFacade>{TEST_TEXT}</CheckboxFacade>)
44
+ const axeCheck = await runAxeCheck(container)
45
+
46
+ expect(axeCheck).toBe(true)
47
+ })
48
+ })
@@ -22,9 +22,27 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { locator } from '@instructure/ui-test-locator'
25
+ import React from 'react'
26
+ import { render, screen } from '@testing-library/react'
27
+ import '@testing-library/jest-dom/extend-expect'
26
28
 
27
- import { Checkbox } from './index'
29
+ import { runAxeCheck } from '@instructure/ui-axe-check'
30
+ import { ToggleFacade } from '../index'
28
31
 
29
- // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
30
- export const CheckboxLocator = locator(Checkbox.selector)
32
+ const TEST_TEXT = 'test-text'
33
+
34
+ describe('<ToggleFacade />', () => {
35
+ it('should render', () => {
36
+ render(<ToggleFacade>{TEST_TEXT}</ToggleFacade>)
37
+ const facade = screen.getByText(TEST_TEXT)
38
+
39
+ expect(facade).toBeInTheDocument()
40
+ })
41
+
42
+ it('should meet a11y standards', async () => {
43
+ const { container } = render(<ToggleFacade>{TEST_TEXT}</ToggleFacade>)
44
+ const axeCheck = await runAxeCheck(container)
45
+
46
+ expect(axeCheck).toBe(true)
47
+ })
48
+ })