ui: show the provider in the eSIM profile card title
The card title showed only the nickname or profile name ('0002'); with
the provider in front it reads 'Alfa 0002' and still prefers a user
nickname ('Alfa Work') when one is set.
- esimProfileTitle(): provider + (nickname || name), falling back to the
ICCID and finally '?'.
- tests for the helper; help EN/RU and sw.js simple-v234.
This commit is contained in:
@@ -24,7 +24,8 @@ function extractFunc(src, name) {
|
||||
let code = '';
|
||||
for (const fn of ['esimLabel', 'esimGroupEid', 'esimFieldRows', 'esimResultText',
|
||||
'esimStateLabel', 'esimOperationsText', 'esimProfileRows', 'esimIconDataUrl',
|
||||
'esimChipSectionRows', 'esimChipValueWide', 'esimChipBox', 'esimSwitchStatus']) {
|
||||
'esimChipSectionRows', 'esimChipValueWide', 'esimChipBox', 'esimSwitchStatus',
|
||||
'esimProfileTitle']) {
|
||||
code += extractFunc(html, fn) + '\n';
|
||||
}
|
||||
for (const c of ['ESIM_CHIP_LABELS', 'ESIM_RESULT_KEYS']) {
|
||||
@@ -148,6 +149,17 @@ test('esimIconDataUrl builds a data URL for png and jpg icons', () => {
|
||||
assert.strictEqual(esimIconDataUrl(null), '');
|
||||
});
|
||||
|
||||
test('esimProfileTitle puts the provider in front of the profile label', () => {
|
||||
assert.strictEqual(esimProfileTitle({ provider: 'Alfa', name: '0002' }), 'Alfa 0002');
|
||||
assert.strictEqual(esimProfileTitle({ provider: 'Alfa', nickname: 'Work', name: '0002' }),
|
||||
'Alfa Work');
|
||||
assert.strictEqual(esimProfileTitle({ name: '0002' }), '0002');
|
||||
assert.strictEqual(esimProfileTitle({ provider: 'Alfa' }), 'Alfa');
|
||||
assert.strictEqual(esimProfileTitle({ iccid: '8970119000004002667' }),
|
||||
'8970119000004002667');
|
||||
assert.strictEqual(esimProfileTitle({}), '?');
|
||||
});
|
||||
|
||||
test('the profile card renders the icon image next to the rows', () => {
|
||||
const fn = extractFunc(html, 'esimRenderProfiles');
|
||||
assert.match(fn, /esimIconDataUrl\(p\)/);
|
||||
|
||||
Reference in New Issue
Block a user