-
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
[anchor-position] Support testing of polyfill #47156
base: master
Are you sure you want to change the base?
[anchor-position] Support testing of polyfill #47156
Conversation
There are no reviewers for this pull request. Please reach out on the chat room to get help with this. Thank you! |
Seems odd to do any kind of WPT change for this. This should probably done at the level of your test runner (perhaps finding a way to run the polyfill really early (WebKit has bootstrap scripts that run before everything else in the Web Inspector for instance). |
Adding this ( |
Yeah, I agree that changing the tests for the nuances of a single implementation is not ideal. The key complication is that currently the polyfill only affects elements in the DOM when the polyfill is loaded, which we are tracking here- oddbird/css-anchor-positioning#91. The WPT scripts mix the arrange and assertion steps, so there isn't a way to cleanly insert the polyfill between those steps, and running earlier before all WPT scripts wouldn't work. I don't think it's worth rewriting the runner before the polyfill supports dynamic elements, as that will change/lessen the requirements there. At that point, there will be a difference between "the polyfill is loaded" and "the polyfill has been applied". The polyfill will still likely take several animation frames to get elements positioned when the polyfill has been applied, so the change in this PR will still be useful. |
I'm contributing to the polyfill for anchor position, which we test against the WPT. When testing the polyfill, we need to add a bit of delay to ensure the polyfill is applied before testing.
In #38442, a
checkLayoutForAnchorPos
wrapper forcheckLayout
was added to support a way to add a delay only for the polyfill while not impacting other tests. We don't have a similar method fortest
, so we have some false negatives when testing the polyfill.testForAnchorPos
is intended to replace all instances oftest
andpromise_test
in the Anchor Position tests. It likely would work forasync_test
as well, but I'm not seeing any instances of that in the Anchor Position tests. LikecheckLayoutForAnchorPos
, this only adds a delay if a globalCHECK_LAYOUT_DELAY
is true AND we are testing with--injected-script
. This should have no impact on non-polyfill tests.I've applied this to
css/css-anchor-position/pseudo-element-anchor.html
, and if this strategy is acceptable, I will transition the other tests as well.