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

Adds tab function to docs and typings #184

Merged
merged 6 commits into from Dec 20, 2019
Merged

Adds tab function to docs and typings #184

merged 6 commits into from Dec 20, 2019

Conversation

GentlemanHal
Copy link
Contributor

Just a simple patch to add the tab function to docs and typings.

@codecov
Copy link

codecov bot commented Nov 11, 2019

Codecov Report

Merging #184 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #184   +/-   ##
======================================
  Coverage    97.1%   97.1%           
======================================
  Files           1       1           
  Lines         138     138           
  Branches       35      35           
======================================
  Hits          134     134           
  Misses          4       4

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a7b5de...c1aba38. Read the comment docs.

@@ -15,6 +15,7 @@ declare const userEvent: {
text: string,
userOpts?: IUserOptions
) => Promise<void>;
tab: (userOpts?: { shift: boolean }) => void;
Copy link

Choose a reason for hiding this comment

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

This type is no longer up to date. Could you add focusTrap to it?
better yet, define an interface and add defaults to the options (edit: can't have defaults in interface, oops)

interface TabUserOptions {
  shift?: boolean;
  focusTrap?: Document;
}

declare const userEvent: {
  ...
  tab: (userOpts?: TabUserOptions) => void;
};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should the type of focusTrap be TargetElement which is defined as type TargetElement = Element | Window;?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Or maybe it needs to be Document | Element?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looking at lib.dom.d.ts querySelectorAll is defined in ParentNode which Document and Element both extend, so Document | Element seems like the correct choice.

Copy link
Member

Choose a reason for hiding this comment

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

Are you happy with the current state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am 👍

Copy link
Member

Choose a reason for hiding this comment

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

Cool, then I'm going to merge it

@Gpx Gpx merged commit b4f171d into testing-library:master Dec 20, 2019
@Gpx
Copy link
Member

Gpx commented Dec 20, 2019

🎉 This PR is included in version 8.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@Gpx Gpx added the released label Dec 20, 2019
@GentlemanHal GentlemanHal deleted the patch-1 branch December 20, 2019 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants