diff --git a/editor.planx.uk/src/lib/featureFlags.ts b/editor.planx.uk/src/lib/featureFlags.ts index de040ae82e..5fd7349747 100644 --- a/editor.planx.uk/src/lib/featureFlags.ts +++ b/editor.planx.uk/src/lib/featureFlags.ts @@ -1,5 +1,5 @@ // add/edit/remove feature flags in array below -const AVAILABLE_FEATURE_FLAGS = ["DATA_ONLY_SEARCH"] as const; +const AVAILABLE_FEATURE_FLAGS = [] as const; type FeatureFlag = (typeof AVAILABLE_FEATURE_FLAGS)[number]; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/Headline.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/Headline.tsx index eb3040999b..f4699110b1 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/Headline.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/Headline.tsx @@ -1,11 +1,11 @@ import Typography from "@mui/material/Typography"; -import React from "react"; +import React, { Fragment } from "react"; import { FONT_WEIGHT_BOLD } from "theme"; interface Props { text: string; matchIndices: [number, number][]; - variant: "data"; + variant?: "data"; } export const Headline: React.FC = ({ text, matchIndices, variant }) => { @@ -15,11 +15,10 @@ export const Headline: React.FC = ({ text, matchIndices, variant }) => { return ( <> {text.split("").map((char, index) => ( - <> + ({ fontWeight: isHighlighted(index) ? FONT_WEIGHT_BOLD : "regular", fontSize: theme.typography.body2.fontSize, @@ -29,7 +28,7 @@ export const Headline: React.FC = ({ text, matchIndices, variant }) => { {/* Add wordbreak after special characters */} {char.match(/\W/) && } - + ))} ); diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchHeader.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchHeader.tsx index cbefedd4a4..0e0aae6fa7 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchHeader.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchHeader.tsx @@ -1,7 +1,6 @@ import Box from "@mui/material/Box"; import CircularProgress from "@mui/material/CircularProgress"; import Typography from "@mui/material/Typography"; -import { hasFeatureFlag } from "lib/featureFlags"; import React, { useEffect } from "react"; import { Components } from "react-virtuoso"; import ChecklistItem from "ui/shared/ChecklistItem"; @@ -66,24 +65,13 @@ export const SearchHeader: Components["Header"] = ({ /> )} - {hasFeatureFlag("DATA_ONLY_SEARCH") ? ( - - ) : ( - - )} + {formik.values.pattern && ( {context?.results.length === 0 && "No matches found"} diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/DataDisplayMap.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/DataDisplayMap.tsx deleted file mode 100644 index 48f55e20ff..0000000000 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/DataDisplayMap.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import { ComponentType, IndexedNode } from "@opensystemslab/planx-core/types"; -import { Calculate } from "@planx/components/Calculate/model"; -import { FileUploadAndLabel } from "@planx/components/FileUploadAndLabel/model"; -import { List } from "@planx/components/List/model"; -import { SearchResult } from "hooks/useSearch"; -import { capitalize, get } from "lodash"; -import { SLUGS } from "pages/FlowEditor/data/types"; -import { useStore } from "pages/FlowEditor/lib/store"; - -interface DataDisplayValues { - displayKey: string; - getIconKey: (result: SearchResult) => ComponentType; - getTitle: (result: SearchResult) => string; - getHeadline: (result: SearchResult) => string; - getComponentType: (result: SearchResult) => string; -} - -/** - * Map of data keys to their associated display values - * Uses Partial as not all values are unique, we later apply defaults - */ -type DataKeyMap = Record>; - -/** - * Map of ComponentTypes to their associated data keys - */ -type ComponentMap = Record; - -/** - * Map of ComponentTypes which need specific overrides in order to display their data values - */ -const DISPLAY_DATA: Partial = { - // Answers are mapped to their parent questions - [ComponentType.Answer]: { - default: { - getIconKey: () => ComponentType.Question, - displayKey: "Option (data)", - getTitle: ({ item }) => { - const parentNode = useStore.getState().flow[item.parentId]; - return parentNode.data?.text; - }, - getHeadline: ({ item, key }) => get(item, key)?.toString(), - }, - }, - // FileUploadAndLabel has data values nested in FileTypes - [ComponentType.FileUploadAndLabel]: { - default: { - displayKey: "File type (data)", - getHeadline: ({ item, refIndex }) => - (item["data"] as unknown as FileUploadAndLabel)["fileTypes"][refIndex][ - "fn" - ], - }, - }, - // Calculate contains both input and output data values - [ComponentType.Calculate]: { - formula: { - displayKey: "Formula", - getHeadline: ({ item }) => (item.data as unknown as Calculate).formula, - }, - "data.output": { - displayKey: "Output (data)", - getHeadline: ({ item }) => (item.data as unknown as Calculate).output, - }, - }, - // List contains data variables nested within its schema - [ComponentType.List]: { - "data.schema.fields.data.fn": { - getHeadline: ({ item, refIndex }) => - (item.data as unknown as List).schema.fields[refIndex].data.fn, - }, - "data.schema.fields.data.options.data.val": { - displayKey: "Option (data)", - getHeadline: ({ item, refIndex }) => { - // Fuse.js flattens deeply nested arrays when using refIndex - const options = (item.data as unknown as List).schema.fields - .filter((field) => field.type === "question") - .flatMap((field) => field.data.options); - return options[refIndex].data.val || ""; - }, - }, - }, -}; - -/** - * Default values for all ComponentTypes not listed in DISPLAY_DATA - */ -const DEFAULT_DISPLAY_DATA: DataDisplayValues = { - displayKey: "Data", - getIconKey: ({ item }) => item.type, - getTitle: ({ item }) => - (item.data?.title as string) || (item.data?.text as string) || "", - getHeadline: ({ item, key }) => get(item, key)?.toString() || "", - getComponentType: ({ item }) => - capitalize(SLUGS[item.type].replaceAll("-", " ")), -}; - -export const getDisplayDetailsForResult = ( - result: SearchResult, -) => { - const componentMap = DISPLAY_DATA[result.item.type]; - const keyMap = componentMap?.[result.key] || componentMap?.default || {}; - - const data: DataDisplayValues = { - ...DEFAULT_DISPLAY_DATA, - ...keyMap, - }; - - return { - iconKey: data.getIconKey(result), - componentType: data.getComponentType(result), - title: data.getTitle(result), - key: data.displayKey, - headline: data.getHeadline(result), - }; -}; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/allFacets.test.ts b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/allFacets.test.ts new file mode 100644 index 0000000000..9958c3b6be --- /dev/null +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/allFacets.test.ts @@ -0,0 +1,99 @@ +import { useStore } from "pages/FlowEditor/lib/store"; + +import { mockFlow } from "../mocks/getDisplayDetailsForResult"; +import { getDisplayDetailsForResult } from "./getDisplayDetailsForResult"; + +type Output = ReturnType; + +// Setup flow so that it can be referenced by SearchResults (e.g. getting parent nodes) +beforeAll(() => useStore.setState({ flow: mockFlow })); + +describe("Basic fields", () => { + it.todo("renders data.text"); + it.todo("renders data.title"); + it.todo("renders data.description"); +}); + +describe("More information fields", () => { + it.todo("renders data.notes"); + it.todo("renders data.howMeasured"); + it.todo("renders data.policyRef"); + it.todo("renders data.info"); +}); + +describe("checklist fields", () => { + it.todo("renders data.categories.title"); +}); + +describe("nextSteps fields", () => { + it.todo("renders data.steps.title"); + it.todo("renders data.steps.description"); + it.todo("renders data.steps.url"); +}); + +describe("fileUploadAndLabel fields", () => { + it.todo("renders data.fileTypes.name"); + it.todo("renders data.fileTypes.moreInformation.notes"); + it.todo("renders data.fileTypes.moreInformation.howMeasured"); + it.todo("renders data.fileTypes.moreInformation.policyRef"); + it.todo("renders data.fileTypes.moreInformation.info"); +}); + +describe("schemaComponents fields", () => { + it.todo("renders data.schema.fields.data.title"); + it.todo("renders data.schema.fields.data.description"); + it.todo("renders data.schema.fields.data.options.data.description"); + it.todo("renders data.schema.fields.data.options.text"); +}); + +describe("taskList fields", () => { + it.todo("renders data.tasks.title"); + it.todo("renders data.tasks.description"); +}); + +// TODO: Flag tests +// const result: SearchFacets = [ +// ...flatFlags.flatMap(({ value }) => [ +// `data.overrides.${value}.heading`, +// `data.overrides.${value}.description`, +// ]), +// ]; + +describe("content fields", () => { + it.todo("renders data.content"); +}); + +describe("confirmation fields", () => { + it.todo("renders data.heading"); + it.todo("renders data.moreInfo"); + it.todo("renders data.contactInfo"); + it.todo("renders data.nextSteps.title"); + it.todo("renders data.nextSteps.description"); +}); + +describe("findProperty fields", () => { + it.todo("renders data.newAddressTitle"); + it.todo("renders data.newAddressDescription"); + it.todo("renders data.newAddressDescriptionLabel"); +}); + +describe("drawBoundary fields", () => { + it.todo("renders data.titleForUploading"); + it.todo("renders data.descriptionForUploading"); +}); + +describe("planningConstraints fields", () => { + it.todo("renders data.disclaimer"); +}); + +describe("pay fields", () => { + it.todo("renders data.bannerTitle"); + it.todo("renders data.instructionsTitle"); + it.todo("renders data.instructionsDescription"); + it.todo("renders data.secondaryPageTitle"); + it.todo("renders data.nomineeTitle"); + it.todo("renders data.nomineeDescription"); + it.todo("renders data.yourDetailsTitle"); + it.todo("renders data.yourDetailsDescription"); + it.todo("renders data.yourDetailsLabel"); +}); diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/DataDisplayMap.test.ts b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/dataFacets.test.ts similarity index 96% rename from editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/DataDisplayMap.test.ts rename to editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/dataFacets.test.ts index d8e07894e3..217a7d3799 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/DataDisplayMap.test.ts +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/dataFacets.test.ts @@ -11,8 +11,8 @@ import { mockListDataResult, mockListRootResult, mockQuestionResult, -} from "../mocks/DataDisplayMap"; -import { getDisplayDetailsForResult } from "./DataDisplayMap"; +} from "../mocks/getDisplayDetailsForResult"; +import { getDisplayDetailsForResult } from "./getDisplayDetailsForResult"; type Output = ReturnType; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/getDisplayDetailsForResult.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/getDisplayDetailsForResult.tsx new file mode 100644 index 0000000000..4d8b3773aa --- /dev/null +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/getDisplayDetailsForResult.tsx @@ -0,0 +1,276 @@ +import { + ComponentType, + flatFlags, + IndexedNode, +} from "@opensystemslab/planx-core/types"; +import { Calculate } from "@planx/components/Calculate/model"; +import { Confirmation } from "@planx/components/Confirmation/model"; +import { FileUploadAndLabel } from "@planx/components/FileUploadAndLabel/model"; +import { List } from "@planx/components/List/model"; +import { NextSteps } from "@planx/components/NextSteps/model"; +import { ChecklistField } from "@planx/components/shared/Schema/model"; +import { TaskList } from "@planx/components/TaskList/model"; +import { SearchResult } from "hooks/useSearch"; +import { capitalize, get } from "lodash"; +import { SLUGS } from "pages/FlowEditor/data/types"; +import { useStore } from "pages/FlowEditor/lib/store"; + +/** + * Functions to map a search result to the fields required by SearchResultCard + */ +interface SearchResultFormatter { + getDisplayKey: (result: SearchResult) => string; + getIconKey: (result: SearchResult) => ComponentType; + getTitle: (result: SearchResult) => string; + getHeadline: (result: SearchResult) => string; + getComponentType: (result: SearchResult) => string; +} + +type KeyMap = Record>; + +type ComponentMap = Partial< + Record> +>; + +const keyFormatters: KeyMap = { + "data.fn": { + getDisplayKey: () => "Data", + }, + "data.val": { + getDisplayKey: () => "Option (data)", + }, + "data.fileTypes.fn": { + getDisplayKey: () => "File type (data)", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as FileUploadAndLabel).fileTypes[refIndex].fn!, + }, + "data.dataFieldBoundary": { + getDisplayKey: () => "Boundary", + }, + "data.dataFieldArea": { + getDisplayKey: () => "Area", + }, + "data.description": { + getDisplayKey: ({ item }) => + item.type === ComponentType.Answer + ? "Option (description)" + : "Description", + }, + "data.notes": { + getDisplayKey: () => "Internal notes", + }, + "data.howMeasured": { + getDisplayKey: () => "How is it defined", + }, + "data.policyRef": { + getDisplayKey: () => "Policy reference", + }, + "data.info": { + getDisplayKey: () => "Why it matters", + }, + "data.steps.title": { + getDisplayKey: () => "Title (step)", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as NextSteps).steps[refIndex].title, + }, + "data.steps.description": { + getDisplayKey: () => "Description (step)", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as NextSteps).steps[refIndex].description, + }, + "data.steps.url": { + getDisplayKey: () => "URL (step)", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as NextSteps).steps[refIndex].url!, + }, + "data.fileTypes.name": { + getDisplayKey: () => "Name (file type)", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as FileUploadAndLabel).fileTypes[refIndex].name, + }, + "data.fileTypes.moreInformation.notes": { + getDisplayKey: () => "Internal notes (file type)", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as FileUploadAndLabel).fileTypes[refIndex] + .moreInformation!.notes!, + }, + "data.fileTypes.moreInformation.howMeasured": { + getDisplayKey: () => "How is it defined (file type)", + }, + "data.fileTypes.moreInformation.policyRef": { + getDisplayKey: () => "Policy reference (file type)", + }, + "data.fileTypes.moreInformation.info": { + getDisplayKey: () => "Why it matters (file type)", + }, + "data.schema.fields.data.description": { + getDisplayKey: () => "Description", + }, + "data.schema.fields.data.options.data.description": { + getDisplayKey: () => "Description", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as ChecklistField).data.options[refIndex].data + .description!, + }, + "data.schema.fields.data.options.text": { + getDisplayKey: () => "Option", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as FileUploadAndLabel).fileTypes[refIndex].name, + }, + "data.tasks.title": { + getDisplayKey: () => "Title", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as TaskList).tasks[refIndex].title, + }, + "data.tasks.description": { + getDisplayKey: () => "Description", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as TaskList).tasks[refIndex].description, + }, + ...Object.fromEntries( + flatFlags.flatMap(({ value }) => [ + [ + `data.overrides.${value}.description`, + { + displayKey: () => "Description", + }, + ], + ]), + ), + "data.content": { + getDisplayKey: () => "Content", + }, + "data.moreInfo": { + getDisplayKey: () => "More information", + }, + "data.contactInfo": { + getDisplayKey: () => "Contact information", + }, + "data.nextSteps.title": { + getDisplayKey: () => "Title (next steps)", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as Confirmation).nextSteps![refIndex].title, + }, + "data.nextSteps.description": { + getDisplayKey: () => "Description", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as Confirmation).nextSteps![refIndex].description, + }, + "data.newAddressTitle": { + getDisplayKey: () => "Title (new address)", + }, + "data.newAddressDescription": { + getDisplayKey: () => "Description (new address)", + }, + "data.newAddressDescriptionLabel": { + getDisplayKey: () => "Description label (new address)", + }, + "data.titleForUploading": { + getDisplayKey: () => "Title for uploading", + }, + "data.descriptionForUploading": { + getDisplayKey: () => "Description for uploading", + }, + "data.disclaimer": { + getDisplayKey: () => "Disclaimer", + }, + "data.bannerTitle": { + getDisplayKey: () => "Banner title", + }, + "data.instructionsTitle": { + getDisplayKey: () => "Instructions title", + }, + "data.instructionsDescription": { + getDisplayKey: () => "Instructions description", + }, + "data.secondaryPageTitle": { + getDisplayKey: () => "Secondary page title", + }, + "data.nomineeTitle": { + getDisplayKey: () => "Nominee title", + }, + "data.nomineeDescription": { + getDisplayKey: () => "Nominee description", + }, + "data.yourDetailsTitle": { + getDisplayKey: () => "Your details title", + }, + "data.yourDetailsDescription": { + getDisplayKey: () => "Your details description", + }, + "data.yourDetailsLabel": { + getDisplayKey: () => "Your details label", + }, + // Calculate contains both input and output data values + formula: { + getDisplayKey: () => "Formula", + getHeadline: ({ item }) => (item.data as unknown as Calculate).formula, + }, + "data.output": { + getDisplayKey: () => "Output (data)", + getHeadline: ({ item }) => (item.data as unknown as Calculate).output, + }, + // List contains data variables nested within its schema + "data.schema.fields.data.fn": { + getDisplayKey: () => "Data", + getHeadline: ({ item, refIndex }) => + (item.data as unknown as List).schema.fields[refIndex].data.fn, + }, + "data.schema.fields.data.options.data.val": { + getDisplayKey: () => "Option (data)", + getHeadline: ({ item, refIndex }) => { + // Fuse.js flattens deeply nested arrays when using refIndex + const options = (item.data as unknown as List).schema.fields + .filter((field) => field.type === "question") + .flatMap((field) => field.data.options); + return options[refIndex].data.val || ""; + }, + }, +}; + +const componentFormatters: ComponentMap = { + // Answers are mapped to their parent questions + [ComponentType.Answer]: { + getDisplayKey: () => "Option (title)", + getIconKey: () => ComponentType.Question, + getTitle: ({ item }) => { + const parentNode = useStore.getState().flow[item.parentId]; + return parentNode.data?.text; + }, + }, +}; + +/** + * Default formatters for any fields not already covered by key or component-specific formatters + */ +const defaultFormatter: SearchResultFormatter = { + getDisplayKey: () => "Title", + getIconKey: ({ item }) => item.type, + getTitle: ({ item }) => + (item.data?.title as string) || (item.data?.text as string) || "", + getHeadline: ({ item, key }) => get(item, key)?.toString() || "", + getComponentType: ({ item }) => + capitalize(SLUGS[item.type].replaceAll("-", " ")), +}; + +/** + * Formats a search result for display in the SearchResultCard + * The values are combined in order of precedence: key-specific, component-specific, then defaults + */ +export const getDisplayDetailsForResult = ( + result: SearchResult, +) => { + const formatter: SearchResultFormatter = { + ...defaultFormatter, + ...componentFormatters[result.item.type], + ...keyFormatters[result.key], + }; + + return { + iconKey: formatter.getIconKey(result), + componentType: formatter.getComponentType(result), + title: formatter.getTitle(result), + key: formatter.getDisplayKey(result), + headline: formatter.getHeadline(result), + }; +}; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/index.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/index.tsx index 6f5eb717e7..bece50805c 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/index.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/SearchResultCard/index.tsx @@ -10,8 +10,9 @@ import React from "react"; import { useNavigation } from "react-navi"; import { FONT_WEIGHT_SEMI_BOLD } from "theme"; +import { DATA_FACETS } from "../facets"; import { Headline } from "../Headline"; -import { getDisplayDetailsForResult } from "./DataDisplayMap"; +import { getDisplayDetailsForResult } from "./getDisplayDetailsForResult"; const SearchResultCardRoot = styled(ListItemButton, { shouldForwardProp: (prop) => prop !== "portalId", @@ -69,6 +70,9 @@ export const SearchResultCard: React.FC<{ navigate(url); }; + const isDataKey = DATA_FACETS.includes(result.key); + const headlineVariant = isDataKey ? "data" : undefined; + return ( {portalId && } @@ -108,7 +112,7 @@ export const SearchResultCard: React.FC<{ diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/facets.ts b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/facets.ts index 219a378177..134138dfb6 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/facets.ts +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/facets.ts @@ -57,17 +57,17 @@ const nextSteps: SearchFacets = [ const fileUploadAndLabel: SearchFacets = [ "data.fileTypes.name", - "data.fileTypes.notes", - "data.fileTypes.howMeasured", - "data.fileTypes.policyRef", - "data.fileTypes.info", + "data.fileTypes.moreInformation.notes", + "data.fileTypes.moreInformation.howMeasured", + "data.fileTypes.moreInformation.policyRef", + "data.fileTypes.moreInformation.info", ]; /** List, Page, and MapAndLabel components share this structure */ const schemaComponents: SearchFacets = [ "data.schema.fields.data.title", "data.schema.fields.data.description", - "data.schema.fields.data.options.description", + "data.schema.fields.data.options.data.description", "data.schema.fields.data.options.text", ]; diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/index.test.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/index.test.tsx index 764f16ad71..6501ae59b1 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/index.test.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/index.test.tsx @@ -35,7 +35,7 @@ vi.mock("@opensystemslab/planx-core", async (originalModule) => { }; }); -test("data field checkbox is checked and disabled", () => { +test("data field checkbox is unchecked and enabled by default", () => { const { getByLabelText } = setup( @@ -44,8 +44,8 @@ test("data field checkbox is checked and disabled", () => { const checkbox = getByLabelText("Search only data fields"); expect(checkbox).toBeInTheDocument(); - expect(checkbox).toBeChecked(); - expect(checkbox).toBeDisabled(); + expect(checkbox).not.toBeChecked(); + expect(checkbox).not.toBeDisabled(); }); test("entering a search term displays a series of cards", async () => { diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/mocks/DataDisplayMap.ts b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/mocks/getDisplayDetailsForResult.ts similarity index 100% rename from editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/mocks/DataDisplayMap.ts rename to editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Search/mocks/getDisplayDetailsForResult.ts