feat(radio): answer the internet radio controls through the radio store

The Radio panel's and Cockpit's Enable, launcher, station tag,
transport and volume controls call RadioControls through the radio
store instead of DOM listeners. A refused station tag gets the kept tag
back from act(), which now returns what the answering action returned.
The Cockpit's station steps keep rotate: false. The unused element
fields go from the shell.
This commit is contained in:
Sameh Khamis committed 2026-11-01 11:02:39 -08:00
1 parent 61d11ce369
commit 7f7e66e793
18 files changed
+249 -141

No files matched your search

+13 -7
View File
@@ -1,6 +1,7 @@
import assert from 'node:assert/strict';
import { test } from 'node:test';
import { RadioControls } from './radioControls.js';
import { createOwners } from './stores/owners.js';
class Element extends EventTarget {
constructor() {
@@ -39,7 +40,12 @@ function fixture() {
globalThis.window = new EventTarget();
const panel = new Element();
const enable = new Element();
const next = new Element();
const store = {
...createOwners(),
publish() {},
publishUtility() {},
publishTuner() {},
};
const calls = [];
const subscribers = [];
const radio = {
@@ -72,16 +78,16 @@ function fixture() {
elements: {
_radioPanel: panel,
_radioEnableBtn: enable,
_radioNextBtn: next,
},
radio,
actions,
canvas: new Element(),
store,
});
return {
controls,
enable,
next,
store,
actions,
calls,
subscribers,
@@ -93,17 +99,17 @@ function fixture() {
};
}
test('Radio listeners and subscriptions are revoked once before tuning teardown', () => {
test('Radio listeners, actions and subscriptions are revoked once before tuning teardown', () => {
const f = fixture();
try {
f.controls.connect();
f.next.dispatchEvent(new Event('click'));
f.store.act('cycleRadio', 1);
assert.deepEqual(f.calls, ['subscribe', ['cycle', 1]]);
f.controls.destroy();
f.controls.destroy();
const snapshot = structuredClone(f.calls);
f.controls._setCockpitDisclosure('display', true);
f.next.dispatchEvent(new Event('click'));
f.store.act('cycleRadio', 1);
f.document.dispatchEvent(new Event('gev:radio-selected'));
f.subscribers[0]({ enabled: true });
f.controls.connect();
@@ -133,7 +139,7 @@ test('a delayed Radio enable cannot reveal or refocus controls after destruction
});
try {
f.actions.setEnabled = () => pending;
f.enable.dispatchEvent(new Event('click'));
f.store.act('toggleRadio', 'panel');
assert.equal(f.enable.getAttribute('aria-busy'), 'true');
f.controls.destroy();
const attrs = new Map(f.enable.attrs);