Skip to content

Commit 1e1e804

Browse files
annevkjgraham
authored andcommitted
URL: protocol setter and special URLs (#4413)
* URL: protocol setter and special URLs Closes whatwg/url#104.
1 parent 0a61fa2 commit 1e1e804

File tree

1 file changed

+42
-2
lines changed

1 file changed

+42
-2
lines changed

url/setters_tests.json

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,30 @@
102102
}
103103
},
104104
{
105-
"comment": "Can’t switch from special scheme to non-special. Note: this may change, see https://github.com/whatwg/url/issues/104",
105+
"comment": "Can’t switch from special scheme to non-special",
106106
"href": "http://example.net",
107107
"new_value": "b",
108108
"expected": {
109109
"href": "http://example.net/",
110110
"protocol": "http:"
111111
}
112112
},
113+
{
114+
"href": "https://example.net",
115+
"new_value": "s",
116+
"expected": {
117+
"href": "https://example.net/",
118+
"protocol": "https:"
119+
}
120+
},
121+
{
122+
"href": "ftp://example.net",
123+
"new_value": "test",
124+
"expected": {
125+
"href": "ftp://example.net/",
126+
"protocol": "ftp:"
127+
}
128+
},
113129
{
114130
"comment": "Cannot-be-a-base URL doesn’t have a host, but URL in a special scheme must.",
115131
"href": "mailto:[email protected]",
@@ -120,14 +136,38 @@
120136
}
121137
},
122138
{
123-
"comment": "Can’t switch from non-special scheme to special. Note: this may change, see https://github.com/whatwg/url/issues/104",
139+
"comment": "Can’t switch from non-special scheme to special",
124140
"href": "ssh://[email protected]",
125141
"new_value": "http",
126142
"expected": {
127143
"href": "ssh://[email protected]/",
128144
"protocol": "ssh:"
129145
}
130146
},
147+
{
148+
"href": "ssh://[email protected]",
149+
"new_value": "gopher",
150+
"expected": {
151+
"href": "ssh://[email protected]/",
152+
"protocol": "ssh:"
153+
}
154+
},
155+
{
156+
"href": "ssh://[email protected]",
157+
"new_value": "file",
158+
"expected": {
159+
"href": "ssh://[email protected]/",
160+
"protocol": "ssh:"
161+
}
162+
},
163+
{
164+
"href": "nonsense:///test",
165+
"new_value": "https",
166+
"expected": {
167+
"href": "nonsense:///test",
168+
"protocol": "nonsense:"
169+
}
170+
},
131171
{
132172
"comment": "Stuff after the first ':' is ignored",
133173
"href": "http://example.net",

0 commit comments

Comments
 (0)