ui: do not show 'initializing' when no card is inserted
The message branch treated the static auto_equip config flag as if initialization were in progress, so with auto-equip on (default) a cardless server showed 'Card inserted — initializing...' instead of the no-card message. The initializing state now requires equipping or an actually present card with auto-equip enabled; regression test added. SW cache v106 -> v107.
This commit is contained in:
+1
-1
@@ -6582,7 +6582,7 @@ function pysimCardStateUpdate(status) {
|
|||||||
pysimSetConnected(false);
|
pysimSetConnected(false);
|
||||||
const statusEl = document.getElementById('pysim-status');
|
const statusEl = document.getElementById('pysim-status');
|
||||||
if (statusEl && statusEl.textContent.trim() !== '') {
|
if (statusEl && statusEl.textContent.trim() !== '') {
|
||||||
if (status.equipping || status.auto_equip) {
|
if (status.equipping || (status.card_present && status.auto_equip)) {
|
||||||
statusEl.innerHTML = '<span class="text-gray-500">' + esc(t('Card inserted — initializing...')) + '</span>';
|
statusEl.innerHTML = '<span class="text-gray-500">' + esc(t('Card inserted — initializing...')) + '</span>';
|
||||||
} else if (status.card_present) {
|
} else if (status.card_present) {
|
||||||
statusEl.innerHTML = '<span class="text-amber-600">' + esc(t('Card inserted — press Equip')) + '</span>';
|
statusEl.innerHTML = '<span class="text-amber-600">' + esc(t('Card inserted — press Equip')) + '</span>';
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
const CACHE = 'otaman-v106';
|
const CACHE = 'otaman-v107';
|
||||||
const URLS = [
|
const URLS = [
|
||||||
'index.html',
|
'index.html',
|
||||||
'help.html',
|
'help.html',
|
||||||
|
|||||||
@@ -120,3 +120,10 @@ test('availability state and control gating follow server/card state', () => {
|
|||||||
assert.strictEqual(pysimControlDisabled('card', 'card'), false);
|
assert.strictEqual(pysimControlDisabled('card', 'card'), false);
|
||||||
assert.strictEqual(pysimControlDisabled('server', 'card'), false);
|
assert.strictEqual(pysimControlDisabled('server', 'card'), false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('no card with auto-equip enabled still shows the no-card message', () => {
|
||||||
|
const { el } = setup();
|
||||||
|
pysimCardStateUpdate(status({ connected: false, card_present: false, auto_equip: true }));
|
||||||
|
assert.ok(el.innerHTML.includes('No card detected'), el.innerHTML);
|
||||||
|
assert.ok(!el.innerHTML.includes('initializing'), el.innerHTML);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user