diff --git a/packages/ui-billboard/src/Billboard/__new-tests__/Billboard.test.tsx b/packages/ui-billboard/src/Billboard/__new-tests__/Billboard.test.tsx deleted file mode 100644 index ba64f98429..0000000000 --- a/packages/ui-billboard/src/Billboard/__new-tests__/Billboard.test.tsx +++ /dev/null @@ -1,178 +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 React from 'react' -import { fireEvent, render, screen } from '@testing-library/react' -import userEvent from '@testing-library/user-event' -import '@testing-library/jest-dom/extend-expect' - -import { Billboard } from '../index' -import BillboardExamples from '../__examples__/Billboard.examples' -import { IconUserLine } from '@instructure/ui-icons' -import { runAxeCheck } from '@instructure/ui-axe-check' -import { generateA11yTests } from '../../../../ui-scripts/lib/test/generateA11yTests' - -const TEST_HEADING = 'test-heading' -const TEST_MESSAGE = 'test-message' -const TEST_LINK = 'http://instructure-test.com' -const TEST_HERO = () => - -describe('', () => { - it('should render', () => { - const { container } = render() - - expect(container.firstChild).toBeInTheDocument() - }) - - it('should be accessible', async () => { - const { container } = render( - - ) - const axeCheck = await runAxeCheck(container) - - expect(axeCheck).toBe(true) - }) - - const generatedExamples = generateA11yTests(Billboard, BillboardExamples) - for (const example of generatedExamples) { - it(example.description, async () => { - const { container } = render(example.content) - const axeCheck = await runAxeCheck(container) - expect(axeCheck).toBe(true) - }) - } - - it('should render a heading with the correct tag', () => { - render() - const heading = screen.getByText(TEST_HEADING) - - expect(heading).toBeInTheDocument() - expect(heading.tagName).toBe('H2') - }) - - it('renders as a link if it has an href prop', () => { - render() - - const link = screen.getByRole('link') - - expect(link).toBeInTheDocument() - expect(link).toHaveAttribute('href', TEST_LINK) - }) - - it('renders as a button and responds to onClick event', () => { - const onClick = jest.fn() - - render() - const button = screen.getByRole('button') - - fireEvent.click(button) - - expect(onClick).toHaveBeenCalledTimes(1) - }) - - describe('when rendering message', () => { - it('should render message when passed a node', async () => { - const messageNode = {TEST_MESSAGE} - - render() - const messageElement = screen.getByText(TEST_MESSAGE) - - expect(messageElement).toBeInTheDocument() - expect(messageElement.tagName).toBe('SPAN') - }) - - it('should render message passed a function', () => { - const messageNode = {TEST_MESSAGE} - - render( messageNode} />) - const messageElement = screen.getByText(TEST_MESSAGE) - - expect(messageElement).toBeInTheDocument() - expect(messageElement.tagName).toBe('SPAN') - }) - }) - - describe('when disabled', () => { - it('should apply aria-disabled to link', () => { - render() - const link = screen.getByRole('link') - - expect(link).toHaveAttribute('aria-disabled', 'true') - }) - - it('should not be clickable', () => { - const onClick = jest.fn() - - render() - const button = screen.getByRole('button') - - userEvent.click(button) - - expect(onClick).not.toHaveBeenCalled() - }) - }) - - describe('when readOnly', () => { - it('should apply aria-disabled', () => { - render() - const link = screen.getByRole('link') - - expect(link).toHaveAttribute('aria-disabled', 'true') - }) - - it('should not be clickable', () => { - const onClick = jest.fn() - - render() - const button = screen.getByRole('button') - - userEvent.click(button) - - expect(onClick).not.toHaveBeenCalled() - }) - }) - - describe('when passing down props to View', () => { - it('should support an elementRef prop', () => { - const elementRef = jest.fn() - - render() - const link = screen.getByRole('link') - - expect(elementRef).toHaveBeenCalledWith(link) - }) - - it('should support an `as` prop', () => { - const { container } = render() - const billboardAsEm = container.querySelector('em') - - expect(billboardAsEm).toBeInTheDocument() - expect(billboardAsEm?.className).toMatch(/view-billboard/) - }) - }) -}) diff --git a/packages/ui-breadcrumb/package.json b/packages/ui-breadcrumb/package.json index 906470e786..d180bfa81b 100644 --- a/packages/ui-breadcrumb/package.json +++ b/packages/ui-breadcrumb/package.json @@ -23,13 +23,10 @@ }, "license": "MIT", "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", - "@testing-library/jest-dom": "^6.1.3", - "@testing-library/react": "^14.0.0" + "@instructure/ui-themes": "8.45.0" }, "dependencies": { "@babel/runtime": "^7.22.15", diff --git a/packages/ui-breadcrumb/src/Breadcrumb/__new-tests__/Breadcrumb.test.tsx b/packages/ui-breadcrumb/src/Breadcrumb/__new-tests__/Breadcrumb.test.tsx deleted file mode 100644 index 37088c5728..0000000000 --- a/packages/ui-breadcrumb/src/Breadcrumb/__new-tests__/Breadcrumb.test.tsx +++ /dev/null @@ -1,57 +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 { render } from '@testing-library/react' - -// import { runAxeCheck } from '@instructure/ui-axe-check' -import { runAxeCheck } from '@instructure/ui-axe-check' -import { Breadcrumb } from '../index' -import BreadcrumbExamples from '../__examples__/Breadcrumb.examples' -import { generateA11yTests } from '../../../../ui-scripts/lib/test/generateA11yTests' - -const originalResizeObserver = global.ResizeObserver - -describe('', () => { - beforeAll(() => { - // Mock for ResizeObserver browser API - global.ResizeObserver = jest.fn().mockImplementation(() => ({ - observe: jest.fn(), - unobserve: jest.fn(), - disconnect: jest.fn() - })) - }) - - const generatedComponents = generateA11yTests(Breadcrumb, BreadcrumbExamples) - for (const component of generatedComponents) { - it((component as any).description, async () => { - const { container } = render((component as any).content) - const axeCheck = await runAxeCheck(container) - expect(axeCheck).toBe(true) - }) - } - - afterAll(() => { - global.ResizeObserver = originalResizeObserver - }) -}) diff --git a/packages/ui-breadcrumb/tsconfig.build.json b/packages/ui-breadcrumb/tsconfig.build.json index d6053fb811..dee617ff5f 100644 --- a/packages/ui-breadcrumb/tsconfig.build.json +++ b/packages/ui-breadcrumb/tsconfig.build.json @@ -10,7 +10,6 @@ { "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" },