Skip to content

Commit

Permalink
Test without getByRole
Browse files Browse the repository at this point in the history
  • Loading branch information
dlnr committed Jan 15, 2024
1 parent 07c2412 commit 43e1fbf
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions packages/react/src/MegaMenu/MegaMenu.test.tsx
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
import { render, screen } from '@testing-library/react'
import { render } from '@testing-library/react'
import { createRef } from 'react'
import { MegaMenu } from './MegaMenu'
import '@testing-library/jest-dom'

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

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

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

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

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

expect(component).toHaveClass('amsterdam-mega-menu')
})

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

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

expect(component).toHaveClass('extra')

Expand Down

0 comments on commit 43e1fbf

Please sign in to comment.