mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-26 13:04:49 -07:00
fix: respect hideContextPercentage when FooterConfigDialog is closed without changes (#24773)
Co-authored-by: Coco Sheng <cocosheng@google.com>
This commit is contained in:
@@ -153,5 +153,49 @@ describe('footerItems', () => {
|
||||
expect(state.orderedIds).toContain('auth');
|
||||
expect(state.selectedIds.has('auth')).toBe(true);
|
||||
});
|
||||
|
||||
it('includes context-used in selectedIds when hideContextPercentage is false and items is undefined', () => {
|
||||
const settings = createMockSettings({
|
||||
ui: {
|
||||
footer: {
|
||||
hideContextPercentage: false,
|
||||
},
|
||||
},
|
||||
}).merged;
|
||||
|
||||
const state = resolveFooterState(settings);
|
||||
expect(state.selectedIds.has('context-used')).toBe(true);
|
||||
expect(state.orderedIds).toContain('context-used');
|
||||
});
|
||||
|
||||
it('does not include context-used in selectedIds when hideContextPercentage is true (default)', () => {
|
||||
const settings = createMockSettings({
|
||||
ui: {
|
||||
footer: {
|
||||
hideContextPercentage: true,
|
||||
},
|
||||
},
|
||||
}).merged;
|
||||
|
||||
const state = resolveFooterState(settings);
|
||||
expect(state.selectedIds.has('context-used')).toBe(false);
|
||||
// context-used should still be in orderedIds (as unselected)
|
||||
expect(state.orderedIds).toContain('context-used');
|
||||
});
|
||||
|
||||
it('persisted items array takes precedence over hideContextPercentage', () => {
|
||||
const settings = createMockSettings({
|
||||
ui: {
|
||||
footer: {
|
||||
items: ['workspace', 'model-name'],
|
||||
hideContextPercentage: false,
|
||||
},
|
||||
},
|
||||
}).merged;
|
||||
|
||||
const state = resolveFooterState(settings);
|
||||
// items array explicitly omits context-used, so it should not be selected
|
||||
expect(state.selectedIds.has('context-used')).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user