feat: redesign Toolbox navigation and personalization
This commit is contained in:
@@ -3,9 +3,9 @@ import {
|
||||
PREFERENCES_KEY,
|
||||
cleanPreferences,
|
||||
defaultPreferences,
|
||||
moveId,
|
||||
parsePreferences,
|
||||
readPreferences,
|
||||
reorderWithinIds,
|
||||
sortAppIds,
|
||||
writePreferences,
|
||||
} from './preferences';
|
||||
@@ -51,7 +51,7 @@ describe('preferences', () => {
|
||||
).toThrow(/pinned/i);
|
||||
});
|
||||
|
||||
it('cleans stale ids, pins first, and supports personal ordering', () => {
|
||||
it('cleans stale ids and applies personal ordering without mixing sections', () => {
|
||||
const cleaned = cleanPreferences(
|
||||
{
|
||||
version: 1,
|
||||
@@ -65,14 +65,36 @@ describe('preferences', () => {
|
||||
expect(cleaned.order).toEqual(['app.two', 'app.one', 'app.three']);
|
||||
expect(cleaned.hidden).toEqual([]);
|
||||
expect(sortAppIds(['app.one', 'app.two', 'app.three'], cleaned)).toEqual([
|
||||
'app.three',
|
||||
'app.two',
|
||||
'app.one',
|
||||
]);
|
||||
expect(moveId(cleaned.order, 'app.one', -1)).toEqual([
|
||||
'app.one',
|
||||
'app.two',
|
||||
'app.three',
|
||||
]);
|
||||
expect(
|
||||
reorderWithinIds(
|
||||
['pin.one', 'tool.one', 'pin.two', 'tool.two'],
|
||||
'pin.two',
|
||||
'pin.one',
|
||||
['pin.one', 'pin.two']
|
||||
)
|
||||
).toEqual(['pin.two', 'tool.one', 'pin.one', 'tool.two']);
|
||||
expect(
|
||||
reorderWithinIds(cleaned.order, 'app.one', 'app.two', [
|
||||
'app.two',
|
||||
'app.one',
|
||||
])
|
||||
).toEqual(['app.one', 'app.two', 'app.three']);
|
||||
});
|
||||
|
||||
it('does not reorder across peer groups or for an unknown drop target', () => {
|
||||
const order = ['pin.one', 'tool.one', 'pin.two'];
|
||||
expect(
|
||||
reorderWithinIds(order, 'pin.one', 'tool.one', ['pin.one', 'pin.two'])
|
||||
).toBe(order);
|
||||
expect(
|
||||
reorderWithinIds(order, 'missing', 'pin.one', ['pin.one', 'pin.two'])
|
||||
).toBe(order);
|
||||
expect(reorderWithinIds(order, 'pin.one', 'pin.one', ['pin.one'])).toBe(
|
||||
order
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user