diff --git a/extension/src/popup/components/types/__tests__/required-pill.test.ts b/extension/src/popup/components/types/__tests__/required-pill.test.ts new file mode 100644 index 0000000..5bc79d7 --- /dev/null +++ b/extension/src/popup/components/types/__tests__/required-pill.test.ts @@ -0,0 +1,32 @@ +import { describe, it, expect, vi, beforeEach } from 'vitest'; + +vi.mock('../../../../shared/state', () => ({ + sendMessage: vi.fn(), + getState: () => ({ newType: 'login', generatorDefaults: null, error: null, loading: false, vaultSettings: null, entries: [] }), + setState: vi.fn(), + navigate: vi.fn(), + escapeHtml: (s: string) => s, + popOutToTab: vi.fn(), + isInTab: () => false, + openVaultTab: vi.fn(), + registerHost: vi.fn(), +})); + +vi.mock('../../generator-panel', () => ({ + openGeneratorPanel: vi.fn(), + closeGeneratorPanel: vi.fn(), + isGeneratorPanelOpen: () => false, +})); + +import { renderForm } from '../login'; + +describe('required-pill migration', () => { + beforeEach(() => { document.body.innerHTML = '
'; }); + + it('login form title uses the required pill', () => { + renderForm(document.getElementById('app')!, 'add', null); + const titleLabel = document.querySelector('label[for="f-title"]'); + expect(titleLabel?.innerHTML).toContain('required'); + expect(titleLabel?.innerHTML).not.toContain('*'); + }); +}); diff --git a/extension/src/popup/components/types/card.ts b/extension/src/popup/components/types/card.ts index 60fc280..481fa02 100644 --- a/extension/src/popup/components/types/card.ts +++ b/extension/src/popup/components/types/card.ts @@ -2,6 +2,7 @@ /// Detail view has a styled card-silhouette signature block. import { getState, setState, sendMessage, navigate, escapeHtml, popOutToTab } from '../../../shared/state'; +import { REQUIRED_PILL_HTML } from '../../../shared/glyphs'; import type { Item, ItemId, ManifestEntry, CardKind, Section, AttachmentRef } from '../../../shared/types'; import { renderConcealedRow, renderSignatureBlock, wireFieldHandlers, renderSections, @@ -179,7 +180,7 @@ export function renderForm(app: HTMLElement, mode: 'add' | 'edit', existing: Ite ${state.error ? `
${escapeHtml(state.error)}
` : ''} -
+
diff --git a/extension/src/popup/components/types/document.ts b/extension/src/popup/components/types/document.ts index 7a25597..62260df 100644 --- a/extension/src/popup/components/types/document.ts +++ b/extension/src/popup/components/types/document.ts @@ -3,6 +3,7 @@ /// Primary attachment is referenced by ID from the item's attachments array. import { getState, setState, sendMessage, navigate, escapeHtml, popOutToTab } from '../../../shared/state'; +import { REQUIRED_PILL_HTML } from '../../../shared/glyphs'; import type { Item, ItemId, ManifestEntry, Section, AttachmentRef } from '../../../shared/types'; import { renderSectionsEditor, wireSectionsEditor, @@ -91,11 +92,11 @@ export function renderForm(app: HTMLElement, mode: 'add' | 'edit', existing: Ite
${state.error ? `
${escapeHtml(state.error)}
` : ''}
- +
- + ${renderPrimary()}
diff --git a/extension/src/popup/components/types/identity.ts b/extension/src/popup/components/types/identity.ts index 0f5330b..1fb09d6 100644 --- a/extension/src/popup/components/types/identity.ts +++ b/extension/src/popup/components/types/identity.ts @@ -2,6 +2,7 @@ /// Detail view shows a "profile card" signature block + plain rows. import { getState, setState, sendMessage, navigate, escapeHtml, popOutToTab } from '../../../shared/state'; +import { REQUIRED_PILL_HTML } from '../../../shared/glyphs'; import type { Item, ItemId, ManifestEntry, Section, AttachmentRef } from '../../../shared/types'; import { renderRow, renderSignatureBlock, wireFieldHandlers, renderSections, @@ -139,7 +140,7 @@ export function renderForm(app: HTMLElement, mode: 'add' | 'edit', existing: Ite ${state.error ? `
${escapeHtml(state.error)}
` : ''} -
+
diff --git a/extension/src/popup/components/types/key.ts b/extension/src/popup/components/types/key.ts index 50215c9..ec5ce03 100644 --- a/extension/src/popup/components/types/key.ts +++ b/extension/src/popup/components/types/key.ts @@ -3,6 +3,7 @@ /// since diff --git a/extension/src/popup/components/types/login.ts b/extension/src/popup/components/types/login.ts index b0feb52..0d59319 100644 --- a/extension/src/popup/components/types/login.ts +++ b/extension/src/popup/components/types/login.ts @@ -2,6 +2,7 @@ /// field helpers introduced in Slice 2. import { getState, setState, sendMessage, navigate, escapeHtml, popOutToTab, isInTab } from '../../../shared/state'; +import { REQUIRED_PILL_HTML } from '../../../shared/glyphs'; import type { Item, ItemId, LoginCore, ManifestEntry, Section, TotpConfig, AttachmentRef } from '../../../shared/types'; import { DEFAULT_PASSWORD_REQUEST } from '../../../shared/types'; import { base32Decode, base32Encode } from '../../../shared/base32'; @@ -249,7 +250,7 @@ export function renderForm(app: HTMLElement, mode: 'add' | 'edit', existing: Ite
${state.error ? `
${escapeHtml(state.error)}
` : ''} -
+
diff --git a/extension/src/popup/components/types/secure-note.ts b/extension/src/popup/components/types/secure-note.ts index 1ecc788..571c7d3 100644 --- a/extension/src/popup/components/types/secure-note.ts +++ b/extension/src/popup/components/types/secure-note.ts @@ -2,6 +2,7 @@ /// detail view; the form is just a big
diff --git a/extension/src/popup/components/types/totp.ts b/extension/src/popup/components/types/totp.ts index ef5edcb..7e7a2d5 100644 --- a/extension/src/popup/components/types/totp.ts +++ b/extension/src/popup/components/types/totp.ts @@ -3,6 +3,7 @@ /// (TOTP vs Steam Guard) and a single secret input. import { getState, setState, sendMessage, navigate, escapeHtml, popOutToTab } from '../../../shared/state'; +import { REQUIRED_PILL_HTML } from '../../../shared/glyphs'; import type { Item, ItemId, ManifestEntry, Section, TotpKind, AttachmentRef } from '../../../shared/types'; import { base32Decode, base32Encode } from '../../../shared/base32'; import { @@ -218,7 +219,7 @@ export function renderForm(app: HTMLElement, mode: 'add' | 'edit', existing: Ite ${state.error ? `
${escapeHtml(state.error)}
` : ''} -
+
@@ -227,7 +228,7 @@ export function renderForm(app: HTMLElement, mode: 'add' | 'edit', existing: Ite

${formKind === 'steam' ? 'Steam Mobile Authenticator (5-char alphanumeric)' : 'Standard time-based codes (6 digits)'}

-
+