Skip to content
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

Fix waitFor return value documentation #386

Merged
merged 2 commits into from
Jun 20, 2018
Merged

Conversation

pcambra
Copy link
Contributor

@pcambra pcambra commented Jun 15, 2018

No description provided.

@Turbo87
Copy link
Member

Turbo87 commented Jun 15, 2018

@pcambra you're right that it returns a Promise, but that Promise does not resolve "when settled". It resolves when the element(s) appear on the page and it resolves with those elements. I think the correct return type would be Promise<Element|Element[]> in TypeScript, but no idea if JSDoc can handle that.

You will also need to adjust the documentation in the code itself:

/**
Used to wait for a particular selector to appear in the DOM. Due to the fact
that it does not wait for general settledness, this is quite useful for testing
interim DOM states (e.g. loading states, pending promises, etc).
@param {string} selector the selector to wait for
@param {Object} [options] the options to be used
@param {number} [options.timeout=1000] the time to wait (in ms) for a match
@param {number} [options.count=null] the number of elements that should match the provided selector (null means one or more)
@returns {Element|Array<Element>} the element (or array of elements) that were being waited upon
*/

... and then you can regenerate the documentation using yarn docs

@pcambra
Copy link
Contributor Author

pcambra commented Jun 20, 2018

Thanks for the pointers @Turbo87!
Makes sense, but this is all very new to me, {Promise<Element|Element[]>} has generated some weird stuff :)

@Turbo87 Turbo87 changed the title I think waitFor returns a Promise now Fix waitFor return value documentation Jun 20, 2018
Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

looks great now, thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants