@@ -491,7 +491,9 @@ unmount()
491491// your component has been unmounted and now: container.innerHTML === ''
492492` ` `
493493
494- #### ` getByLabelText (text : TextMatch , options : {selector: string = ' *' }): HTMLElement `
494+ #### ` getByLabelText (text : TextMatch , options ): HTMLElement `
495+
496+ > Options: ` {selector = ' *' , exact = true , collapseWhitespace = true , trim = true }`
495497
496498This will search for the label that matches the given [ ` TextMatch ` ](#textmatch),
497499then find the element associated with that label.
@@ -529,7 +531,9 @@ const inputNode = getByLabelText('username', {selector: 'input'})
529531> want this behavior (for example you wish to assert that it doesn't exist),
530532> then use ` queryByLabelText ` instead.
531533
532- #### ` getByPlaceholderText (text : TextMatch ): HTMLElement `
534+ #### ` getByPlaceholderText (text : TextMatch , options ): HTMLElement `
535+
536+ > Options: ` {exact = true , collapseWhitespace = true , trim = true }`
533537
534538This will search for all elements with a placeholder attribute and find one that
535539matches the given [ ` TextMatch ` ](#textmatch).
@@ -544,7 +548,9 @@ const inputNode = getByPlaceholderText('Username')
544548> NOTE: a placeholder is not a good substitute for a label so you should
545549> generally use ` getByLabelText ` instead.
546550
547- #### ` getByText (text : TextMatch ): HTMLElement `
551+ #### ` getByText (text : TextMatch , options ): HTMLElement `
552+
553+ > Options: ` {selector = ' *' , exact = true , collapseWhitespace = true , trim = true , ignore = ' script, style' }`
548554
549555This will search for all elements that have a text node with ` textContent `
550556matching the given [ ` TextMatch ` ](#textmatch).
@@ -556,7 +562,9 @@ const {getByText} = render(<a href="/about">About ℹ️</a>)
556562const aboutAnchorNode = getByText (' about' )
557563` ` `
558564
559- #### ` getByAltText (text : TextMatch ): HTMLElement `
565+ #### ` getByAltText (text : TextMatch , options ): HTMLElement `
566+
567+ > Options: ` {exact = true , collapseWhitespace = true , trim = true }`
560568
561569This will return the element (normally an ` <img >` ) that has the given ` alt `
562570text. Note that it only supports elements which accept an ` alt ` attribute:
@@ -576,7 +584,9 @@ const {getByAltText} = render(
576584const incrediblesPosterImg = getByAltText (/ incredibles. * poster$ / i )
577585` ` `
578586
579- #### ` getByTestId (text : TextMatch ): HTMLElement `
587+ #### ` getByTestId (text : TextMatch , options ): HTMLElement `
588+
589+ > Options: ` {exact = true , collapseWhitespace = true , trim = true }`
580590
581591A shortcut to ` ` container.querySelector( ` [data - testid = " ${yourId}" ]` ) ` ` (and it
582592also accepts a [ ` TextMatch ` ](#textmatch)).
0 commit comments