Skip to content

Refer to Ada Lovelace as a programmer #713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/dom-testing-library/example-intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ function getExampleDOM() {
}

test('examples of some things', async () => {
const famousWomanInHistory = 'Ada Lovelace'
const famousProgrammerInHistory = 'Ada Lovelace'
const container = getExampleDOM()

// Get form elements by their label text.
// An error will be thrown if one cannot be found (accessibility FTW!)
const input = getByLabelText(container, 'Username')
input.value = famousWomanInHistory
input.value = famousProgrammerInHistory

// Get elements by their text, just like a real user does.
getByText(container, 'Print Username').click()
Expand All @@ -64,7 +64,7 @@ test('examples of some things', async () => {
// getByTestId and queryByTestId are an escape hatch to get elements
// by a test id (could also attempt to get this element by its text)
expect(getByTestId(container, 'printed-username')).toHaveTextContent(
famousWomanInHistory
famousProgrammerInHistory
)
// jest snapshots work great with regular DOM nodes!
expect(container).toMatchSnapshot()
Expand Down
6 changes: 3 additions & 3 deletions docs/react-native-testing-library/example-intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ function Example() {

test('examples of some things', async () => {
const { getByTestId, getByText, queryByTestId, toJSON } = render(<Example />)
const famousWomanInHistory = 'Ada Lovelace'
const famousProgrammerInHistory = 'Ada Lovelace'

const input = getByTestId('input')
fireEvent.changeText(input, famousWomanInHistory)
fireEvent.changeText(input, famousProgrammerInHistory)

const button = getByText('Print Username')
fireEvent.press(button)

await waitFor(() => expect(queryByTestId('printed-username')).toBeTruthy())

expect(getByTestId('printed-username').props.children).toBe(
famousWomanInHistory
famousProgrammerInHistory
)
expect(toJSON()).toMatchSnapshot()
})
Expand Down