-
Notifications
You must be signed in to change notification settings - Fork 24
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
Test suite for supportedProperty #11
Conversation
We will need to do this for supportedValue as well. |
6914564
to
e335d5c
Compare
test/fixtures/property-prefix.js
Outdated
full: 2, | ||
} | ||
|
||
const cases = [ |
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.
can we somehow avoid maintaining this list, but instead generating it?
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 wouldn't know how. There is no list anywhere connecting the caniuse feature name with the actual css properties. And then there are some edge cases, where we have to specifically follow the caniuse footnotes, explaining the differences in implementation and adhere to those. I think this is the best we can get.
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 see here, I specifically target browsers with the note number 1.
https://github.com/cssinjs/css-vendor/pull/11/files/e335d5c0b13677d9b09859ff7eb4207a99597c89#diff-4bed91943a5c241cca1ff0b7ddc3fe7bR84
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 think I can try relying on https://github.com/postcss/postcss-js for this. Let me see if it works.
e335d5c
to
0feb6f4
Compare
Changed fixture to be generated from all available properties and using prefixes from autoprefixer. I think we can rely on autoprefixer to be correct, wdyt? Now the tests are all failing due to various wrong prefixes. We have to deal with the issues one by one. |
I think thats the right way to go. Are there many issues? |
I'll make a list. |
Some of the issues can be sorted out by correctly ignoring unsupported properties by the autoprefixer. |
Why does auto detection fail in those cases? |
I think we can solve some cases for Edge by prefering ms prefix over the webkit prefix to align with the autoprefixer. Some issues from Opera can probably be solved by falling back to the webkit prefix. Others I don't know yet. It could possibly be like the filter property, where there is support for the same property without a prefix which behaves different than with a prefix. |
prefix has been always used for experimental implementations, if it works without we should use without. |
Not always. I noticed that for the filter property, browser supports only the |
That makes sense, looks like prefixed version just implements more features which haven't been unprefixed yet. Bad for auto detection though. Maybe we should leave such props out for user to decide? |
Actually we need to do exactly the same like static auto prefixer does in such cases. Because in SSR a static prefixer will be used and we need a consistency. |
I was thinking to use https://github.com/rofrischmann/inline-style-prefix-all for the static version. |
All static prefixers follow the caniuse data, I will try to stick to that. For the filter property I already have a solution by checking whether the unprefixed property accepts a I'm currently using the data from autoprefixer here. It contains a list of properties and browsers that needs a prefix which I did manually before. But I cannot tell using this data whether the property is fully supported or not supported at all. I will work on a PR to expose the feature name so we can query the caniuse db by ourself. I removed the Todo list above, it was inaccurate. I'll do another one when it's ready. |
Wondering if this will also prefix the gradient… |
The PR here is a test suite for |
Yeah, wrong pr, because this is a long standing issue cssinjs/jss#90 |
Can I help with this? What needs to be done? |
I almost finished generating a better test fixture, then we can see which test cases are failing. |
Related: Fyrd/caniuse#3070 |
Pending PR: postcss/autoprefixer#758 |
@cvle how can I help here? we recently released http://cssinjs.org/ Now I can start with the next thing, I would probably start cssinjs/jss#356 if you are going to finish this. Otherwise I need to do this, because its important. |
I'm a bit occupied with some projects, but I am still determined to get this done. Now that autoprefixer merged my PR, I can update this. |
Sorry for letting this stale for so long. I scheduled some time to work on this for the coming week. I'm finishing one of my projects soon so I'll have more time. |
Looking forward to it! By the way @rofrischmann mentioned in chat that he is happy to help. He built inline-style-prefixer |
True story. I'd love to help. Also got a lot of knowledge in that field actually. |
Ok I started working on this again. This is now my main focus. I appreciate your help @rofrischmann, great! |
0feb6f4
to
f7e20bf
Compare
Please review my commit. It adds the autoprefixer test suite, but doesn't fix any of the failing tests. Let's deal with the issues one by one until we have full compliance. |
src/index.test.js
Outdated
if (failMsgs.length > 0) { | ||
failMsgs.forEach(err => { | ||
const logMsg = `${currentBrowser.id} ${currentBrowser.version} ${err}` | ||
console.log(logMsg) // eslint-disable-line no-console |
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.
in other repos we have started to use the warning
module
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 do we catch the assertions and log the messages anyways? Shouldn't we just let let them throw and fix the code to support everything correctly?
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.
If you throw immediately, you will only see the first non matching property prefix. This way we have a whole list and an overview of what needs to be done. We also can easily spot related property prefix errors.
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.
The logging is meant for the CI log, not for end users, so I think the warning
module is unnecessary.
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.
It is also needed because the karma mocha reporter screws up the summary when running with multiple browsers..
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 will add comments to clarify this
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.
do we need it just for now to see an overview? after we fix them all, we can go back to normal assertion?
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.
by the way, we could generate it()
statements witha n assertion together, this should fix the reporting, it exits basically because one it
is one test case, by design one it
shouldn't have lots of assertions actually.
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.
True lets do that. But we will still need to log to the console, because of the karma-mocha-reporter issue. The problem is that when two browsers fail the same test but outputs a different message, only the first message is reported in the summary.
f7e20bf
to
83eb9d5
Compare
Wait before review, I'm not ready. |
83eb9d5
to
f8c3c42
Compare
Ok ready. Now I give an unique string for each test for each browser so karma-mocha-reporter gives a good summary 👍 |
f8c3c42
to
ab5619d
Compare
ab5619d
to
690f7d6
Compare
nice! |
merged |
Related: postcss/autoprefixer#792 |
Related: postcss/autoprefixer#793 |
Related: Fyrd/caniuse#3189 |
Related: Fyrd/caniuse#3190 |
Test cases are taken from http://shouldiprefix.com/ marked as
use prefixes
. Additionally the transition property is tested.The following issues have been discovered and fixed: