summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/non-special-opaque-path-url-getter-setter.window.js
blob: 9549c6e2a6f639b54108dad2b5f3f6c414c5ca06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[
  {
    "property": "origin",
    "get": "null",
    "set": null
  },
  {
    "property": "protocol",
    "get": "non-special:",
    "set": "super-special",
    "setget": "super-special:"
  },
  {
    "property": "username"
  },
  {
    "property": "password"
  },
  {
    "property": "host",
  },
  {
    "property": "hostname",
  },
  {
    "property": "port",
    "set": "8000"
  },
  {
    "property": "pathname",
    "get": "opaque",
    "setget": "opaque"
  },
  {
    "property": "search",
    "setget": "?string"
  },
  {
    "property": "hash",
    "setget": "#string"
  }
].forEach(({ property, get = "", set = "string", setget = get }) => {
  ["a", "area"].forEach(name => {
    test(() => {
      const link = document.createElement(name);
      link.href = "non-special:opaque";
      assert_equals(link[property], get);
    }, `<${name} href="non-special:opaque">.${property} getter`);

    if (set !== null) {
      test(() => {
        const link = document.createElement(name);
        link.href = "non-special:opaque";
        link[property] = set;
        assert_equals(link[property], setget);
      }, `<${name} href="non-special:opaque">.${property} setter`);
    }
  });
});