summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.js
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.js')
-rw-r--r--testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.js54
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.js b/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.js
new file mode 100644
index 0000000000..587f9b9c46
--- /dev/null
+++ b/testing/web-platform/tests/html/semantics/links/links-created-by-a-and-area-elements/non-parsable-url-getter-setter.window.js
@@ -0,0 +1,54 @@
+[
+ {
+ "property": "origin",
+ "set": null
+ },
+ {
+ "property": "protocol",
+ "get": ":",
+ "set": "https"
+ },
+ {
+ "property": "username"
+ },
+ {
+ "property": "password"
+ },
+ {
+ "property": "host"
+ },
+ {
+ "property": "hostname"
+ },
+ {
+ "property": "port",
+ "set": "8000"
+ },
+ {
+ "property": "pathname"
+ },
+ {
+ "property": "search"
+ },
+ {
+ "property": "hash"
+ }
+].forEach(({ property, get = "", set = "string" }) => {
+ ["a", "area"].forEach(name => {
+ test(() => {
+ const link = document.createElement(name);
+ link.href = "http://test:test/"; // non-parsable URL
+ assert_equals(link[property], get);
+ }, `<${name} href="http://test:test/">.${property} getter`);
+
+ if (set !== null) {
+ test(() => {
+ const link = document.createElement(name);
+ link.href = "http://test:test/"; // non-parsable URL
+ link[property] = set;
+ assert_equals(link[property], get);
+ assert_equals(link.href, "http://test:test/");
+ }, `<${name} href="http://test:test/">.${property} setter`);
+ }
+ });
+});