зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1529188 [wpt PR 15468] - [Import Maps] implement "Packages" via trailing slashes, a=testonly
Automatic update from web-platform-tests [Import Maps] implement "Packages" via trailing slashes This CL also implements "most-specific wins" rule. https://github.com/WICG/import-maps/issues/102 Bug: 928149 Change-Id: I484266086bbe244de8b43ceeddacc8552307b7f4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1475049 Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org> Reviewed-by: Kouhei Ueno <kouhei@chromium.org> Cr-Commit-Position: refs/heads/master@{#638532} -- wpt-commits: f55313aae84eb0d2d42d1c1356732eda0540fc3f wpt-pr: 15468
This commit is contained in:
Родитель
7373d6f480
Коммит
2fccd25632
|
@ -1,4 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
// Imported from:
|
||||
// https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/resolving.js
|
||||
// TODO: Upstream local changes.
|
||||
|
||||
const { URL } = require('url');
|
||||
const { parseFromString } = require('../lib/parser.js');
|
||||
const { resolve } = require('../lib/resolver.js');
|
||||
|
@ -203,4 +208,23 @@ describe('Mapped using the "imports" key only (no scopes)', () => {
|
|||
expect(resolveUnderTest('/test')).toMatchURL('https://example.com/lib/test2.mjs');
|
||||
});
|
||||
});
|
||||
|
||||
describe('overlapping entries with trailing slashes', () => {
|
||||
const resolveUnderTest = makeResolveUnderTest(`{
|
||||
"imports": {
|
||||
"a": "/1",
|
||||
"a/": "/2/",
|
||||
"a/b": "/3",
|
||||
"a/b/": "/4/"
|
||||
}
|
||||
}`);
|
||||
|
||||
it('most-specific wins', () => {
|
||||
expect(resolveUnderTest('a')).toMatchURL('https://example.com/1');
|
||||
expect(resolveUnderTest('a/')).toMatchURL('https://example.com/2/');
|
||||
expect(resolveUnderTest('a/b')).toMatchURL('https://example.com/3');
|
||||
expect(resolveUnderTest('a/b/')).toMatchURL('https://example.com/4/');
|
||||
expect(resolveUnderTest('a/b/c')).toMatchURL('https://example.com/4/c');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче