tree: f08cac10cb19276777a768652312b32d67a6cfb0 [path history] [tgz]
  1. a-element-expected.txt
  2. a-element-origin-expected.txt
  3. a-element-origin-xhtml-expected.txt
  4. a-element-origin-xhtml.xhtml
  5. a-element-origin.html
  6. a-element-origin.js
  7. a-element-xhtml-expected.txt
  8. a-element-xhtml.xhtml
  9. a-element.html
  10. a-element.js
  11. failure-expected.txt
  12. failure.html
  13. historical-expected.txt
  14. historical.html
  15. historical.worker-expected.txt
  16. historical.worker.html
  17. historical.worker.js
  18. interfaces-expected.txt
  19. interfaces.html
  20. OWNERS
  21. README.md
  22. setters_tests.json
  23. url-constructor-expected.txt
  24. url-constructor.html
  25. url-domainToUnicode-expected.txt
  26. url-domainToUnicode.html
  27. url-origin-expected.txt
  28. url-origin.html
  29. url-setters-expected.txt
  30. url-setters.html
  31. url-tojson-expected.txt
  32. url-tojson.html
  33. urlencoded-parser-expected.txt
  34. urlencoded-parser.html
  35. urlsearchparams-append-expected.txt
  36. urlsearchparams-append.html
  37. urlsearchparams-constructor-expected.txt
  38. urlsearchparams-constructor.html
  39. urlsearchparams-delete-expected.txt
  40. urlsearchparams-delete.html
  41. urlsearchparams-foreach-expected.txt
  42. urlsearchparams-foreach.html
  43. urlsearchparams-get-expected.txt
  44. urlsearchparams-get.html
  45. urlsearchparams-getall-expected.txt
  46. urlsearchparams-getall.html
  47. urlsearchparams-has-expected.txt
  48. urlsearchparams-has.html
  49. urlsearchparams-set-expected.txt
  50. urlsearchparams-set.html
  51. urlsearchparams-sort-expected.txt
  52. urlsearchparams-sort.html
  53. urlsearchparams-stringifier-expected.txt
  54. urlsearchparams-stringifier.html
  55. urltestdata.json
  56. w3c-import.log
LayoutTests/imported/w3c/web-platform-tests/url/README.md

These tests are for browsers, but the data for a-element.html, url-constructor.html, and a-element-xhtml.xhtml is in urltestdata.json and can be re-used by non-browser implementations. This file contains a JSON array of comments as strings and test cases as objects. The keys for each test case are:

  • base: an absolute URL as a string whose parsing without a base of its own should succeed. This key is always present, and may have a value like "about:blank" when input is an absolute URL.
  • input: an URL as a string to be parsed with base as its base URL.
  • Either:
    • failure with the value true, indicating that parsing input should return failure,

    • or href, origin, protocol, username, password, host, hostname, port, pathname, search, and hash with string values; indicating that parsing input should return an URL record and that the getters of each corresponding attribute in that URL’s API should return the corresponding value.

      The origin key may be missing. In that case, the API’s origin attribute is not tested.

annevk/url hosts some other files that might be of interest if you want to create additional tests.

Similar to a-element.html it would be trivial to add more tests for other objects that expose links (e.g. URL and <area>). There's also room for enhancement and bits that require independent tests:

  • The encoding part of the URL parser
  • The state override part of the URL parser (setting individual properties of a URL)
  • Origin serialization
  • application/x-www-form-urlencoded