diff --git a/cypress/component/TextArea.cy.tsx b/cypress/component/TextArea.cy.tsx
new file mode 100644
index 0000000000..dfa694524a
--- /dev/null
+++ b/cypress/component/TextArea.cy.tsx
@@ -0,0 +1,97 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 - present Instructure, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+import React from 'react'
+import '../support/component'
+import 'cypress-real-events'
+
+import { TextArea } from '../../packages/ui'
+
+it('should resize if autoGrow is true', () => {
+ cy.mount(
+
+ )
+
+ cy.get('textarea').then((input) => {
+ const initialHeight = parseInt(getComputedStyle(input[0]).height, 10)
+
+ cy.get('textarea')
+ .invoke(
+ 'val',
+ 'Chartreuse celiac thundercats, distillery snackwave glossier pork belly tacos venmo fanny pack paleo portland. Migas 3 wolf moon typewriter, meditation pitchfork meh narwhal copper mug gluten-free vegan next level. Succulents keytar cronut, fanny pack kitsch hammock sustainable skateboard gochujang poutine la croix ennui cred quinoa. Fap copper mug pitchfork small batch hell of vice. Kickstarter small batch hexagon, scenester bushwick tacos cliche. Pickled flannel PBR&B, chartreuse next level vinyl echo park chambray pitchfork selfies actually tattooed blue bottle 3 wolf moon. Raw denim enamel pin tumeric retro fam scenester.'
+ )
+ .trigger('input')
+
+ cy.get('textarea').then((input) => {
+ const resizedHeight = parseInt(getComputedStyle(input[0]).height, 10)
+ expect(resizedHeight).to.be.above(initialHeight)
+ })
+
+ cy.get('[class$="-textArea__layout"]').then((layout) => {
+ const layoutMinHeight = parseInt(
+ getComputedStyle(layout[0]).getPropertyValue('min-height'),
+ 10
+ )
+ cy.get('textarea').then((input) => {
+ const resizedHeight = parseInt(getComputedStyle(input[0]).height, 10)
+ expect(resizedHeight).to.equal(layoutMinHeight)
+ })
+ })
+ })
+})
+
+it('should set a maxHeight', () => {
+ cy.mount(
+
+ )
+ const input = cy.get('textarea')
+
+ input.should('have.css', 'max-height', '160px')
+
+ // ensure maxHeight is being applied to input container and not exceeded by minHeight style
+ cy.get('[class$=-textArea__layout]').then((layout) => {
+ const layoutMaxHeight = parseInt(layout.css('max-height'), 10)
+ const layoutMinHeight = parseInt(layout.css('min-height'), 10)
+
+ expect(layoutMaxHeight).to.equal(160)
+ expect(layoutMaxHeight).to.be.above(layoutMinHeight)
+ })
+})
diff --git a/package-lock.json b/package-lock.json
index df0ab1e456..334cc2e2bc 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -48943,16 +48943,72 @@
"prop-types": "^15.8.1"
},
"devDependencies": {
+ "@instructure/ui-axe-check": "10.0.0",
"@instructure/ui-babel-preset": "10.0.0",
"@instructure/ui-color-utils": "10.0.0",
- "@instructure/ui-test-locator": "10.0.0",
"@instructure/ui-test-utils": "10.0.0",
- "@instructure/ui-themes": "10.0.0"
+ "@instructure/ui-themes": "10.0.0",
+ "@testing-library/jest-dom": "^6.4.6",
+ "@testing-library/react": "^15.0.7",
+ "@testing-library/user-event": "^14.5.2",
+ "vitest": "^2.0.2"
},
"peerDependencies": {
"react": ">=16.8 <=18"
}
},
+ "packages/ui-text-area/node_modules/@testing-library/dom": {
+ "version": "10.4.0",
+ "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.0.tgz",
+ "integrity": "sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==",
+ "dev": true,
+ "dependencies": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/runtime": "^7.12.5",
+ "@types/aria-query": "^5.0.1",
+ "aria-query": "5.3.0",
+ "chalk": "^4.1.0",
+ "dom-accessibility-api": "^0.5.9",
+ "lz-string": "^1.5.0",
+ "pretty-format": "^27.0.2"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "packages/ui-text-area/node_modules/@testing-library/react": {
+ "version": "15.0.7",
+ "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-15.0.7.tgz",
+ "integrity": "sha512-cg0RvEdD1TIhhkm1IeYMQxrzy0MtUNfa3minv4MjbgcYzJAZ7yD0i0lwoPOTPr+INtiXFezt2o8xMSnyHhEn2Q==",
+ "dev": true,
+ "dependencies": {
+ "@babel/runtime": "^7.12.5",
+ "@testing-library/dom": "^10.0.0",
+ "@types/react-dom": "^18.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@types/react": "^18.0.0",
+ "react": "^18.0.0",
+ "react-dom": "^18.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ }
+ }
+ },
+ "packages/ui-text-area/node_modules/aria-query": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
+ "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
+ "dev": true,
+ "dependencies": {
+ "dequal": "^2.0.3"
+ }
+ },
"packages/ui-text-input": {
"name": "@instructure/ui-text-input",
"version": "10.0.0",
diff --git a/packages/ui-text-area/package.json b/packages/ui-text-area/package.json
index 3cc955b95e..ddb10cecbb 100644
--- a/packages/ui-text-area/package.json
+++ b/packages/ui-text-area/package.json
@@ -37,11 +37,15 @@
"prop-types": "^15.8.1"
},
"devDependencies": {
+ "@instructure/ui-axe-check": "10.0.0",
"@instructure/ui-babel-preset": "10.0.0",
"@instructure/ui-color-utils": "10.0.0",
- "@instructure/ui-test-locator": "10.0.0",
"@instructure/ui-test-utils": "10.0.0",
- "@instructure/ui-themes": "10.0.0"
+ "@instructure/ui-themes": "10.0.0",
+ "@testing-library/jest-dom": "^6.4.6",
+ "@testing-library/react": "^15.0.7",
+ "@testing-library/user-event": "^14.5.2",
+ "vitest": "^2.0.2"
},
"peerDependencies": {
"react": ">=16.8 <=18"
diff --git a/packages/ui-text-area/src/TextArea/TextAreaLocator.ts b/packages/ui-text-area/src/TextArea/TextAreaLocator.ts
deleted file mode 100644
index ea4229b06b..0000000000
--- a/packages/ui-text-area/src/TextArea/TextAreaLocator.ts
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 - present Instructure, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-import { locator } from '@instructure/ui-test-locator'
-
-import { TextArea } from './index'
-
-// @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
-export const TextAreaLocator = locator(TextArea.selector, {
- findInput: (...args: any[]) => locator('textarea').find(...args)
-})
diff --git a/packages/ui-text-area/src/TextArea/__new-tests__/TextArea.test.tsx b/packages/ui-text-area/src/TextArea/__new-tests__/TextArea.test.tsx
new file mode 100644
index 0000000000..88ffc92b30
--- /dev/null
+++ b/packages/ui-text-area/src/TextArea/__new-tests__/TextArea.test.tsx
@@ -0,0 +1,212 @@
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2015 - present Instructure, Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+import React from 'react'
+import { fireEvent, render, screen, waitFor } from '@testing-library/react'
+import { vi } from 'vitest'
+import userEvent from '@testing-library/user-event'
+import { runAxeCheck } from '@instructure/ui-axe-check'
+import '@testing-library/jest-dom'
+
+import { TextArea } from '../index'
+
+describe('TextArea', () => {
+ let consoleWarningMock: ReturnType
+ let consoleErrorMock: ReturnType
+
+ beforeEach(() => {
+ // Mocking console to prevent test output pollution and expect for messages
+ consoleWarningMock = vi
+ .spyOn(console, 'warn')
+ .mockImplementation(() => {}) as any
+ consoleErrorMock = vi
+ .spyOn(console, 'error')
+ .mockImplementation(() => {}) as any
+ })
+
+ afterEach(() => {
+ consoleWarningMock.mockRestore()
+ consoleErrorMock.mockRestore()
+ })
+
+ it('should accept a default value', async () => {
+ render()
+ const input = screen.getByRole('textbox')
+
+ expect(input).toHaveTextContent('Tom Servo')
+ })
+
+ it('should include a label', async () => {
+ const { container } = render()
+ const textArea = container.querySelector('span[class$="-formFieldLabel"]')
+
+ expect(textArea).toHaveTextContent('Name')
+ })
+
+ it('should set an initial height', async () => {
+ render()
+ const input = screen.getByRole('textbox')
+
+ expect(input).toHaveStyle('height: 100px')
+ })
+
+ it('should focus the textarea when focus is called', async () => {
+ let ref: TextArea
+ render(
+