mirror of
https://github.com/Sea-Haven-Industries/shoc-frontend-new.git
synced 2026-10-03 08:03:22 +00:00
fix(work-orders): make service picker search placeholder type-neutral
This commit is contained in:
parent
71756ca3a5
commit
824001dc5e
3 changed files with 58 additions and 2 deletions
|
|
@ -39,7 +39,7 @@ export function PmTypePickerPopover({
|
|||
autoFocus
|
||||
value={search}
|
||||
onChange={(e) => onSearchChange(e.target.value)}
|
||||
placeholder="Search PM type…"
|
||||
placeholder="Search service…"
|
||||
className="w-full rounded border border-border bg-[var(--color-bg-surface)] px-2 py-1 text-xs text-[var(--color-text-primary)] focus:outline-none"
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ export function WizardStepLocationServiceSelect({
|
|||
icon={
|
||||
<Droplets size={16} className="shrink-0" style={{ color: "var(--muted-foreground)" }} />
|
||||
}
|
||||
searchPlaceholder="Search PM type…"
|
||||
searchPlaceholder="Search services…"
|
||||
options={services.map((s) => {
|
||||
const Icon = getPmTypeIcon(s.value);
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
import { fireEvent, render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { WizardStepLocationServiceSelect } from "@/app/(protected)/workorders/_components/wizard/wizard-step-location-service-select";
|
||||
import { PmTypePickerPopover } from "@/app/(protected)/workorders/_components/list/table/cells/pm-type-picker-popover";
|
||||
import {
|
||||
EMPTY_WIZARD_DRAFT,
|
||||
type WorkOrderWizardDraft,
|
||||
} from "@/domain/work-orders/types/work-order-wizard";
|
||||
|
||||
describe("service picker search placeholder", () => {
|
||||
it("uses a type-neutral search placeholder in the wizard service picker", () => {
|
||||
const draft: WorkOrderWizardDraft = { ...EMPTY_WIZARD_DRAFT, pm: "" };
|
||||
|
||||
render(
|
||||
<WizardStepLocationServiceSelect
|
||||
draft={draft}
|
||||
services={[
|
||||
{ id: "1", value: "HVAC" },
|
||||
{ id: "2", value: "Plumbing" },
|
||||
]}
|
||||
svcOpen={false}
|
||||
onSvcOpenChange={vi.fn()}
|
||||
svcSearch=""
|
||||
onSvcSearchChange={vi.fn()}
|
||||
onUpdate={vi.fn()}
|
||||
onPatch={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: /select service/i }));
|
||||
|
||||
expect(screen.getByPlaceholderText("Search services…")).toBeTruthy();
|
||||
expect(screen.queryByPlaceholderText("Search PM type…")).toBeNull();
|
||||
});
|
||||
|
||||
it("uses a type-neutral search placeholder in the table service picker popover", () => {
|
||||
const anchor = document.createElement("button");
|
||||
|
||||
render(
|
||||
<PmTypePickerPopover
|
||||
anchorEl={anchor}
|
||||
search=""
|
||||
filtered={["HVAC", "Plumbing"]}
|
||||
value=""
|
||||
showAddDetails={false}
|
||||
onSearchChange={vi.fn()}
|
||||
onClose={vi.fn()}
|
||||
onPick={vi.fn()}
|
||||
onAddDetails={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByPlaceholderText("Search service…")).toBeTruthy();
|
||||
expect(screen.queryByPlaceholderText("Search PM type…")).toBeNull();
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Reference in a new issue