diff --git a/urlpattern/resources/urlpatterntestdata.json b/urlpattern/resources/urlpatterntestdata.json index 9e7fe20005bed1..ae9405ea4b1292 100644 --- a/urlpattern/resources/urlpatterntestdata.json +++ b/urlpattern/resources/urlpatterntestdata.json @@ -985,6 +985,14 @@ "username": { "input": "caf%C3%A9", "groups": {}} } }, + { + "pattern": { "username": "café" }, + "input": { "username" : "café" }, + "expected": { + "input": { "username" : "café" }, + "username": { "input": "caf%C3%A9", "groups": {}} + } + }, { "pattern": { "username": "caf%c3%a9" }, "input": { "username" : "café" }, @@ -998,6 +1006,14 @@ "password": { "input": "caf%C3%A9", "groups": {}} } }, + { + "pattern": { "password": "café" }, + "input": { "password" : "café" }, + "expected": { + "input": { "password" : "café" }, + "password": { "input": "caf%C3%A9", "groups": {}} + } + }, { "pattern": { "password": "caf%c3%a9" }, "input": { "password" : "café" }, @@ -1011,6 +1027,14 @@ "hostname": { "input": "xn--caf-dma.com", "groups": {}} } }, + { + "pattern": { "hostname": "café.com" }, + "input": { "hostname" : "café.com" }, + "expected": { + "input": { "hostname" : "café.com" }, + "hostname": { "input": "xn--caf-dma.com", "groups": {}} + } + }, { "pattern": { "port": "" }, "input": { "protocol": "http", "port": "80" }, @@ -1020,6 +1044,35 @@ "port": { "input": "", "groups": {}} } }, + { + "pattern": { "protocol": "http", "port": "80" }, + "input": { "protocol": "http", "port": "80" }, + "expected": { + "input": { "protocol": "http", "port": "80" }, + "protocol": { "input": "http", "groups": {}}, + "port": { "input": "", "groups": {}} + } + }, + { + "pattern": { "protocol": "http", "port": "80{20}?" }, + "input": { "protocol": "http", "port": "80" }, + "expected": null + }, + { + "pattern": { "protocol": "http", "port": "80 " }, + "input": { "protocol": "http", "port": "80" }, + "error": true + }, + { + "pattern": { "port": "80" }, + "input": { "protocol": "http", "port": "80" }, + "expected": null + }, + { + "pattern": { "protocol": "http{s}?", "port": "80" }, + "input": { "protocol": "http", "port": "80" }, + "expected": null + }, { "pattern": { "port": "80" }, "input": { "port": "80" }, @@ -1057,6 +1110,14 @@ "pathname": { "input": "/caf%C3%A9", "groups": {}} } }, + { + "pattern": { "pathname": "/café" }, + "input": { "pathname": "/café" }, + "expected": { + "input": { "pathname": "/café" }, + "pathname": { "input": "/caf%C3%A9", "groups": {}} + } + }, { "pattern": { "pathname": "/caf%c3%a9" }, "input": { "pathname": "/café" }, @@ -1077,6 +1138,25 @@ "pathname": { "input": "/foo/bar", "groups": {}} } }, + { + "pattern": { "pathname": "/foo/../bar" }, + "input": { "pathname": "/bar" }, + "expected": { + "input": { "pathname": "/bar" }, + "pathname": { "input": "/bar", "groups": {}} + } + }, + { + "pattern": { "pathname": "./foo/bar", "baseURL": "https://example.com" }, + "input": { "pathname": "foo/bar", "baseURL": "https://example.com" }, + "expected": { + "input": { "pathname": "foo/bar", "baseURL": "https://example.com" }, + "exactly_empty_components": [ "username", "password", "port" ], + "protocol": { "input": "https", "groups": {}}, + "hostname": { "input": "example.com", "groups": {}}, + "pathname": { "input": "/foo/bar", "groups": {}} + } + }, { "pattern": { "pathname": "foo/bar" }, "input": "https://example.com/foo/bar", @@ -1112,6 +1192,14 @@ "search": { "input": "q=caf%C3%A9", "groups": {}} } }, + { + "pattern": { "search": "q=café" }, + "input": { "search": "q=café" }, + "expected": { + "input": { "search": "q=café" }, + "search": { "input": "q=caf%C3%A9", "groups": {}} + } + }, { "pattern": { "search": "q=caf%c3%a9" }, "input": { "search": "q=café" }, @@ -1125,6 +1213,14 @@ "hash": { "input": "caf%C3%A9", "groups": {}} } }, + { + "pattern": { "hash": "café" }, + "input": { "hash": "café" }, + "expected": { + "input": { "hash": "café" }, + "hash": { "input": "caf%C3%A9", "groups": {}} + } + }, { "pattern": { "hash": "caf%c3%a9" }, "input": { "hash": "café" },