Skip to content

add documentation for waitforElementToBeRemoved (#103) #105

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 4 commits into from
May 6, 2019
Merged

add documentation for waitforElementToBeRemoved (#103) #105

merged 4 commits into from
May 6, 2019

Conversation

Pklong
Copy link
Contributor

@Pklong Pklong commented May 5, 2019

Addresses #103

This is my first open-source contribution in many years so please let me know if there's anything I can do to improve. Thanks for the opportunity!

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!! Thanks! I only have two suggestions.

used in Node-based tests.

The default `container` is the global `document`. Make sure the elements you
wait for will be attached to it, or set a different `container`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to reword this a bit because right now it sounds like it should be a direct child.

@@ -43,6 +43,21 @@ test('movie title goes away', async () => {
})
```

The `waitForElementToBeRemoved` [async helper][async-api] function uses a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this to be the first example in this section (before the wait example) because it's probably the better option.

* clarify that observed element must be descendent of container

* move waitForElementToBeRemoved example above wait example in guide
Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super 💯

@kentcdodds kentcdodds requested a review from alexkrolick May 5, 2019 15:28
Copy link
Collaborator

@alexkrolick alexkrolick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM except one minor clarification

// logs 'Element no longer in DOM'
```

The callback must return the pre-existing element or array of elements that are expected to be removed.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the explanation that the element(s) must be in the DOM when you call the function should be at the top

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problem, I'll make that change now!

Pklong and others added 2 commits May 5, 2019 14:46
* move that callback must return element above examples
* move error handling from first example to second
@kentcdodds kentcdodds merged commit f23d0c3 into testing-library:master May 6, 2019
@Pklong Pklong deleted the add-documentation-for-waitforelementtoberemoved branch May 6, 2019 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants