| { |
| "name": "Relative URL-like addresses", |
| "tests": { |
| "should accept strings prefixed with ./, ../, or /": { |
| "importMap": { |
| "imports": { |
| "dotSlash": "./foo", |
| "dotDotSlash": "../foo", |
| "slash": "/foo" |
| } |
| }, |
| "importMapBaseURL": "https://base.example/path1/path2/path3", |
| "expectedParsedImportMap": { |
| "imports": { |
| "dotSlash": "https://base.example/path1/path2/foo", |
| "dotDotSlash": "https://base.example/path1/foo", |
| "slash": "https://base.example/foo" |
| }, |
| "scopes": {} |
| } |
| }, |
| "should not accept strings prefixed with ./, ../, or / for data: base URLs": { |
| "importMap": { |
| "imports": { |
| "dotSlash": "./foo", |
| "dotDotSlash": "../foo", |
| "slash": "/foo" |
| } |
| }, |
| "importMapBaseURL": "data:text/html,test", |
| "expectedParsedImportMap": { |
| "imports": { |
| "dotSlash": null, |
| "dotDotSlash": null, |
| "slash": null |
| }, |
| "scopes": {} |
| } |
| }, |
| "should accept the literal strings ./, ../, or / with no suffix": { |
| "importMap": { |
| "imports": { |
| "dotSlash": "./", |
| "dotDotSlash": "../", |
| "slash": "/" |
| } |
| }, |
| "importMapBaseURL": "https://base.example/path1/path2/path3", |
| "expectedParsedImportMap": { |
| "imports": { |
| "dotSlash": "https://base.example/path1/path2/", |
| "dotDotSlash": "https://base.example/path1/", |
| "slash": "https://base.example/" |
| }, |
| "scopes": {} |
| } |
| }, |
| "should ignore percent-encoded variants of ./, ../, or /": { |
| "importMap": { |
| "imports": { |
| "dotSlash1": "%2E/", |
| "dotDotSlash1": "%2E%2E/", |
| "dotSlash2": ".%2F", |
| "dotDotSlash2": "..%2F", |
| "slash2": "%2F", |
| "dotSlash3": "%2E%2F", |
| "dotDotSlash3": "%2E%2E%2F" |
| } |
| }, |
| "importMapBaseURL": "https://base.example/path1/path2/path3", |
| "expectedParsedImportMap": { |
| "imports": { |
| "dotSlash1": null, |
| "dotDotSlash1": null, |
| "dotSlash2": null, |
| "dotDotSlash2": null, |
| "slash2": null, |
| "dotSlash3": null, |
| "dotDotSlash3": null |
| }, |
| "scopes": {} |
| } |
| } |
| } |
| } |