-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Write a cssharness.js #9113
Comments
FWIW Gecko has a https://searchfox.org/mozilla-central/source/layout/style/test/property_database.js Not perfect of course, but maybe a good starting point? |
Automatic syntax tests from Bikeshed would be awesome, btw. |
@emilio Yeah, I was looking over |
FWIW: given the number of CSS2 tests we have that essentially test property parsing, I think the MVP here is something that can replace those, and that avoids some of the complexity from more recent specs. |
I've wanted this too, if it's not too hard we should just do it. Like IDL, probably split per spec. @tabatkins, if one wants to extract all CSS syntax stuff (properties, values, pseudo-things, etc.) would one start from the Bikeshed source, or get it from shepherd? |
Interestingly just encountered a bug (unless misinterpreting the specification) for CSS
where at HTML
results in
|
The other thing that strikes me here is that a lot of what we want to test would be much easier with CSS Typed OM, but obviously we can't rely on that any time soon. :( |
+1 css-typed-om tests would benefit a lot from something like this. |
I am not convinced this is actually a good idea. Yes, it has obvious benefits, but it would also have downsides. CSS, unlike JS, is not a general purpose language, and there are not that many ways you can detect and recover from lack of support. The ones we do have (using the cascade, Adding tests (especially large amount of tests) that can pass even though the behavior is totally absent seems like something that could backfire and cause tons of problems. See #10700 (review) or #8899 (comment) |
I've been meaning to upstream the Gecko |
@dbaron, that would be great! I didn't know something like this existed already. |
I've asked in w3c/reffy#113 if this information is possible to extract from specs and put into a machine-readable form. |
In https://github.com/web-platform-tests/wpt/compare/master...foolip:cssharness?expand=1 I have an experiment I did back in August around this. It boils down to |
We still need the tests for parsing at some point, so I take it that your concern (@frivoal) was that parsing tests will get added easily and automatically, and function/rendering tests will lag far behind? I agree that this is a concern, we have far too many examples of properties that parse but are badly implemented, so that A more comprehensive WPT approach would require a way to declare dependencies between tests. But in this case, the dependency wouldn't merely be about filtering for false positives/negatives (test results that are invalid because the prerequisite test doesn't pass), but would trigger a change in expected outcome of this test depending on the results of the dependencies: A user agent should not parse a given property/value combo unless it can also pass the function/rendering tests associated with the same spec section. Essentially, this would be quantifying the CSS rule about Partial Implementations:
(with "usable level of support" implying in this context that it passes the functional/rendering tests.) But again, that's a bit of a separate issue from whether parsing tests should be automatically generated or not. Until such a test-dependency structure exists, I suppose a reasonable compromise for this issue is to say that automatic parsing tests shouldn't be added to WPT until there are also functional tests associated with the same section (cross-referenced in the bikeshed spec). That way a user agent that adds parsing without function is guaranteed to at least fail one test. |
We should have something that can take a CSS property definition (in some format, probably JSON?) and generate a lot of tests based upon it, similar to what we have with idlharness.js.
We have a lot of tests that could be auto-generated from the property definition, especially in the CSS2 testsuite (and these are mostly reftests, which probably costs us a fair bit of time when we could test behaviour through the CSSOM much more quickly en-mass).
Note the one awkward thing here is going to be computing what the computed value will be for any given specified value, but I hope we can do that with relative sanity!
The text was updated successfully, but these errors were encountered: