Skip to content

Commit 1840ca4

Browse files
authored
Merge pull request #82 from keepass-web/issue-73-tab-emoji
Drop the tab title's padlock emoji (#73)
2 parents 81f33de + 5cfe0bf commit 1840ca4

7 files changed

Lines changed: 27 additions & 22 deletions

File tree

e2e/auto-lock.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ test('a tab left hidden locks the embedded database on its own', async () => {
8181
await otherTab.close();
8282
assert.equal(
8383
await page.title(),
84-
`🔒 ${basename(fixture.path)} - Locked - KeePass Web - Local file`,
84+
`${basename(fixture.path)} - Locked - KeePass Web - Local file`,
8585
'and the tab bar shows it locked, without being opened',
8686
);
8787
});

e2e/tab-title.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ test('the tab names the open database and tracks its lock state', async () => {
7272
const iframeFrame = await iframeElement.contentFrame();
7373
assert.ok(iframeFrame, 'the iframe has a content frame');
7474

75-
await waitForTitle(`🔒 ${filename} - Locked - ${BASE_TITLE}`);
75+
await waitForTitle(`${filename} - Locked - ${BASE_TITLE}`);
7676
const lockedIcon = await tabIcon();
7777
assert.notEqual(lockedIcon, pageIcon, 'a held database is not the page at rest');
7878

@@ -82,7 +82,7 @@ test('the tab names the open database and tracks its lock state', async () => {
8282
await iframeFrame.click('#unlock-btn');
8383

8484
await iframeFrame.waitForSelector('.entry-table');
85-
await waitForTitle(`🔓 ${filename} - Unlocked - ${BASE_TITLE}`);
85+
await waitForTitle(`${filename} - Unlocked - ${BASE_TITLE}`);
8686
const unlockedIcon = await tabIcon();
8787
assert.notEqual(unlockedIcon, lockedIcon, 'and the two states do not share an icon');
8888

pages/shared/logic.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ const LOCKED_ICON =
1313
const UNLOCKED_ICON =
1414
"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Crect width='16' height='16' rx='3.4' fill='%238a5a1e'/%3E%3Crect x='3.7' y='4.4' width='8.6' height='1.9' rx='.95' fill='%23fff'/%3E%3Crect x='3.7' y='7.05' width='8.6' height='1.9' rx='.95' fill='%23fff'/%3E%3Crect x='3.7' y='9.7' width='8.6' height='1.9' rx='.95' fill='%23fff'/%3E%3C/svg%3E";
1515

16-
/** The tab's name. It spells the state out as well as showing it, because 🔒
17-
and 🔓 are as hard to tell apart in a title as they are in a tab (#73). */
16+
/** The tab's name. The state is named in words and not repeated as a glyph:
17+
the icon beside it already carries it as a picture, and the padlock emoji says
18+
the same thing a second time in the form that reads least well (#73). */
1819
export function tabTitle(baseTitle: string, filename: string, locked: boolean): string {
1920
if (!filename) return baseTitle;
20-
return `${locked ? '🔒' : '🔓'} ${filename} - ${locked ? 'Locked' : 'Unlocked'} - ${baseTitle}`;
21+
return `${filename} - ${locked ? 'Locked' : 'Unlocked'} - ${baseTitle}`;
2122
}
2223

2324
/** Name the tab and mark it with the database's state; no filename means no

pages/tests/0x67-page.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ test('0x67 app', async (t) => {
315315

316316
await waitFor(() => q('#master-password') !== null);
317317
assert.equal(q<HTMLElement>('#db-filename').textContent, 'dropped.kdbx');
318-
assert.equal(dom.window.document.title, '🔒 dropped.kdbx - Locked - KeePass Web');
318+
assert.equal(dom.window.document.title, 'dropped.kdbx - Locked - KeePass Web');
319319
});
320320

321321
await t.test('unlock screen "back" returns to upload and clears the file', () => {
@@ -439,7 +439,7 @@ test('0x67 app', async (t) => {
439439

440440
await waitFor(() => dom.window.document.body.classList.contains('app-mode'));
441441
assert.ok(q('#group-tree').querySelector('.group-btn'));
442-
assert.equal(dom.window.document.title, '🔓 real.kdbx - Unlocked - KeePass Web');
442+
assert.equal(dom.window.document.title, 'real.kdbx - Unlocked - KeePass Web');
443443
// Table view is the default.
444444
assert.equal(root().querySelectorAll('.entry-table').length, 1);
445445
// Switch to tile view, which the rest of this suite's entry-list
@@ -1636,7 +1636,7 @@ test('0x67 app', async (t) => {
16361636
assert.equal(lockDlg.open, false);
16371637
await waitFor(() => q('#master-password') !== null);
16381638
assert.equal(q<HTMLElement>('#db-filename').textContent, 'real.kdbx');
1639-
assert.equal(dom.window.document.title, '🔒 real.kdbx - Locked - KeePass Web');
1639+
assert.equal(dom.window.document.title, 'real.kdbx - Locked - KeePass Web');
16401640

16411641
// A wrong password on the relocked (freshly re-encrypted) state is
16421642
// still rejected — locking doesn't weaken the credential check.
@@ -1889,7 +1889,7 @@ test('a tab left hidden locks itself, and coming back in time calls it off', asy
18891889
assert.equal(q<HTMLElement>('#db-filename').textContent, 'auto-lock.kdbx');
18901890
assert.equal(
18911891
dom.window.document.title,
1892-
'🔒 auto-lock.kdbx - Locked - KeePass Web',
1892+
'auto-lock.kdbx - Locked - KeePass Web',
18931893
'the tab bar says so without being opened',
18941894
);
18951895

pages/tests/cloud-google-drive-page.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,10 +392,10 @@ test('Google Drive connector', async (t) => {
392392

393393
await t.test('kw-title names the open database in the tab', () => {
394394
sendMessage({ type: 'kw-title', filename: 'vault.kdbx', locked: true }, { source: frameWin });
395-
assert.equal(doc.title, '🔒 vault.kdbx - Locked - KeePass Web - Google Drive');
395+
assert.equal(doc.title, 'vault.kdbx - Locked - KeePass Web - Google Drive');
396396

397397
sendMessage({ type: 'kw-title', filename: 'vault.kdbx', locked: false }, { source: frameWin });
398-
assert.equal(doc.title, '🔓 vault.kdbx - Unlocked - KeePass Web - Google Drive');
398+
assert.equal(doc.title, 'vault.kdbx - Unlocked - KeePass Web - Google Drive');
399399

400400
// An app with nothing open reports no filename, leaving this page's own title.
401401
sendMessage({ type: 'kw-title', filename: '', locked: true }, { source: frameWin });

pages/tests/local-page.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ test('local file connector', async (t) => {
218218

219219
await t.test('kw-title names the open database in the tab', () => {
220220
sendMessage({ type: 'kw-title', filename: 'vault.kdbx', locked: true }, { source: frameWin });
221-
assert.equal(doc.title, '🔒 vault.kdbx - Locked - KeePass Web - Local file');
221+
assert.equal(doc.title, 'vault.kdbx - Locked - KeePass Web - Local file');
222222

223223
sendMessage({ type: 'kw-title', filename: 'vault.kdbx', locked: false }, { source: frameWin });
224-
assert.equal(doc.title, '🔓 vault.kdbx - Unlocked - KeePass Web - Local file');
224+
assert.equal(doc.title, 'vault.kdbx - Unlocked - KeePass Web - Local file');
225225

226226
// An app with nothing open reports no filename, leaving this page's own title.
227227
sendMessage({ type: 'kw-title', filename: '', locked: true }, { source: frameWin });

pages/tests/shared-logic.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ const iconHref = (doc: Document): string =>
2424
doc.querySelector('link[rel="icon"]')?.getAttribute('href') ?? '';
2525

2626
test('the title names the database and spells its state out', () => {
27-
assert.equal(tabTitle('KeePass Web', 'vault.kdbx', true), '🔒 vault.kdbx - Locked - KeePass Web');
28-
assert.equal(
29-
tabTitle('KeePass Web', 'vault.kdbx', false),
30-
'🔓 vault.kdbx - Unlocked - KeePass Web',
31-
);
27+
assert.equal(tabTitle('KeePass Web', 'vault.kdbx', true), 'vault.kdbx - Locked - KeePass Web');
28+
assert.equal(tabTitle('KeePass Web', 'vault.kdbx', false), 'vault.kdbx - Unlocked - KeePass Web');
29+
});
30+
31+
test('the title never repeats the state as a padlock glyph', () => {
32+
for (const locked of [true, false]) {
33+
const title = tabTitle('KeePass Web', 'vault.kdbx', locked);
34+
assert.ok(!title.includes('\u{1F512}') && !title.includes('\u{1F513}'), title);
35+
}
3236
});
3337

3438
test('no database means the page keeps its own name', () => {
@@ -41,12 +45,12 @@ test('the icon tracks the lock state and hands the page its own back', () => {
4145

4246
applyTabState(doc, 'Base', 'vault.kdbx', true);
4347
const locked = iconHref(doc);
44-
assert.equal(doc.title, '🔒 vault.kdbx - Locked - Base');
48+
assert.equal(doc.title, 'vault.kdbx - Locked - Base');
4549
assert.notEqual(locked, PAGE_ICON, 'a held database is not the page at rest');
4650

4751
applyTabState(doc, 'Base', 'vault.kdbx', false);
4852
const unlocked = iconHref(doc);
49-
assert.equal(doc.title, '🔓 vault.kdbx - Unlocked - Base');
53+
assert.equal(doc.title, 'vault.kdbx - Unlocked - Base');
5054
assert.notEqual(unlocked, locked, 'and the two states are not the same icon');
5155

5256
// Hue and glyph are what carry at 16px, so the two must differ in both.
@@ -72,6 +76,6 @@ test('a page whose icon link carries no href still gets one back', () => {
7276
test('a page with no icon link is titled anyway, not crashed', () => {
7377
const doc = pageDocument(false);
7478
applyTabState(doc, 'Base', 'vault.kdbx', true);
75-
assert.equal(doc.title, '🔒 vault.kdbx - Locked - Base');
79+
assert.equal(doc.title, 'vault.kdbx - Locked - Base');
7680
assert.equal(doc.querySelector('link[rel="icon"]'), null);
7781
});

0 commit comments

Comments
 (0)