| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,7 +29,7 @@ Last update: | |||
| 29 | 29 | - resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources | |
| 30 | 30 | - streams: https://github.com/web-platform-tests/wpt/tree/bc9dcbbf1a/streams | |
| 31 | 31 | - url: https://github.com/web-platform-tests/wpt/tree/9504a83e01/url | |
| 32 | - - urlpattern: https://github.com/web-platform-tests/wpt/tree/f07d05f49c/urlpattern | ||
| 32 | + - urlpattern: https://github.com/web-platform-tests/wpt/tree/3ffda23e5a/urlpattern | ||
| 33 | 33 | - user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing | |
| 34 | 34 | - wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi | |
| 35 | 35 | - wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,116 @@ | |||
| 1 | + [ | ||
| 2 | + { | ||
| 3 | + "pattern": { "pathname": "/foo" }, | ||
| 4 | + "component": "invalid", | ||
| 5 | + "groups": {}, | ||
| 6 | + "expected": null | ||
| 7 | + }, | ||
| 8 | + { | ||
| 9 | + "pattern": { "pathname": "/foo" }, | ||
| 10 | + "component": "pathname", | ||
| 11 | + "groups": {}, | ||
| 12 | + "expected": "/foo" | ||
| 13 | + }, | ||
| 14 | + { | ||
| 15 | + "pattern": { "pathname": "/:foo" }, | ||
| 16 | + "component": "pathname", | ||
| 17 | + "groups": { "foo": "bar" }, | ||
| 18 | + "expected": "/bar" | ||
| 19 | + }, | ||
| 20 | + { | ||
| 21 | + "pattern": { "pathname": "/:foo" }, | ||
| 22 | + "component": "pathname", | ||
| 23 | + "groups": { "foo": "🍅" }, | ||
| 24 | + "expected": "/%F0%9F%8D%85" | ||
| 25 | + }, | ||
| 26 | + { | ||
| 27 | + "pattern": { "hostname": "{:foo}.example.com" }, | ||
| 28 | + "component": "hostname", | ||
| 29 | + "groups": { "foo": "🍅" }, | ||
| 30 | + "expected": "xn--fi8h.example.com" | ||
| 31 | + }, | ||
| 32 | + { | ||
| 33 | + "pattern": { "pathname": "/:foo" }, | ||
| 34 | + "component": "pathname", | ||
| 35 | + "groups": {}, | ||
| 36 | + "expected": null | ||
| 37 | + }, | ||
| 38 | + { | ||
| 39 | + "pattern": { "pathname": "/foo/:bar" }, | ||
| 40 | + "component": "pathname", | ||
| 41 | + "groups": { "bar": "baz" }, | ||
| 42 | + "expected": "/foo/baz" | ||
| 43 | + }, | ||
| 44 | + { | ||
| 45 | + "pattern": { "pathname": "/foo:bar" }, | ||
| 46 | + "component": "pathname", | ||
| 47 | + "groups": { "bar": "baz" }, | ||
| 48 | + "expected": "/foobaz" | ||
| 49 | + }, | ||
| 50 | + { | ||
| 51 | + "pattern": { "pathname": "/:foo/:bar" }, | ||
| 52 | + "component": "pathname", | ||
| 53 | + "groups": { "foo": "baz", "bar": "qux" }, | ||
| 54 | + "expected": "/baz/qux" | ||
| 55 | + }, | ||
| 56 | + { | ||
| 57 | + "pattern": "https://example.com/:foo", | ||
| 58 | + "component": "pathname", | ||
| 59 | + "groups": { "foo": " " }, | ||
| 60 | + "expected": "/%20" | ||
| 61 | + }, | ||
| 62 | + { | ||
| 63 | + "pattern": "original-scheme://example.com/:foo", | ||
| 64 | + "component": "pathname", | ||
| 65 | + "groups": { "foo": " " }, | ||
| 66 | + "expected": "/ " | ||
| 67 | + }, | ||
| 68 | + { | ||
| 69 | + "pattern": { "pathname": "/:foo" }, | ||
| 70 | + "component": "pathname", | ||
| 71 | + "groups": { "foo": "bar/baz" }, | ||
| 72 | + "expected": null | ||
| 73 | + }, | ||
| 74 | + { | ||
| 75 | + "pattern": { "pathname": "*" }, | ||
| 76 | + "component": "pathname", | ||
| 77 | + "groups": {}, | ||
| 78 | + "expected": null | ||
| 79 | + }, | ||
| 80 | + { | ||
| 81 | + "pattern": { "pathname": "/{foo}+" }, | ||
| 82 | + "component": "pathname", | ||
| 83 | + "groups": {}, | ||
| 84 | + "expected": null | ||
| 85 | + }, | ||
| 86 | + { | ||
| 87 | + "pattern": { "pathname": "/{foo}?" }, | ||
| 88 | + "component": "pathname", | ||
| 89 | + "groups": {}, | ||
| 90 | + "expected": null | ||
| 91 | + }, | ||
| 92 | + { | ||
| 93 | + "pattern": { "pathname": "/{foo}*" }, | ||
| 94 | + "component": "pathname", | ||
| 95 | + "groups": {}, | ||
| 96 | + "expected": null | ||
| 97 | + }, | ||
| 98 | + { | ||
| 99 | + "pattern": { "pathname": "/(regexp)" }, | ||
| 100 | + "component": "pathname", | ||
| 101 | + "groups": {}, | ||
| 102 | + "expected": null | ||
| 103 | + }, | ||
| 104 | + { | ||
| 105 | + "pattern": { "pathname": "/([^\\/]+?)" }, | ||
| 106 | + "component": "pathname", | ||
| 107 | + "groups": {}, | ||
| 108 | + "expected": null | ||
| 109 | + }, | ||
| 110 | + { | ||
| 111 | + "pattern": { "port": "([^\\:]+?)" }, | ||
| 112 | + "component": "port", | ||
| 113 | + "groups": {}, | ||
| 114 | + "expected": null | ||
| 115 | + } | ||
| 116 | + ] | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,26 @@ | |||
| 1 | + // META: global=window,worker | ||
| 2 | + | ||
| 3 | + function runTests(data) { | ||
| 4 | + for (let entry of data) { | ||
| 5 | + test(function () { | ||
| 6 | + const pattern = new URLPattern(entry.pattern); | ||
| 7 | + | ||
| 8 | + if (entry.expected === null) { | ||
| 9 | + assert_throws_js(TypeError, _ => pattern.generate(entry.component, entry.groups), | ||
| 10 | + 'generate() should fail with TypeError'); | ||
| 11 | + return; | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + const result = pattern.generate(entry.component, entry.groups); | ||
| 15 | + assert_equals(result, entry.expected); | ||
| 16 | + }, `Pattern: ${JSON.stringify(entry.pattern)} ` + | ||
| 17 | + `Component: ${entry.component} ` + | ||
| 18 | + `Groups: ${JSON.stringify(entry.groups)}`); | ||
| 19 | + } | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + promise_test(async function () { | ||
| 23 | + const response = await fetch('resources/urlpattern-generate-test-data.json'); | ||
| 24 | + const data = await response.json(); | ||
| 25 | + runTests(data); | ||
| 26 | + }, 'Loading data...'); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -76,7 +76,7 @@ | |||
| 76 | 76 | "path": "url" | |
| 77 | 77 | }, | |
| 78 | 78 | "urlpattern": { | |
| 79 | - "commit": "f07d05f49c679a62dd112e18aa07405859745952", | ||
| 79 | + "commit": "3ffda23e5af7c59590b17c2710a22efd22dd4973", | ||
| 80 | 80 | "path": "urlpattern" | |
| 81 | 81 | }, | |
| 82 | 82 | "user-timing": { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,7 @@ | |||
| 1 | 1 | { | |
| 2 | + "urlpattern-generate.tentative.any.js": { | ||
| 3 | + "skip": "generate function is not yet included in the URLPattern spec" | ||
| 4 | + }, | ||
| 2 | 5 | "resources/urlpattern-compare-tests.tentative.js": { | |
| 3 | 6 | "skip": "compareComponent function is not yet included in the URLPattern spec" | |
| 4 | 7 | }, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments