Skip to content

prefer-screen-queries: Don't warn if using the baseElement option #188

@kentcdodds

Description

@kentcdodds

This should be acceptable (from the React Testing Library tests):

test('baseElement isolates trees from one another', () => {
  const {getByText: getByTextInA} = render(<div>Jekyll</div>, {
    baseElement: treeA,
  })
  const {getByText: getByTextInB} = render(<div>Hyde</div>, {
    baseElement: treeB,
  })

  expect(() => getByTextInA('Jekyll')).not.toThrow(
    'Unable to find an element with the text: Jekyll.',
  )
  expect(() => getByTextInB('Jekyll')).toThrow(
    'Unable to find an element with the text: Jekyll.',
  )

  expect(() => getByTextInA('Hyde')).toThrow(
    'Unable to find an element with the text: Hyde.',
  )
  expect(() => getByTextInB('Hyde')).not.toThrow(
    'Unable to find an element with the text: Hyde.',
  )
})

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions