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

feat: add setup API #746

Merged
merged 4 commits into from
Oct 19, 2021
Merged

feat: add setup API #746

merged 4 commits into from
Oct 19, 2021

Conversation

ph-fritsche
Copy link
Member

@ph-fritsche ph-fritsche commented Oct 15, 2021

What:

Add a setup API

Why:
Closes #743

How:

userEvent.setup(defaultOptions) returns the APIs of userEvent bound to default options.
It also reapplies keyboardState to subsequent calls of keyboard().

The returned object also includes a setup() function that returns a set of APIs with other overwritten defaults but the same keyboardState.

Checklist:

  • Documentation
  • Tests
  • Ready to be merged

@ph-fritsche ph-fritsche changed the base branch from main to userEvent14 October 15, 2021 17:52
@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 15, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 13bab99:

Sandbox Source
userEvent-PR-template Configuration

@codecov
Copy link

codecov bot commented Oct 17, 2021

Codecov Report

Merging #746 (13bab99) into userEvent14 (9519979) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##           userEvent14      #746   +/-   ##
=============================================
  Coverage       100.00%   100.00%           
=============================================
  Files               50        51    +1     
  Lines              965      1032   +67     
  Branches           389       411   +22     
=============================================
+ Hits               965      1032   +67     
Impacted Files Coverage Δ
src/tab.ts 100.00% <ø> (ø)
src/upload.ts 100.00% <ø> (ø)
src/index.ts 100.00% <100.00%> (ø)
src/keyboard/index.ts 100.00% <100.00%> (ø)
src/setup.ts 100.00% <100.00%> (ø)
src/click.ts 100.00% <0.00%> (ø)
src/type/index.ts 100.00% <0.00%> (ø)
src/select-options.ts 100.00% <0.00%> (ø)
... and 7 more

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 f221143...13bab99. Read the comment docs.

@ph-fritsche ph-fritsche marked this pull request as ready for review October 17, 2021 12:24
@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Oct 19, 2021
@ph-fritsche ph-fritsche merged commit 398c332 into userEvent14 Oct 19, 2021
@ph-fritsche ph-fritsche deleted the feat-setup branch October 19, 2021 18:45
ph-fritsche added a commit that referenced this pull request Oct 20, 2021
* feat: add `setup` API

* test: use mocking to test wiring of setup

* test: prevent unhandled rejection for invalid arg type

* refactor: define exported apis in setup
ph-fritsche added a commit that referenced this pull request Oct 21, 2021
* feat: add `setup` API

* test: use mocking to test wiring of setup

* test: prevent unhandled rejection for invalid arg type

* refactor: define exported apis in setup
ph-fritsche added a commit that referenced this pull request Nov 28, 2021
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.

feat: setup
1 participant