Feat(settings): add renderer for settings configuration #142

Merged
jakob.scheid merged 88 commits from feature/settings-renderer into main 2026-07-28 20:14:50 +02:00
2 changed files with 13 additions and 2 deletions
Showing only changes of commit c5a16d2797 - Show all commits
@@ -47,7 +47,15 @@ describe('useSettingsPage', () => {
{ path: 'a..b..', expected: ['a', 'b'] },
{ path: '.a..b..', expected: ['a', 'b'] },
{ path: '..a..b.', expected: ['a', 'b'] },
{ path: '..a.....b.c..d....', expected: ['a', 'b', 'c', 'd'] }
{ path: '..a.....b.c..d....', expected: ['a', 'b', 'c', 'd'] },
{ path: 'a.b.c/', expected: ['a', 'b', 'c'] },
{ path: 'a.#b.c', expected: ['a', 'b', 'c'] },
{ path: 'a.#b.c/', expected: ['a', 'b', 'c'] },
{ path: 'a1.#b.c/', expected: ['a1', 'b', 'c'] },
{ path: 'a-1.#b.c/', expected: ['a-1', 'b', 'c'] },
{ path: 'a-1.b@.c', expected: ['a-1', 'b', 'c'] },
{ path: '....@a/#...)!&§[b.#§c..d....', expected: ['a', 'b', 'c', 'd'] },
{ path: '....@a/#...)!&§[b.#§c..dä....', expected: ['a', 'b', 'c', 'd'] }
])('normalizes path correctly', async ({ path, expected }) => {
expect(normalizePagePath(path)).toStrictEqual(expected);
});
@@ -20,7 +20,10 @@ export const normalizePagePath = function normalizePagePath (path) {
return path
.replace(/\.+/g, '.')
.replace(/^\.+|\.+$/g, '')
.split('.');
.split('.')
.map(
(segment) => segment.replace(/[^a-zA-Z0-9-]/g, '')
);
};
export const useSettingsPage = function useSettingsPage () {