File tree Expand file tree Collapse file tree 4 files changed +17
-8
lines changed
packages/diracx-web-components Expand file tree Collapse file tree 4 files changed +17
-8
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import "dayjs/locale/en-gb"; // Import the locale for dayjs
1010import { TextField , TextFieldProps } from "@mui/material" ;
1111
1212interface CustomDateTimePickerProps
13- extends Omit < DateTimePickerProps < Dayjs > , "value" | "onChange" > {
13+ extends Omit < DateTimePickerProps , "value" | "onChange" > {
1414 value : string | null ;
1515 onDateAccepted : ( value : string | null ) => void ;
1616 handleArrowKeyDown : ( event : KeyboardEvent < HTMLInputElement > ) => void ;
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ interface SearchFieldProps {
3030 setInputValue : React . Dispatch < React . SetStateAction < string > > ;
3131
3232 /** Reference to the input element */
33- inputRef : React . MutableRefObject < HTMLInputElement | null > ;
33+ inputRef : React . RefObject < HTMLInputElement | null > ;
3434
3535 /** The current token equations */
3636 tokenEquations : SearchBarTokenEquation [ ] ;
@@ -360,8 +360,7 @@ export default function SearchField({
360360 inputRef = { ( node ) => {
361361 const r = autoInputProps . ref ;
362362 if ( typeof r === "function" ) r ( node ) ;
363- else if ( r )
364- ( r . current as React . MutableRefObject < HTMLInputElement > ) = node ;
363+ else if ( r ) r . current = node ;
365364 if ( inputRef ) inputRef . current = node ;
366365 } }
367366 inputProps = { {
Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ export function Sunburst({
7373 const finalColorScales = colorScales || defaultColorScale ;
7474
7575 const svgRef = useRef ( null ) ;
76- const tooltipRef : React . MutableRefObject < HTMLDivElement | null > =
76+ const tooltipRef : React . RefObject < HTMLDivElement | null > =
7777 useRef < HTMLDivElement | null > ( null ) ;
7878
7979 const theme = useTheme ( ) ;
Original file line number Diff line number Diff line change @@ -72,13 +72,23 @@ describe("SearchBar", () => {
7272
7373 const searchInput = screen . getByPlaceholderText ( "Enter a category" ) ;
7474
75- // Create a category token
75+ // Create a category token (Status)
7676 await user . type ( searchInput , "Status" ) ;
7777 await user . keyboard ( "{Enter}" ) ;
7878
79- // Check if operator suggestions appear
79+ // Focus operator input
8080 const operatorInput = screen . getByPlaceholderText ( "Enter an operator" ) ;
81- await user . type ( operatorInput , "{downArrow}" ) ;
81+ await user . click ( operatorInput ) ;
82+
83+ // Open the autocomplete popup
84+ await user . keyboard ( "{ArrowDown}" ) ;
85+
86+ // Wait for the listbox to appear (ensures popup is open)
87+ await waitFor ( ( ) => {
88+ expect ( screen . getByRole ( "listbox" ) ) . toBeInTheDocument ( ) ;
89+ } ) ;
90+
91+ // Now expect "=" operator to be one of the suggestions
8292 await waitFor ( ( ) => {
8393 expect ( screen . getByText ( "=" ) ) . toBeInTheDocument ( ) ;
8494 } ) ;
You can’t perform that action at this time.
0 commit comments