-
Notifications
You must be signed in to change notification settings - Fork 379
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
Changed toHaveStyle to use getPropertyValue instead of accessing the property directly #285
Merged
gnapse
merged 10 commits into
testing-library:master
from
luanraithz:pr/getpropertyvalue
Aug 11, 2020
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5c24818
Changed toHaveStyle to use getPropertyValue instead of accessing the …
luanraithz 3966819
Using px instead of rem
luanraithz 48ae84d
changed test description
luanraithz 1c584c1
Update src/__tests__/to-have-style.js
luanraithz f2cb1e9
Update src/__tests__/to-have-style.js
luanraithz c13abf5
Update src/__tests__/to-have-style.js
luanraithz d5afec4
Update src/__tests__/to-have-style.js
luanraithz e54eff9
Update src/__tests__/to-have-style.js
luanraithz 0d869d8
Apply suggestions from code review
gnapse e2b48ac
Merge branch 'master' into pr/getpropertyvalue
gnapse File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would this match
12rem
? If I setfont-size: 12;
then this results in12px
. This seems a bit confusing to me.Also: This test only works in JSDOM. In an actual browser the value would be resolved to (depending on the base font size) to
240px
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right! This test case doesn't make any sense as it is going to work only in JSDOM. Btw, I didn't know that, thanks! I'm going to change that.
It isn't clear to me if you are only against this test case or the idea of the api.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just want to make sure that we're not documenting a test case that wouldn't work in a correct DOM environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Follow up on this. It seems from the discussion above that there's still something to be addressed here before this is ready. Right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is JSDOM actually returning
12rem
here has the computed style? Then all we have to do is add a comment explaining that this test depends on the user agent (since it will return the computed font-size in pixel which depends on the base font size forrem
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to
px
right after your first comment, do you think that is still worth to leave a note about that behavior?