-
Notifications
You must be signed in to change notification settings - Fork 470
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(fireEvent): make read-only event target properties definable #1020
base: main
Are you sure you want to change the base?
feat(fireEvent): make read-only event target properties definable #1020
Conversation
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 b901f7f:
|
I will add tests and other items on the checklist once I can get some sort of confirmation if this is all right. There may be a reason to keep the read-only target properties as is that I don't know of. So please let me know if this is fine so I can move forward. Peace. :) |
Codecov Report
@@ Coverage Diff @@
## main #1020 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 24 24
Lines 998 999 +1
Branches 326 326
=========================================
+ Hits 998 999 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
df76448
to
b55ffc1
Compare
As far as I can tell, the an Element's What does the rest of your code do to the |
The code just reads and uses the
It doesn't. But I think the emitted event from the test (as shown in the example) should be able to specify it as part of the event itself. So the read-only usage of |
What I am trying to test is this scroll behavior. Before horizontal scroll, the left arrow is invisible: After horizontal scroll, the component uses For firing the event with this horizontal scroll, I need to specify |
e3b2c99
to
b901f7f
Compare
What:
This makes read-only properties of the target element like
scrollWidth
definable throughfireEvent
orcreateEvent
.Why:
Because as of now it's not possible to test events with read-only target properties. If a component for example makes use of
scrollWidth
to calculate the scroll width inside ascroll
event and thus applied some sort of limit to the scroll, it can't be tested for that event.For example, this test throws an error but passes after the changes in this PR.
How:
By using
Object.defineProperties
and modifying the read-only target properties. The solution is the same as or similar to handlingfiles
but it's generic for all other properties as well.Checklist:
docs site