feat: library section and subsection page (#2032)
* Adds section and subsection library pages. * Refactors routing to support them and fix routing from collections page to other pages. * Refactors library context to reliably set component, unit, and other container ids even when the url changes when user goes back in history rapidly.
This commit is contained in:
@@ -4,8 +4,6 @@ import {
|
||||
getLibraryId,
|
||||
isLibraryKey,
|
||||
isLibraryV1Key,
|
||||
getContainerTypeFromId,
|
||||
ContainerType,
|
||||
} from './key-utils';
|
||||
|
||||
describe('component utils', () => {
|
||||
@@ -14,6 +12,9 @@ describe('component utils', () => {
|
||||
['lb:org:lib:html:id', 'html'],
|
||||
['lb:OpenCraftX:ALPHA:html:571fe018-f3ce-45c9-8f53-5dafcb422fdd', 'html'],
|
||||
['lb:Axim:beta:problem:571fe018-f3ce-45c9-8f53-5dafcb422fdd', 'problem'],
|
||||
['lct:org:lib:unit:my-unit-9284e2', 'unit'],
|
||||
['lct:org:lib:section:my-section-9284e2', 'section'],
|
||||
['lct:org:lib:subsection:my-section-9284e2', 'subsection'],
|
||||
]) {
|
||||
it(`returns '${expected}' for usage key '${input}'`, () => {
|
||||
expect(getBlockType(input)).toStrictEqual(expected);
|
||||
@@ -99,16 +100,4 @@ describe('component utils', () => {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('getContainerTypeFromId', () => {
|
||||
for (const [input, expected] of [
|
||||
['lct:org:lib:unit:my-unit-9284e2', ContainerType.Unit],
|
||||
['lct:OpenCraftX:ALPHA:my-unit-a3223f', undefined],
|
||||
['', undefined],
|
||||
]) {
|
||||
it(`returns '${expected}' for container key '${input}'`, () => {
|
||||
expect(getContainerTypeFromId(input!)).toStrictEqual(expected);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user