Skip to content

getByText() footer test actually passes :) #24

@gminova

Description

@gminova

// We can't use getByText here because... no match? Need to find why.

getByText() will search for all elements that have a text node with textContent matching the given TextMatch

getByText(
  container: HTMLElement,
  text: TextMatch,
  options?: {
    selector?: string = '*',
    exact?: boolean = true,
    ignore?: string|boolean = 'script, style',
    normalizer?: NormalizerFn,
  }): HTMLElement
<a href="/about">About ℹ️</a>
import { render } from '@testing-library/react'

const { getByText } = render(<MyComponent />)
const aboutAnchorNode = getByText(/about/i)

Here is test on my machine:
Screenshot from 2019-09-27 10-46-23

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions