Skip to content

Commit 680a3e1

Browse files
committed
url: update tests to latest URL standard (fixes #163)
1 parent 52ba697 commit 680a3e1

File tree

2 files changed

+482
-2
lines changed

2 files changed

+482
-2
lines changed

tests/setters_tests.json

+57-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"comment": [
3+
"AS OF https://github.com/jsdom/whatwg-url/commit/35f04dfd3048cf6362f4398745bb13375c5020c2",
34
"## Tests for setters of https://url.spec.whatwg.org/#urlutils-members",
45
"",
56
"This file contains a JSON object.",
@@ -118,6 +119,14 @@
118119
"protocol": "http:"
119120
}
120121
},
122+
{
123+
"href": "gopher://example.net:1234",
124+
"new_value": "file",
125+
"expected": {
126+
"href": "gopher://example.net:1234",
127+
"protocol": "gopher:"
128+
}
129+
},
121130
{
122131
"href": "wss://x:[email protected]:1234",
123132
"new_value": "file",
@@ -202,6 +211,14 @@
202211
"protocol": "ssh:"
203212
}
204213
},
214+
{
215+
"href": "ssh://[email protected]",
216+
"new_value": "https",
217+
"expected": {
218+
"href": "ssh://[email protected]",
219+
"protocol": "ssh:"
220+
}
221+
},
205222
{
206223
"href": "ssh://[email protected]",
207224
"new_value": "file",
@@ -581,7 +598,7 @@
581598
}
582599
},
583600
{
584-
"comment": "Cannot-be-a-base means no password",
601+
"comment": "Cannot-be-a-base means no host",
585602
"href": "data:text/plain,Stuff",
586603
"new_value": "example.net",
587604
"expected": {
@@ -670,6 +687,17 @@
670687
"port": "2"
671688
}
672689
},
690+
{
691+
"comment": "IPv6 literal address with port, crbug.com/1012416",
692+
"href": "http://example.net",
693+
"new_value": "[2001:db8::2]:4002",
694+
"expected": {
695+
"href": "http://[2001:db8::2]:4002/",
696+
"host": "[2001:db8::2]:4002",
697+
"hostname": "[2001:db8::2]",
698+
"port": "4002"
699+
}
700+
},
673701
{
674702
"comment": "Default port number is removed",
675703
"href": "http://example.net",
@@ -1048,7 +1076,7 @@
10481076
}
10491077
},
10501078
{
1051-
"comment": "Cannot-be-a-base means no password",
1079+
"comment": "Cannot-be-a-base means no host",
10521080
"href": "data:text/plain,Stuff",
10531081
"new_value": "example.net",
10541082
"expected": {
@@ -1800,6 +1828,33 @@
18001828
"hash": "#foo%60bar"
18011829
}
18021830
},
1831+
{
1832+
"comment": "Simple percent-encoding; tabs and newlines are removed",
1833+
"href": "a:/",
1834+
"new_value": "\u0000\u0001\t\n\r\u001f !\"#$%&'()*+,-./09:;<=>?@AZ[\\]^_`az{|}~\u007f\u0080\u0081Éé",
1835+
"expected": {
1836+
"href": "a:/#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9",
1837+
"hash": "#%00%01%1F%20!%22#$%&'()*+,-./09:;%3C=%3E?@AZ[\\]^_%60az{|}~%7F%C2%80%C2%81%C3%89%C3%A9"
1838+
}
1839+
},
1840+
{
1841+
"comment": "Percent-encode NULLs in fragment",
1842+
"href": "http://example.net",
1843+
"new_value": "a\u0000b",
1844+
"expected": {
1845+
"href": "http://example.net/#a%00b",
1846+
"hash": "#a%00b"
1847+
}
1848+
},
1849+
{
1850+
"comment": "Percent-encode NULLs in fragment",
1851+
"href": "non-spec:/",
1852+
"new_value": "a\u0000b",
1853+
"expected": {
1854+
"href": "non-spec:/#a%00b",
1855+
"hash": "#a%00b"
1856+
}
1857+
},
18031858
{
18041859
"comment": "Bytes already percent-encoded are left as-is",
18051860
"href": "http://example.net",

0 commit comments

Comments
 (0)