feat(live): show language-scoped stream variants
Keep live stream variant expansion scoped to the selected language while preserving the legacy all-language variants response when no language is provided. Display projected current EPG programme data in live rows and distinguish selected streams from actively playing streams in the collapsed variant UI. Refs #43 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@ -152,9 +152,10 @@ test('full refresh analyzeAll runs Laya language detection after identity and pe
|
||||
}
|
||||
});
|
||||
|
||||
test('search result variant expansion uses logicalChannelId and lists the currently selected stream', async () => {
|
||||
test('search result variant expansion keeps language and distinguishes selected from playing stream', async () => {
|
||||
const { dom, window, channelList } = createChannelListDom();
|
||||
let variantsRequestedFor = null;
|
||||
let variantRequestOptions = null;
|
||||
|
||||
window.API = {
|
||||
live: {
|
||||
@ -181,8 +182,9 @@ test('search result variant expansion uses logicalChannelId and lists the curren
|
||||
}]
|
||||
};
|
||||
},
|
||||
getChannelVariants: async logicalChannelId => {
|
||||
getChannelVariants: async (logicalChannelId, options) => {
|
||||
variantsRequestedFor = logicalChannelId;
|
||||
variantRequestOptions = options;
|
||||
if (logicalChannelId !== 'logical:bein-sports-1') return { variants: [], page: { hasMore: false } };
|
||||
return {
|
||||
page: { hasMore: false },
|
||||
@ -202,14 +204,26 @@ test('search result variant expansion uses logicalChannelId and lists the curren
|
||||
|
||||
const toggle = window.document.querySelector('.variant-toggle');
|
||||
assert.ok(toggle, 'search result should expose a stream list toggle');
|
||||
assert.equal(toggle.getAttribute('aria-expanded'), 'false');
|
||||
assert.equal(toggle.getAttribute('aria-label'), 'Show 3 streams for beIN Sports 1');
|
||||
toggle.dispatchEvent(new window.MouseEvent('click', { bubbles: true }));
|
||||
await wait(20);
|
||||
|
||||
assert.equal(variantsRequestedFor, 'logical:bein-sports-1');
|
||||
assert.equal(variantRequestOptions.language, 'fr');
|
||||
assert.match(channelList.container.textContent, /beIN Sports 1 4K/);
|
||||
assert.equal(channelList.container.querySelector('.variant-playing-badge'), null);
|
||||
const selected = channelList.container.querySelector('.variant-selected-badge');
|
||||
assert.equal(selected?.textContent, 'Selected');
|
||||
assert.equal(selected?.closest('.channel-variant')?.dataset.variantId, 'bein-4k');
|
||||
|
||||
window.app.player.currentChannel = { id: 'bein-4k', sourceId: 1 };
|
||||
channelList.render();
|
||||
const playing = channelList.container.querySelector('.variant-playing-badge');
|
||||
assert.equal(playing?.textContent, 'Playing');
|
||||
assert.equal(playing?.closest('.channel-variant')?.dataset.variantId, 'bein-4k');
|
||||
assert.equal(channelList.container.querySelector('.variant-selected-badge'), null);
|
||||
assert.equal(channelList.container.querySelector('.variant-toggle').getAttribute('aria-label'), 'Hide streams for beIN Sports 1');
|
||||
} finally {
|
||||
dom.window.close();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user