diff --git a/components/calendar/__tests__/participant-input.test.tsx b/components/calendar/__tests__/participant-input.test.tsx new file mode 100644 index 000000000..37cab600a --- /dev/null +++ b/components/calendar/__tests__/participant-input.test.tsx @@ -0,0 +1,21 @@ +import { render, screen } from '@testing-library/react'; +import { describe, expect, it, vi } from 'vitest'; +import React from 'react'; + +vi.mock('@/components/ui/avatar', () => ({ Avatar: () => null })); +vi.mock('@/stores/contact-store', () => { + const state = { contacts: [], getAutocomplete: () => [] }; + const hook = (sel?: (s: typeof state) => unknown) => (typeof sel === 'function' ? sel(state) : state); + hook.getState = () => state; + return { useContactStore: hook }; +}); + +const { ParticipantInput } = await import('../participant-input'); + +describe('ParticipantInput', () => { + it('is a search field, which Bitwarden never offers to fill', () => { + // Bitwarden offered saved logins for the e-mail placeholder. + render(); + expect(screen.getByRole('combobox')).toHaveAttribute('type', 'search'); + }); +}); diff --git a/components/calendar/participant-input.tsx b/components/calendar/participant-input.tsx index 83a8031ae..4c7d8ffef 100644 --- a/components/calendar/participant-input.tsx +++ b/components/calendar/participant-input.tsx @@ -115,8 +115,14 @@ export const ParticipantInput = forwardRef + {/* type="search": Bitwarden skips search fields unconditionally and + otherwise offered logins for the e-mail placeholder. */} handleInputChange(e.target.value)} onKeyDown={handleKeyDown} @@ -136,7 +142,10 @@ export const ParticipantInput = forwardRef {suggestions.map((s, i) => (