diff --git a/package-lock.json b/package-lock.json
index f71d025d8d..f79cde2d1b 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -54910,10 +54910,12 @@
"prop-types": "^15.8.1"
},
"devDependencies": {
+ "@instructure/ui-axe-check": "^8.45.0",
"@instructure/ui-babel-preset": "8.45.0",
"@instructure/ui-test-locator": "8.45.0",
"@instructure/ui-test-utils": "8.45.0",
- "@instructure/ui-themes": "8.45.0"
+ "@instructure/ui-themes": "8.45.0",
+ "@testing-library/react": "^14.0.0"
},
"peerDependencies": {
"react": ">=16.8 <=18"
@@ -60411,6 +60413,7 @@
"@babel/runtime": "^7.22.15",
"@instructure/emotion": "8.45.0",
"@instructure/shared-types": "8.45.0",
+ "@instructure/ui-axe-check": "^8.45.0",
"@instructure/ui-babel-preset": "8.45.0",
"@instructure/ui-form-field": "8.45.0",
"@instructure/ui-icons": "8.45.0",
@@ -60421,6 +60424,7 @@
"@instructure/ui-themes": "8.45.0",
"@instructure/ui-utils": "8.45.0",
"@instructure/uid": "8.45.0",
+ "@testing-library/react": "^14.0.0",
"keycode": "^2.2.1",
"prop-types": "^15.8.1"
}
diff --git a/packages/ui-number-input/package.json b/packages/ui-number-input/package.json
index 538d19bed1..f78c14152d 100644
--- a/packages/ui-number-input/package.json
+++ b/packages/ui-number-input/package.json
@@ -23,10 +23,12 @@
"ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
},
"devDependencies": {
+ "@instructure/ui-axe-check": "^8.45.0",
"@instructure/ui-babel-preset": "8.45.0",
"@instructure/ui-test-locator": "8.45.0",
"@instructure/ui-test-utils": "8.45.0",
- "@instructure/ui-themes": "8.45.0"
+ "@instructure/ui-themes": "8.45.0",
+ "@testing-library/react": "^14.0.0"
},
"dependencies": {
"@babel/runtime": "^7.22.15",
diff --git a/packages/ui-number-input/src/NumberInput/__new-tests__/NumberInput.test.tsx b/packages/ui-number-input/src/NumberInput/__new-tests__/NumberInput.test.tsx
new file mode 100644
index 0000000000..7a84544714
--- /dev/null
+++ b/packages/ui-number-input/src/NumberInput/__new-tests__/NumberInput.test.tsx
@@ -0,0 +1,45 @@
+/*
+ * 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 { render } from '@testing-library/react'
+
+// import { runAxeCheck } from '@instructure/ui-axe-check'
+import { runAxeCheck } from '@instructure/ui-axe-check'
+import { NumberInput } from '../index'
+import NumberInputExamples from '../__examples__/NumberInput.examples'
+import { generateA11yTests } from '../../../../ui-scripts/lib/test/generateA11yTests'
+
+describe('', () => {
+ const generatedComponents = generateA11yTests(
+ NumberInput,
+ NumberInputExamples
+ )
+ for (const component of generatedComponents) {
+ it(component.description, async () => {
+ const { container } = render(component.content)
+ const axeCheck = await runAxeCheck(container)
+ expect(axeCheck).toBe(true)
+ })
+ }
+})
diff --git a/packages/ui-number-input/tsconfig.build.json b/packages/ui-number-input/tsconfig.build.json
index b2806f107e..fd9291365d 100644
--- a/packages/ui-number-input/tsconfig.build.json
+++ b/packages/ui-number-input/tsconfig.build.json
@@ -10,6 +10,7 @@
{ "path": "../ui-babel-preset/tsconfig.build.json" },
{ "path": "../ui-test-locator/tsconfig.build.json" },
{ "path": "../ui-test-utils/tsconfig.build.json" },
+ { "path": "../ui-axe-check/tsconfig.build.json" },
{ "path": "../ui-themes/tsconfig.build.json" },
{ "path": "../emotion/tsconfig.build.json" },
{ "path": "../shared-types/tsconfig.build.json" },
diff --git a/packages/ui-scripts/lib/test/generateA11yTests.tsx b/packages/ui-scripts/lib/test/generateA11yTests.tsx
index e8c526f92e..966a9094ed 100644
--- a/packages/ui-scripts/lib/test/generateA11yTests.tsx
+++ b/packages/ui-scripts/lib/test/generateA11yTests.tsx
@@ -38,7 +38,7 @@ const renderExample = ({ Component, componentProps, key }: Example) => (
)
export function generateA11yTests>(
- Component: React.ComponentType,
+ Component: React.ComponentType,
componentExample: StoryConfig
): ReturnComponentType[] {
const sections = generateComponentExamples(Component, componentExample)
diff --git a/packages/ui-scripts/lib/test/generateComponentExamples.tsx b/packages/ui-scripts/lib/test/generateComponentExamples.tsx
index d274999472..35f0b5ef9e 100644
--- a/packages/ui-scripts/lib/test/generateComponentExamples.tsx
+++ b/packages/ui-scripts/lib/test/generateComponentExamples.tsx
@@ -23,7 +23,7 @@
*/
import { generatePropCombinations } from './generatePropCombinations'
-import React, { ComponentType, ReactNode, useId } from 'react'
+import React, { ComponentType, ReactNode } from 'react'
export type StoryConfig = {
/**
@@ -239,7 +239,7 @@ export function generateComponentExamples>(
}
const propsString = fastSerialize(componentProps)
if (!PROPS_CACHE.includes(propsString)) {
- const key = useId()
+ const key = `${Date.now()}${Math.round(Math.random() * 10000)}`
const exampleProps = getExampleProps(props)
exampleCount++
if (exampleCount < maxExamples) {