-
Notifications
You must be signed in to change notification settings - Fork 123
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
Add assert.dom(...).hasStyle()
assertion
#168
Add assert.dom(...).hasStyle()
assertion
#168
Conversation
@Turbo87 this is how it renders on failure |
Just saw there is yarn docs to generate the documentation. Will use it & update the pr |
92eee21
to
e8b499b
Compare
@Turbo87 fixed the docs & updated the tests. lmk if I'd missed anything else :) |
lib/assertions.ts
Outdated
for (let property in expected) { | ||
actual[property] = cssStyleDeclaration[property]; | ||
if (!result) { | ||
result = '' + expected[property] === actual[property]; |
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.
what is this doing?
maybe something like this might be easier to read/understand:
let computedStyle = window.getComputedStyle(element);
let expectedProperties = Object.keys(expected);
let result = expectedProperties.every(property => computedStyle[property] === expected[property]);
let actual = {};
expectedProperties.forEach(property => actual[property] = computedStyle[property]);
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.
refactored as suggested 👍
@jessica-jordan please 🙏 this would be awesome to have! |
Been working on product releases for a while. Sorry for the delay |
209e35a
to
b25a111
Compare
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.
✨
nice work, thanks @selvagsz! |
Co-Authored-By: selvagsz <[email protected]>
4148c42
to
34f6329
Compare
Add assertions for styles like
Fixes #90
supersedes #106