feat: add settings option to hide Live TV categories (#11)
Add a liveChannelListMode setting (default 'grouped') with a Settings toggle to display the Live TV channel list flat, without category group sections. When enabled, logical channels are listed directly with their stream variants still grouped as in #9/#10. Cover the setting default and flat-list behavior with tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -42,3 +42,20 @@ test('an explicit visible selection overrides the automatic quality preference',
|
||||
const logical = grouping.groupChannels([hd, uhd], { selectedVariants })[0];
|
||||
assert.equal(logical.preferredVariant.id, '1');
|
||||
});
|
||||
|
||||
test('flat list ordering promotes favorites without duplicating channels', () => {
|
||||
const channels = [
|
||||
{ id: 'one', isFavorite: false },
|
||||
{ id: 'two', isFavorite: true },
|
||||
{ id: 'three', isFavorite: false },
|
||||
{ id: 'four', isFavorite: true }
|
||||
];
|
||||
const ordered = grouping.orderFlatChannels(channels);
|
||||
assert.deepEqual(ordered.map(item => item.id), ['two', 'four', 'one', 'three']);
|
||||
assert.equal(new Set(ordered.map(item => item.id)).size, channels.length);
|
||||
});
|
||||
|
||||
test('favorites group updates are disabled for flat lists', () => {
|
||||
assert.equal(grouping.shouldUseFavoritesGroup('flat'), false);
|
||||
assert.equal(grouping.shouldUseFavoritesGroup('grouped'), true);
|
||||
});
|
||||
|
||||
7
test/settingsDefaults.test.js
Normal file
7
test/settingsDefaults.test.js
Normal file
@ -0,0 +1,7 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { getDefaultSettings } = require('../server/db');
|
||||
|
||||
test('defaults Live TV channel lists to grouped mode', () => {
|
||||
assert.equal(getDefaultSettings().liveChannelListMode, 'grouped');
|
||||
});
|
||||
Reference in New Issue
Block a user