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: keep track of document state in UI #747

Merged
merged 14 commits into from
Oct 19, 2021
Merged

Conversation

ph-fritsche
Copy link
Member

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

What:
Centralize workarounds for document state in UI diverging from the document state available per API.

Why:
Closes #744

How:
Combine previous workarounds in one place.
Apply workaround per focus and blur events.
Intercept programmatically set values by event handlers and keep track of own manipulations of displayed values that might not translate to an equal value property.
Intercept calls to setSelectionRange and keep track of selections in UI diverging from the selectionStart/selectionEnd properties.

Checklist:

  • [N/A] Documentation
  • Tests
  • Ready to be merged

@ph-fritsche ph-fritsche linked an issue Oct 17, 2021 that may be closed by this pull request
3 tasks
@codesandbox-ci
Copy link

codesandbox-ci bot commented Oct 17, 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 c6fa093:

Sandbox Source
userEvent-PR-template Configuration

@codecov
Copy link

codecov bot commented Oct 18, 2021

Codecov Report

Merging #747 (c6fa093) into userEvent14 (9519979) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@              Coverage Diff              @@
##           userEvent14      #747   +/-   ##
=============================================
  Coverage       100.00%   100.00%           
=============================================
  Files               50        54    +4     
  Lines              965      1048   +83     
  Branches           389       413   +24     
=============================================
+ Hits               965      1048   +83     
Impacted Files Coverage Δ
src/document/applyNative.ts 100.00% <100.00%> (ø)
src/document/index.ts 100.00% <100.00%> (ø)
src/document/interceptor.ts 100.00% <100.00%> (ø)
src/document/selection.ts 100.00% <100.00%> (ø)
src/document/value.ts 100.00% <100.00%> (ø)
src/keyboard/getNextKeyDef.ts 100.00% <100.00%> (ø)
src/keyboard/index.ts 100.00% <100.00%> (ø)
src/keyboard/keyboardImplementation.ts 100.00% <100.00%> (ø)
src/keyboard/plugins/character.ts 100.00% <100.00%> (ø)
src/keyboard/plugins/control.ts 100.00% <100.00%> (ø)
... and 17 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 a658519...c6fa093. Read the comment docs.

@ph-fritsche ph-fritsche marked this pull request as ready for review October 18, 2021 14:53
@ph-fritsche ph-fritsche added this to the userEvent v14 milestone Oct 19, 2021
@ph-fritsche ph-fritsche merged commit 8bded0e into userEvent14 Oct 19, 2021
@ph-fritsche ph-fritsche deleted the feat-docState branch October 19, 2021 18:46
ph-fritsche added a commit that referenced this pull request Oct 20, 2021
* feat: keep track of document state in UI

* programmatically changing value resets UIValue

* prevent stacking of value interceptors

* programmatically changing value resets initial value

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore uncovered `activeElement` being `null`

* intercept calls to `setSelectionRange`

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event

* remove obsolete util

* move modules

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event
ph-fritsche added a commit that referenced this pull request Oct 21, 2021
* feat: keep track of document state in UI

* programmatically changing value resets UIValue

* prevent stacking of value interceptors

* programmatically changing value resets initial value

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore uncovered `activeElement` being `null`

* intercept calls to `setSelectionRange`

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event

* remove obsolete util

* move modules

* fix istanbul ignore

see kentcdodds/kcd-scripts#218

* ignore omitting unnecessary event
@ph-fritsche ph-fritsche linked an issue Oct 29, 2021 that may be closed by this pull request
ph-fritsche added a commit that referenced this pull request Nov 28, 2021
* programmatically changing value resets UIValue

* prevent stacking of value interceptors

* programmatically changing value resets initial value

* intercept calls to `setSelectionRange`
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: document state userEvent.type not entering a space into inputs with type email
1 participant