Open otherdaniel opened 2 months ago
I have two, hacky versions of how I think it could work:
1, Re-using the logic for webvtt/parsing/cue-text-parsing WPT tests
2, Doing it all in JS.
<script>
element in the same file that uses it.In the call, Tom pointed out two issues, IMHO both correct:
<script>
-version cannot handle handle "" tags in source without some extra logic.(I'm happy to convert the source to WPT GitHub-PRs, if that helps.)
Why not do 2, but have the test data in an external file? That makes it easier for others to reuse and does away with the </script>
issue.
I wonder if we can handle closed shadow roots by getting references to them during setup, but I also think it would be okay if we have some tests on the side for shadow roots.
+1 to not having a python script if it's not a lot of work 😅
I've made small parser tests which don't use any sort of format like this one, but yeah seems good to reuse this format if you want to have more test cases that are easier to iterate on.
I think for the select
enhancement in particular we should have https://github.com/html5lib/html5lib-tests coverage instead, but that's a bit off-topic for this issue.
Fleshed out the code a bit more. It can now parse a string, with convenience methods to either get it from a <script>
element, or from a Promise of a Response, as fetch()
would return. That way, the user can pick whichever source is appropriate.
I intend to land this as a support file for Sanitizer API tests. But it's written so that it should be easy to generalize and make it more generally useful within WPT. Current version here: https://chromium-review.googlesource.com/c/chromium/src/+/5920436
This issue is to track progress on using HTML5lib-style test cases for Sanitizer's WPT test cases.
Specififcally, this format: https://github.com/html5lib/html5lib-tests/blob/master/tree-construction/README.md