From de11cc50b4b444a010ce55df60924a4f1a10b156 Mon Sep 17 00:00:00 2001 From: Vincent Smedinga Date: Mon, 6 Nov 2023 11:25:32 +0100 Subject: [PATCH] Improve test descriptions --- packages/react/src/Accordion/Accordion.test.tsx | 2 +- .../src/Accordion/AccordionSection.test.tsx | 4 ++-- .../src/Accordion/useFocusWithArrow.test.tsx | 6 +++--- .../react/src/Accordion/useFocusWithArrows.tsx | 2 +- packages/react/src/Alert/Alert.test.tsx | 2 +- .../react/src/AspectRatio/AspectRatio.test.tsx | 2 +- .../react/src/Blockquote/Blockquote.test.tsx | 2 +- packages/react/src/Card/Card.test.tsx | 2 +- packages/react/src/Checkbox/Checkbox.test.tsx | 2 +- packages/react/src/Footer/Footer.test.tsx | 4 ++-- packages/react/src/FormLabel/FormLabel.test.tsx | 2 +- packages/react/src/Grid/Grid.test.tsx | 2 +- packages/react/src/Grid/GridCell.test.tsx | 16 ++++++++-------- packages/react/src/Heading/Heading.test.tsx | 2 +- packages/react/src/Highlight/Highlight.test.tsx | 2 +- packages/react/src/Icon/Icon.test.tsx | 2 +- packages/react/src/Link/Link.test.tsx | 2 +- .../react/src/OrderedList/OrderedList.test.tsx | 2 +- .../react/src/PageHeading/PageHeading.test.tsx | 2 +- packages/react/src/PageMenu/PageMenu.test.tsx | 2 +- packages/react/src/Paragraph/Paragraph.test.tsx | 2 +- packages/react/src/Screen/Screen.test.tsx | 2 +- .../react/src/TopTaskLink/TopTaskLink.test.tsx | 2 +- .../src/UnorderedList/UnorderedList.test.tsx | 2 +- .../src/VisuallyHidden/VisuallyHidden.test.tsx | 2 +- plop-templates/react.test.tsx.hbs | 2 +- 26 files changed, 37 insertions(+), 37 deletions(-) diff --git a/packages/react/src/Accordion/Accordion.test.tsx b/packages/react/src/Accordion/Accordion.test.tsx index 95d3d1882a..1fa08f57a8 100644 --- a/packages/react/src/Accordion/Accordion.test.tsx +++ b/packages/react/src/Accordion/Accordion.test.tsx @@ -13,7 +13,7 @@ describe('Accordion', () => { expect(accordion).toBeVisible() }) - it('can have a additional class name', () => { + it('renders an additional class name', () => { const { container } = render() const accordion = container.querySelector('.amsterdam-accordion') diff --git a/packages/react/src/Accordion/AccordionSection.test.tsx b/packages/react/src/Accordion/AccordionSection.test.tsx index e03e8d2c22..ad20012d1a 100644 --- a/packages/react/src/Accordion/AccordionSection.test.tsx +++ b/packages/react/src/Accordion/AccordionSection.test.tsx @@ -71,7 +71,7 @@ describe('Accordion', () => { expect(sectionQuery).toBeInTheDocument() }) - it('doesnt render a section HTML tag when the section prop is false', () => { + it('does not render a section HTML tag when the section prop is false', () => { render( {testContent} @@ -110,7 +110,7 @@ describe('Accordion', () => { expect(icon).toBeInTheDocument() }) - it('can have a additional class name', () => { + it('renders an additional class name', () => { const { container } = render( {testContent} diff --git a/packages/react/src/Accordion/useFocusWithArrow.test.tsx b/packages/react/src/Accordion/useFocusWithArrow.test.tsx index bcc236ce0f..4fab3b691c 100644 --- a/packages/react/src/Accordion/useFocusWithArrow.test.tsx +++ b/packages/react/src/Accordion/useFocusWithArrow.test.tsx @@ -32,13 +32,13 @@ describe('useFocusWithArrows', () => { onFocusThreeMock.mockReset() }) - it('should set the focus when using the Arrow keys', () => { + it('sets focus when using arrow keys', () => { const Component = getComponent() const { container } = render() const firstChild = container.firstChild as HTMLElement expect(onFocusOneMock).not.toHaveBeenCalled() - // 4 times, so we can check if there are no other elements focussed after reaching the last one + // 4 times, so we can check if there are no other elements focused after reaching the last one Array.from(Array(4).keys()).forEach(() => { fireEvent.keyDown(firstChild, { key: KeyboardKeys.ArrowDown, @@ -59,7 +59,7 @@ describe('useFocusWithArrows', () => { expect(onFocusOneMock).toHaveBeenCalledTimes(2) }) - it('should rotate the focussed elements', () => { + it('rotates focused elements', () => { const Component = getComponent(true) const { container } = render() const firstChild = container.firstChild as HTMLElement diff --git a/packages/react/src/Accordion/useFocusWithArrows.tsx b/packages/react/src/Accordion/useFocusWithArrows.tsx index 695199ab22..676b4263f9 100644 --- a/packages/react/src/Accordion/useFocusWithArrows.tsx +++ b/packages/react/src/Accordion/useFocusWithArrows.tsx @@ -41,7 +41,7 @@ const useFocusWithArrows = (ref: RefObject, rotating = false, ho case next: { if (getIndex(activeElement) !== focusableEls.length - 1) { el = focusableEls[getIndex(activeElement) + 1] - // If there is nothing focussed yet, set the focus on the first element + // If there is nothing focused yet, set the focus on the first element if (activeElement && !focusableEls.includes(activeElement)) { el = focusableEls[0] } diff --git a/packages/react/src/Alert/Alert.test.tsx b/packages/react/src/Alert/Alert.test.tsx index ef4434d611..83d3a6c226 100644 --- a/packages/react/src/Alert/Alert.test.tsx +++ b/packages/react/src/Alert/Alert.test.tsx @@ -21,7 +21,7 @@ describe('Alert', () => { expect(component).toHaveClass('amsterdam-alert') }) - it('can have a additional class name', () => { + it('renders an additional class name', () => { const { container } = render() const component = container.querySelector(':only-child') diff --git a/packages/react/src/AspectRatio/AspectRatio.test.tsx b/packages/react/src/AspectRatio/AspectRatio.test.tsx index ed085645cd..14a54bd765 100644 --- a/packages/react/src/AspectRatio/AspectRatio.test.tsx +++ b/packages/react/src/AspectRatio/AspectRatio.test.tsx @@ -41,7 +41,7 @@ describe('Aspect ratio', () => { expect(extraWide.firstChild).toHaveClass('amsterdam-aspect-ratio--extra-wide') }) - it('can have a additional class name', () => { + it('renders an additional class name', () => { const { container } = render() const component = container.querySelector(':only-child') diff --git a/packages/react/src/Blockquote/Blockquote.test.tsx b/packages/react/src/Blockquote/Blockquote.test.tsx index 452c8bad19..467023899c 100644 --- a/packages/react/src/Blockquote/Blockquote.test.tsx +++ b/packages/react/src/Blockquote/Blockquote.test.tsx @@ -33,7 +33,7 @@ describe('Blockquote', () => { expect(quote).toHaveClass('amsterdam-blockquote') }) - it('can have a additional class name', () => { + it('renders an additional class name', () => { const { container } = render(
) const quote = container.querySelector(':only-child') diff --git a/packages/react/src/Card/Card.test.tsx b/packages/react/src/Card/Card.test.tsx index e073fd7fda..788c3238cf 100644 --- a/packages/react/src/Card/Card.test.tsx +++ b/packages/react/src/Card/Card.test.tsx @@ -27,7 +27,7 @@ describe('Card', () => { expect(cardLink).toHaveClass('amsterdam-card__link') }) - it('can have a additional class name', () => { + it('renders an additional class name', () => { const cardRender = render() const { container: cardHeadingGroupRender } = render() const cardLinkRender = render() diff --git a/packages/react/src/Checkbox/Checkbox.test.tsx b/packages/react/src/Checkbox/Checkbox.test.tsx index 40ada60090..2d7625b227 100644 --- a/packages/react/src/Checkbox/Checkbox.test.tsx +++ b/packages/react/src/Checkbox/Checkbox.test.tsx @@ -33,7 +33,7 @@ describe('Checkbox', () => { expect(label).toHaveClass('amsterdam-checkbox__label') }) - it('can have a additional class name', () => { + it('renders an additional class name', () => { const { container } = render() const wrapper = container.querySelector(':only-child') diff --git a/packages/react/src/Footer/Footer.test.tsx b/packages/react/src/Footer/Footer.test.tsx index 2ed2256241..7997750954 100644 --- a/packages/react/src/Footer/Footer.test.tsx +++ b/packages/react/src/Footer/Footer.test.tsx @@ -4,7 +4,7 @@ import { Footer } from './Footer' import '@testing-library/jest-dom' describe('Footer', () => { - it('renders a HTML footer element', () => { + it('renders an HTML footer element', () => { render(