test: cover work-status empty panel recovery
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
WORK_STATUS_SECTION_IDS,
|
||||
WORK_STATUS_SECTION_LABEL_KEYS,
|
||||
areAllWorkStatusSectionsHidden,
|
||||
getWorkStatusPanelPresentation,
|
||||
isWorkStatusSectionVisible,
|
||||
sanitizeWorkStatusHiddenSections,
|
||||
} from './sections';
|
||||
@@ -62,6 +63,44 @@ describe('areAllWorkStatusSectionsHidden', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('getWorkStatusPanelPresentation', () => {
|
||||
test('keeps a visible all-hidden panel interactive and renders its recovery state', () => {
|
||||
expect(getWorkStatusPanelPresentation({
|
||||
visible: true,
|
||||
contentMounted: true,
|
||||
renderedSections: 0,
|
||||
allSectionsHidden: true,
|
||||
})).toEqual({ interactive: true, showEmptyState: true });
|
||||
});
|
||||
|
||||
test('covers the optimistic fresh-mount count when all sections are hidden', () => {
|
||||
expect(getWorkStatusPanelPresentation({
|
||||
visible: true,
|
||||
contentMounted: true,
|
||||
renderedSections: 1,
|
||||
allSectionsHidden: true,
|
||||
})).toEqual({ interactive: true, showEmptyState: true });
|
||||
});
|
||||
|
||||
test('preserves collapse when no section has data but sections remain enabled', () => {
|
||||
expect(getWorkStatusPanelPresentation({
|
||||
visible: true,
|
||||
contentMounted: true,
|
||||
renderedSections: 0,
|
||||
allSectionsHidden: false,
|
||||
})).toEqual({ interactive: false, showEmptyState: false });
|
||||
});
|
||||
|
||||
test('does not expose controls or the empty state during a hidden collapse', () => {
|
||||
expect(getWorkStatusPanelPresentation({
|
||||
visible: false,
|
||||
contentMounted: false,
|
||||
renderedSections: 0,
|
||||
allSectionsHidden: true,
|
||||
})).toEqual({ interactive: false, showEmptyState: false });
|
||||
});
|
||||
});
|
||||
|
||||
describe('sanitizeWorkStatusHiddenSections', () => {
|
||||
test('keeps known ids and drops everything else', () => {
|
||||
expect(sanitizeWorkStatusHiddenSections(['usage', 'nope', 42, null, 'tasks']))
|
||||
|
||||
Reference in New Issue
Block a user