ui: header preset indicators — ADM key glyph, SCP80/SCP81 completeness (v2.6.1)
- the ADM badge gains a trailing key glyph (ADM ✓ ⚿ / ADM ✗ ⚿) when the preset matching the equipped card's ICCID carries an ADM key; the four tooltip states cover key/no-key x verified/not-verified - new gray SCP80/SCP81 markers after ADM, shown only when that preset has all SCP80 fields (KIc/KID, SPI1/SPI2, counter, KIc/KID keys) or the SCP81 PSK pair filled in; hidden without a card session, a matching preset or the fields, never color-coded - cardsScp80Complete/cardsScp81Complete/cardsAdmPresent/cardsMatchedPreset helpers; cardsRender reuses the SCP81 predicate - tests: ADM four-state badge, marker show/hide, predicate whitespace handling, header markup order; help EN/RU updated; SW cache simple-v201
This commit is contained in:
@@ -24,6 +24,7 @@ function extractFunc(src, name) {
|
||||
let code = '';
|
||||
for (const fn of ['cardsTarValue', 'cardsFormValues', 'cardsClearForm', 'cardsEdit',
|
||||
'cardsAdd', 'cardsImport', 'cardsApply', 'ramApplyCard',
|
||||
'cardsScp80Complete', 'cardsScp81Complete', 'cardsAdmPresent',
|
||||
'spTarKeyForPack', 'spPresetTar', 'packToSp']) {
|
||||
code += extractFunc(html, fn) + '\n';
|
||||
}
|
||||
@@ -85,6 +86,26 @@ test('cardsTarValue falls back to the per-target spec defaults', () => {
|
||||
assert.strictEqual(cardsTarValue('nope', ''), '');
|
||||
});
|
||||
|
||||
test('preset completeness predicates used by the header markers', () => {
|
||||
const full = { kic: '15', kid: '15', spi1: '16', spi2: '01', cntr: '0000000001',
|
||||
kicKey: 'AA', kidKey: 'BB', pskIdentity: 'id', pskKey: 'KEY', adm: '0011' };
|
||||
assert.ok(cardsScp80Complete(full));
|
||||
assert.ok(cardsScp81Complete(full));
|
||||
assert.ok(cardsAdmPresent(full));
|
||||
// every SCP80 field is required; whitespace counts as empty
|
||||
for (const field of ['kic', 'kid', 'spi1', 'spi2', 'cntr', 'kicKey', 'kidKey']) {
|
||||
const c = Object.assign({}, full);
|
||||
c[field] = ' ';
|
||||
assert.ok(!cardsScp80Complete(c), 'SCP80 marked complete with empty ' + field);
|
||||
}
|
||||
assert.ok(!cardsScp81Complete({ pskIdentity: 'id' }));
|
||||
assert.ok(!cardsScp81Complete({ pskKey: 'KEY' }));
|
||||
assert.ok(!cardsScp80Complete(null));
|
||||
assert.ok(!cardsScp81Complete(null));
|
||||
assert.ok(!cardsAdmPresent(null));
|
||||
assert.ok(!cardsAdmPresent({ adm: ' ' }));
|
||||
});
|
||||
|
||||
test('clearing the card form keeps the TAR spec defaults', () => {
|
||||
const els = setup();
|
||||
els['cards-tar'].value = 'AABBCC';
|
||||
|
||||
Reference in New Issue
Block a user