Skip to content

Commit

Permalink
Add HeaderNarrowScreenOnlyGridCell tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alimpens committed Dec 11, 2024
1 parent aca9af8 commit 70f20f8
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions packages/react/src/Header/HeaderNarrowScreenOnlyGridCell.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { render } from '@testing-library/react'
import { createRef } from 'react'
import { HeaderNarrowScreenOnlyGridCell } from './HeaderNarrowScreenOnlyGridCell'
import '@testing-library/jest-dom'

describe('HeaderNarrowScreenOnlyGridCell', () => {
it('renders', () => {
const { container } = render(<HeaderNarrowScreenOnlyGridCell />)

const component = container.querySelector(':only-child')

expect(component).toBeInTheDocument()
expect(component).toBeVisible()
})

it('renders a Grid.Cell', () => {
const { container } = render(<HeaderNarrowScreenOnlyGridCell />)

const component = container.querySelector(':only-child')

expect(component).toHaveClass('ams-grid__cell')
})

it('renders a design system BEM class name', () => {
const { container } = render(<HeaderNarrowScreenOnlyGridCell />)

const component = container.querySelector(':only-child')

expect(component).toHaveClass('ams-header__narrow-screen-only-grid-cell')
})

it('renders an additional class name', () => {
const { container } = render(<HeaderNarrowScreenOnlyGridCell className="extra" />)

const component = container.querySelector(':only-child')

expect(component).toHaveClass('ams-header__narrow-screen-only-grid-cell extra')
})

it('supports ForwardRef in React', () => {
const ref = createRef<HTMLDivElement>()

const { container } = render(<HeaderNarrowScreenOnlyGridCell ref={ref} />)

const component = container.querySelector(':only-child')

expect(ref.current).toBe(component)
})
})

0 comments on commit 70f20f8

Please sign in to comment.