Skip to content

Commit

Permalink
docs: Fixes and improvements to the README (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
bewildergeist authored and gnapse committed Oct 31, 2018
1 parent 8714055 commit 84a68c1
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ const detachedElement = document.createElement('div')

expect(htmlElement).toBeInTheDocument()
expect(svgElement).toBeInTheDocument()
expect(detacthedElement).not.toBeInTheDocument()
expect(nonExistantElement).not.toBeInTheDocument()
expect(detachedElement).not.toBeInTheDocument()
```
##### Using dom-testing-library
Expand Down Expand Up @@ -579,16 +579,16 @@ expected properties applied, not just some of them.
##### Using document.querySelector
```javascript
const input = document.querySelector(['data-testid="delete-button"')
const button = document.querySelector(['data-testid="delete-button"')

expect(button).toHaveStyle('display: none')
expect(button).toHaveStyle(`
color: red;
display: none;
`)
expect(button).not.toHaveStyle(`
display: none;
color: blue;
display: none;
`)
```
Expand All @@ -603,8 +603,8 @@ expect(button).toHaveStyle(`
display: none;
`)
expect(button).not.toHaveStyle(`
display: none;
color: blue;
display: none;
`)
```
Expand All @@ -631,21 +631,21 @@ This API allows you to check whether the given element has a text content or not
##### Using document.querySelector
```javascript
const button = document.querySelector('[data-testid="count-value"]')
const element = document.querySelector('[data-testid="count-value"]')

expect(content).toHaveTextContent('2')
expect(content).toHaveTextContent(/^2$/)
expect(content).not.toHaveTextContent('21')
expect(element).toHaveTextContent('2')
expect(element).toHaveTextContent(/^2$/)
expect(element).not.toHaveTextContent('21')
```
##### Using dom-testing-library
```javascript
const content = getByTestId(container, 'count-value')
const element = getByTestId(container, 'count-value')

expect(content).toHaveTextContent('2')
expect(content).toHaveTextContent(/^2$/)
expect(content).not.toHaveTextContent('21')
expect(element).toHaveTextContent('2')
expect(element).toHaveTextContent(/^2$/)
expect(element).not.toHaveTextContent('21')
```
<hr />
Expand Down

0 comments on commit 84a68c1

Please sign in to comment.