@instructure/ui-text-area 10.2.2-snapshot-16 → 10.2.2-snapshot-17
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/TextArea/__new-tests__/TextArea.test.js +217 -0
- package/lib/TextArea/__new-tests__/TextArea.test.js +219 -0
- package/package.json +20 -16
- package/src/TextArea/__new-tests__/TextArea.test.tsx +212 -0
- package/tsconfig.build.json +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/TextArea/__new-tests__/TextArea.test.d.ts +2 -0
- package/types/TextArea/__new-tests__/TextArea.test.d.ts.map +1 -0
- package/es/TextArea/TextAreaLocator.js +0 -31
- package/es/TextArea/locator.js +0 -27
- package/lib/TextArea/TextAreaLocator.js +0 -36
- package/lib/TextArea/locator.js +0 -37
- package/src/TextArea/TextAreaLocator.ts +0 -32
- package/src/TextArea/locator.ts +0 -28
- package/types/TextArea/TextAreaLocator.d.ts +0 -1128
- package/types/TextArea/TextAreaLocator.d.ts.map +0 -1
- package/types/TextArea/locator.d.ts +0 -4
- package/types/TextArea/locator.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [10.2.2-snapshot-
|
|
6
|
+
## [10.2.2-snapshot-17](https://github.com/instructure/instructure-ui/compare/v10.2.1...v10.2.2-snapshot-17) (2024-09-13)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @instructure/ui-text-area
|
|
9
9
|
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
var _TextArea, _TextArea2, _TextArea3, _TextArea4;
|
|
2
|
+
/*
|
|
3
|
+
* The MIT License (MIT)
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
+
*
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
*
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
*
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import React from 'react';
|
|
27
|
+
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
|
28
|
+
import { vi } from 'vitest';
|
|
29
|
+
import userEvent from '@testing-library/user-event';
|
|
30
|
+
import { runAxeCheck } from '@instructure/ui-axe-check';
|
|
31
|
+
import '@testing-library/jest-dom';
|
|
32
|
+
import { TextArea } from '../index';
|
|
33
|
+
describe('TextArea', () => {
|
|
34
|
+
let consoleWarningMock;
|
|
35
|
+
let consoleErrorMock;
|
|
36
|
+
beforeEach(() => {
|
|
37
|
+
// Mocking console to prevent test output pollution and expect for messages
|
|
38
|
+
consoleWarningMock = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
39
|
+
consoleErrorMock = vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
40
|
+
});
|
|
41
|
+
afterEach(() => {
|
|
42
|
+
consoleWarningMock.mockRestore();
|
|
43
|
+
consoleErrorMock.mockRestore();
|
|
44
|
+
});
|
|
45
|
+
it('should accept a default value', async () => {
|
|
46
|
+
render(_TextArea || (_TextArea = /*#__PURE__*/React.createElement(TextArea, {
|
|
47
|
+
label: "Name",
|
|
48
|
+
autoGrow: false,
|
|
49
|
+
defaultValue: "Tom Servo"
|
|
50
|
+
})));
|
|
51
|
+
const input = screen.getByRole('textbox');
|
|
52
|
+
expect(input).toHaveTextContent('Tom Servo');
|
|
53
|
+
});
|
|
54
|
+
it('should include a label', async () => {
|
|
55
|
+
const _render = render(_TextArea2 || (_TextArea2 = /*#__PURE__*/React.createElement(TextArea, {
|
|
56
|
+
label: "Name",
|
|
57
|
+
autoGrow: false
|
|
58
|
+
}))),
|
|
59
|
+
container = _render.container;
|
|
60
|
+
const textArea = container.querySelector('span[class$="-formFieldLabel"]');
|
|
61
|
+
expect(textArea).toHaveTextContent('Name');
|
|
62
|
+
});
|
|
63
|
+
it('should set an initial height', async () => {
|
|
64
|
+
render(_TextArea3 || (_TextArea3 = /*#__PURE__*/React.createElement(TextArea, {
|
|
65
|
+
label: "Name",
|
|
66
|
+
autoGrow: false,
|
|
67
|
+
height: "100px"
|
|
68
|
+
})));
|
|
69
|
+
const input = screen.getByRole('textbox');
|
|
70
|
+
expect(input).toHaveStyle('height: 100px');
|
|
71
|
+
});
|
|
72
|
+
it('should focus the textarea when focus is called', async () => {
|
|
73
|
+
let ref;
|
|
74
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
75
|
+
label: "Name",
|
|
76
|
+
autoGrow: false
|
|
77
|
+
// @ts-expect-error this is managed by the testing framework
|
|
78
|
+
,
|
|
79
|
+
textareaRef: el => ref = el
|
|
80
|
+
}));
|
|
81
|
+
const input = screen.getByRole('textbox');
|
|
82
|
+
ref.focus();
|
|
83
|
+
expect(input).toHaveFocus();
|
|
84
|
+
});
|
|
85
|
+
it('provides a focused getter', async () => {
|
|
86
|
+
let ref;
|
|
87
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
88
|
+
label: "Name",
|
|
89
|
+
autoGrow: false,
|
|
90
|
+
ref: el => ref = el
|
|
91
|
+
}));
|
|
92
|
+
ref.focus();
|
|
93
|
+
expect(ref.focused).toBe(true);
|
|
94
|
+
});
|
|
95
|
+
it('should provide an textareaRef prop', async () => {
|
|
96
|
+
const textareaRef = vi.fn();
|
|
97
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
98
|
+
label: "Name",
|
|
99
|
+
autoGrow: false,
|
|
100
|
+
textareaRef: textareaRef
|
|
101
|
+
}));
|
|
102
|
+
const input = screen.getByRole('textbox');
|
|
103
|
+
expect(textareaRef).toHaveBeenCalledWith(input);
|
|
104
|
+
});
|
|
105
|
+
it('should provide a value getter', async () => {
|
|
106
|
+
let ref;
|
|
107
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
108
|
+
label: "Name",
|
|
109
|
+
autoGrow: false,
|
|
110
|
+
defaultValue: "bar"
|
|
111
|
+
// @ts-expect-error this is managed by the testing framework
|
|
112
|
+
,
|
|
113
|
+
textareaRef: el => ref = el
|
|
114
|
+
}));
|
|
115
|
+
expect(ref.value).toBe('bar');
|
|
116
|
+
});
|
|
117
|
+
describe('events', () => {
|
|
118
|
+
it('responds to onChange event', async () => {
|
|
119
|
+
const onChange = vi.fn();
|
|
120
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
121
|
+
label: "Name",
|
|
122
|
+
autoGrow: false,
|
|
123
|
+
onChange: onChange
|
|
124
|
+
}));
|
|
125
|
+
const input = screen.getByRole('textbox');
|
|
126
|
+
fireEvent.change(input, {
|
|
127
|
+
target: {
|
|
128
|
+
value: 'foo'
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
await waitFor(() => {
|
|
132
|
+
expect(onChange).toHaveBeenCalledTimes(1);
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
it('does not respond to onChange event when disabled', async () => {
|
|
136
|
+
const onChange = vi.fn();
|
|
137
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
138
|
+
disabled: true,
|
|
139
|
+
label: "Name",
|
|
140
|
+
autoGrow: false,
|
|
141
|
+
onChange: onChange
|
|
142
|
+
}));
|
|
143
|
+
const input = screen.getByRole('textbox');
|
|
144
|
+
fireEvent.change(input, {
|
|
145
|
+
target: {
|
|
146
|
+
value: 'foo'
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
150
|
+
});
|
|
151
|
+
it('does not respond to onChange event when readOnly', async () => {
|
|
152
|
+
const onChange = vi.fn();
|
|
153
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
154
|
+
readOnly: true,
|
|
155
|
+
label: "Name",
|
|
156
|
+
autoGrow: false,
|
|
157
|
+
onChange: onChange
|
|
158
|
+
}));
|
|
159
|
+
const input = screen.getByRole('textbox');
|
|
160
|
+
fireEvent.change(input, {
|
|
161
|
+
target: {
|
|
162
|
+
value: 'foo'
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
166
|
+
});
|
|
167
|
+
it('responds to onBlur event', async () => {
|
|
168
|
+
const onBlur = vi.fn();
|
|
169
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
170
|
+
label: "Name",
|
|
171
|
+
autoGrow: false,
|
|
172
|
+
onBlur: onBlur
|
|
173
|
+
}));
|
|
174
|
+
userEvent.tab();
|
|
175
|
+
userEvent.tab();
|
|
176
|
+
await waitFor(() => {
|
|
177
|
+
expect(onBlur).toHaveBeenCalled();
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
it('responds to onFocus event', async () => {
|
|
181
|
+
const onFocus = vi.fn();
|
|
182
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
183
|
+
label: "Name",
|
|
184
|
+
autoGrow: false,
|
|
185
|
+
onFocus: onFocus
|
|
186
|
+
}));
|
|
187
|
+
const input = screen.getByRole('textbox');
|
|
188
|
+
input.focus();
|
|
189
|
+
await waitFor(() => {
|
|
190
|
+
expect(onFocus).toHaveBeenCalled();
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
describe('for a11y', () => {
|
|
195
|
+
it('should meet standards', async () => {
|
|
196
|
+
const _render2 = render(_TextArea4 || (_TextArea4 = /*#__PURE__*/React.createElement(TextArea, {
|
|
197
|
+
label: "Name",
|
|
198
|
+
autoGrow: false
|
|
199
|
+
}))),
|
|
200
|
+
container = _render2.container;
|
|
201
|
+
const axeCheck = await runAxeCheck(container);
|
|
202
|
+
expect(axeCheck).toBe(true);
|
|
203
|
+
});
|
|
204
|
+
it('should set aria-invalid when errors prop is set', async () => {
|
|
205
|
+
render( /*#__PURE__*/React.createElement(TextArea, {
|
|
206
|
+
label: "Name",
|
|
207
|
+
autoGrow: false,
|
|
208
|
+
messages: [{
|
|
209
|
+
type: 'error',
|
|
210
|
+
text: 'some error message'
|
|
211
|
+
}]
|
|
212
|
+
}));
|
|
213
|
+
const input = screen.getByRole('textbox');
|
|
214
|
+
expect(input).toHaveAttribute('aria-invalid');
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
});
|
|
@@ -0,0 +1,219 @@
|
|
|
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 _vitest = require("vitest");
|
|
7
|
+
var _userEvent = _interopRequireDefault(require("@testing-library/user-event"));
|
|
8
|
+
var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
|
|
9
|
+
require("@testing-library/jest-dom");
|
|
10
|
+
var _index = require("../index");
|
|
11
|
+
var _TextArea, _TextArea2, _TextArea3, _TextArea4;
|
|
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
|
+
describe('TextArea', () => {
|
|
36
|
+
let consoleWarningMock;
|
|
37
|
+
let consoleErrorMock;
|
|
38
|
+
beforeEach(() => {
|
|
39
|
+
// Mocking console to prevent test output pollution and expect for messages
|
|
40
|
+
consoleWarningMock = _vitest.vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
41
|
+
consoleErrorMock = _vitest.vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
42
|
+
});
|
|
43
|
+
afterEach(() => {
|
|
44
|
+
consoleWarningMock.mockRestore();
|
|
45
|
+
consoleErrorMock.mockRestore();
|
|
46
|
+
});
|
|
47
|
+
it('should accept a default value', async () => {
|
|
48
|
+
(0, _react2.render)(_TextArea || (_TextArea = /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
49
|
+
label: "Name",
|
|
50
|
+
autoGrow: false,
|
|
51
|
+
defaultValue: "Tom Servo"
|
|
52
|
+
})));
|
|
53
|
+
const input = _react2.screen.getByRole('textbox');
|
|
54
|
+
expect(input).toHaveTextContent('Tom Servo');
|
|
55
|
+
});
|
|
56
|
+
it('should include a label', async () => {
|
|
57
|
+
const _render = (0, _react2.render)(_TextArea2 || (_TextArea2 = /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
58
|
+
label: "Name",
|
|
59
|
+
autoGrow: false
|
|
60
|
+
}))),
|
|
61
|
+
container = _render.container;
|
|
62
|
+
const textArea = container.querySelector('span[class$="-formFieldLabel"]');
|
|
63
|
+
expect(textArea).toHaveTextContent('Name');
|
|
64
|
+
});
|
|
65
|
+
it('should set an initial height', async () => {
|
|
66
|
+
(0, _react2.render)(_TextArea3 || (_TextArea3 = /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
67
|
+
label: "Name",
|
|
68
|
+
autoGrow: false,
|
|
69
|
+
height: "100px"
|
|
70
|
+
})));
|
|
71
|
+
const input = _react2.screen.getByRole('textbox');
|
|
72
|
+
expect(input).toHaveStyle('height: 100px');
|
|
73
|
+
});
|
|
74
|
+
it('should focus the textarea when focus is called', async () => {
|
|
75
|
+
let ref;
|
|
76
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
77
|
+
label: "Name",
|
|
78
|
+
autoGrow: false
|
|
79
|
+
// @ts-expect-error this is managed by the testing framework
|
|
80
|
+
,
|
|
81
|
+
textareaRef: el => ref = el
|
|
82
|
+
}));
|
|
83
|
+
const input = _react2.screen.getByRole('textbox');
|
|
84
|
+
ref.focus();
|
|
85
|
+
expect(input).toHaveFocus();
|
|
86
|
+
});
|
|
87
|
+
it('provides a focused getter', async () => {
|
|
88
|
+
let ref;
|
|
89
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
90
|
+
label: "Name",
|
|
91
|
+
autoGrow: false,
|
|
92
|
+
ref: el => ref = el
|
|
93
|
+
}));
|
|
94
|
+
ref.focus();
|
|
95
|
+
expect(ref.focused).toBe(true);
|
|
96
|
+
});
|
|
97
|
+
it('should provide an textareaRef prop', async () => {
|
|
98
|
+
const textareaRef = _vitest.vi.fn();
|
|
99
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
100
|
+
label: "Name",
|
|
101
|
+
autoGrow: false,
|
|
102
|
+
textareaRef: textareaRef
|
|
103
|
+
}));
|
|
104
|
+
const input = _react2.screen.getByRole('textbox');
|
|
105
|
+
expect(textareaRef).toHaveBeenCalledWith(input);
|
|
106
|
+
});
|
|
107
|
+
it('should provide a value getter', async () => {
|
|
108
|
+
let ref;
|
|
109
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
110
|
+
label: "Name",
|
|
111
|
+
autoGrow: false,
|
|
112
|
+
defaultValue: "bar"
|
|
113
|
+
// @ts-expect-error this is managed by the testing framework
|
|
114
|
+
,
|
|
115
|
+
textareaRef: el => ref = el
|
|
116
|
+
}));
|
|
117
|
+
expect(ref.value).toBe('bar');
|
|
118
|
+
});
|
|
119
|
+
describe('events', () => {
|
|
120
|
+
it('responds to onChange event', async () => {
|
|
121
|
+
const onChange = _vitest.vi.fn();
|
|
122
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
123
|
+
label: "Name",
|
|
124
|
+
autoGrow: false,
|
|
125
|
+
onChange: onChange
|
|
126
|
+
}));
|
|
127
|
+
const input = _react2.screen.getByRole('textbox');
|
|
128
|
+
_react2.fireEvent.change(input, {
|
|
129
|
+
target: {
|
|
130
|
+
value: 'foo'
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
await (0, _react2.waitFor)(() => {
|
|
134
|
+
expect(onChange).toHaveBeenCalledTimes(1);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
it('does not respond to onChange event when disabled', async () => {
|
|
138
|
+
const onChange = _vitest.vi.fn();
|
|
139
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
140
|
+
disabled: true,
|
|
141
|
+
label: "Name",
|
|
142
|
+
autoGrow: false,
|
|
143
|
+
onChange: onChange
|
|
144
|
+
}));
|
|
145
|
+
const input = _react2.screen.getByRole('textbox');
|
|
146
|
+
_react2.fireEvent.change(input, {
|
|
147
|
+
target: {
|
|
148
|
+
value: 'foo'
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
152
|
+
});
|
|
153
|
+
it('does not respond to onChange event when readOnly', async () => {
|
|
154
|
+
const onChange = _vitest.vi.fn();
|
|
155
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
156
|
+
readOnly: true,
|
|
157
|
+
label: "Name",
|
|
158
|
+
autoGrow: false,
|
|
159
|
+
onChange: onChange
|
|
160
|
+
}));
|
|
161
|
+
const input = _react2.screen.getByRole('textbox');
|
|
162
|
+
_react2.fireEvent.change(input, {
|
|
163
|
+
target: {
|
|
164
|
+
value: 'foo'
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
168
|
+
});
|
|
169
|
+
it('responds to onBlur event', async () => {
|
|
170
|
+
const onBlur = _vitest.vi.fn();
|
|
171
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
172
|
+
label: "Name",
|
|
173
|
+
autoGrow: false,
|
|
174
|
+
onBlur: onBlur
|
|
175
|
+
}));
|
|
176
|
+
_userEvent.default.tab();
|
|
177
|
+
_userEvent.default.tab();
|
|
178
|
+
await (0, _react2.waitFor)(() => {
|
|
179
|
+
expect(onBlur).toHaveBeenCalled();
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
it('responds to onFocus event', async () => {
|
|
183
|
+
const onFocus = _vitest.vi.fn();
|
|
184
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
185
|
+
label: "Name",
|
|
186
|
+
autoGrow: false,
|
|
187
|
+
onFocus: onFocus
|
|
188
|
+
}));
|
|
189
|
+
const input = _react2.screen.getByRole('textbox');
|
|
190
|
+
input.focus();
|
|
191
|
+
await (0, _react2.waitFor)(() => {
|
|
192
|
+
expect(onFocus).toHaveBeenCalled();
|
|
193
|
+
});
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
describe('for a11y', () => {
|
|
197
|
+
it('should meet standards', async () => {
|
|
198
|
+
const _render2 = (0, _react2.render)(_TextArea4 || (_TextArea4 = /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
199
|
+
label: "Name",
|
|
200
|
+
autoGrow: false
|
|
201
|
+
}))),
|
|
202
|
+
container = _render2.container;
|
|
203
|
+
const axeCheck = await (0, _runAxeCheck.runAxeCheck)(container);
|
|
204
|
+
expect(axeCheck).toBe(true);
|
|
205
|
+
});
|
|
206
|
+
it('should set aria-invalid when errors prop is set', async () => {
|
|
207
|
+
(0, _react2.render)( /*#__PURE__*/_react.default.createElement(_index.TextArea, {
|
|
208
|
+
label: "Name",
|
|
209
|
+
autoGrow: false,
|
|
210
|
+
messages: [{
|
|
211
|
+
type: 'error',
|
|
212
|
+
text: 'some error message'
|
|
213
|
+
}]
|
|
214
|
+
}));
|
|
215
|
+
const input = _react2.screen.getByRole('textbox');
|
|
216
|
+
expect(input).toHaveAttribute('aria-invalid');
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-text-area",
|
|
3
|
-
"version": "10.2.2-snapshot-
|
|
3
|
+
"version": "10.2.2-snapshot-17",
|
|
4
4
|
"description": "A styled HTML text area component",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"module": "./es/index.js",
|
|
@@ -24,24 +24,28 @@
|
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@babel/runtime": "^7.24.5",
|
|
27
|
-
"@instructure/debounce": "10.2.2-snapshot-
|
|
28
|
-
"@instructure/emotion": "10.2.2-snapshot-
|
|
29
|
-
"@instructure/shared-types": "10.2.2-snapshot-
|
|
30
|
-
"@instructure/ui-dom-utils": "10.2.2-snapshot-
|
|
31
|
-
"@instructure/ui-form-field": "10.2.2-snapshot-
|
|
32
|
-
"@instructure/ui-prop-types": "10.2.2-snapshot-
|
|
33
|
-
"@instructure/ui-react-utils": "10.2.2-snapshot-
|
|
34
|
-
"@instructure/ui-testable": "10.2.2-snapshot-
|
|
35
|
-
"@instructure/ui-utils": "10.2.2-snapshot-
|
|
36
|
-
"@instructure/uid": "10.2.2-snapshot-
|
|
27
|
+
"@instructure/debounce": "10.2.2-snapshot-17",
|
|
28
|
+
"@instructure/emotion": "10.2.2-snapshot-17",
|
|
29
|
+
"@instructure/shared-types": "10.2.2-snapshot-17",
|
|
30
|
+
"@instructure/ui-dom-utils": "10.2.2-snapshot-17",
|
|
31
|
+
"@instructure/ui-form-field": "10.2.2-snapshot-17",
|
|
32
|
+
"@instructure/ui-prop-types": "10.2.2-snapshot-17",
|
|
33
|
+
"@instructure/ui-react-utils": "10.2.2-snapshot-17",
|
|
34
|
+
"@instructure/ui-testable": "10.2.2-snapshot-17",
|
|
35
|
+
"@instructure/ui-utils": "10.2.2-snapshot-17",
|
|
36
|
+
"@instructure/uid": "10.2.2-snapshot-17",
|
|
37
37
|
"prop-types": "^15.8.1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
|
-
"@instructure/ui-
|
|
41
|
-
"@instructure/ui-
|
|
42
|
-
"@instructure/ui-
|
|
43
|
-
"@instructure/ui-test-utils": "10.2.2-snapshot-
|
|
44
|
-
"@instructure/ui-themes": "10.2.2-snapshot-
|
|
40
|
+
"@instructure/ui-axe-check": "10.2.2-snapshot-17",
|
|
41
|
+
"@instructure/ui-babel-preset": "10.2.2-snapshot-17",
|
|
42
|
+
"@instructure/ui-color-utils": "10.2.2-snapshot-17",
|
|
43
|
+
"@instructure/ui-test-utils": "10.2.2-snapshot-17",
|
|
44
|
+
"@instructure/ui-themes": "10.2.2-snapshot-17",
|
|
45
|
+
"@testing-library/jest-dom": "^6.4.6",
|
|
46
|
+
"@testing-library/react": "^15.0.7",
|
|
47
|
+
"@testing-library/user-event": "^14.5.2",
|
|
48
|
+
"vitest": "^2.0.2"
|
|
45
49
|
},
|
|
46
50
|
"peerDependencies": {
|
|
47
51
|
"react": ">=16.8 <=18"
|