@@ -3,8 +3,6 @@ import { useAllRoutes } from 'src/hooks/useAllRoutes'
33import i18n from 'src/locale/allTranslations'
44import LineSelector from './LineSelector'
55
6- // Keep the real API client / gtfsService out of the test: LineSelector only
7- // reads `line` and `suffix` off each route, so a mocked hook is enough.
86vi . mock ( 'src/hooks/useAllRoutes' , ( ) => ( { useAllRoutes : vi . fn ( ) } ) )
97const mockUseAllRoutes = vi . mocked ( useAllRoutes )
108
@@ -26,7 +24,6 @@ const route = (line: number, suffix = ''): RouteItem => ({
2624 routeKey : `${ line } ${ suffix } -key` ,
2725} )
2826
29- // useAllRoutes already returns routes sorted by line number; mirror that here.
3027const setRoutes = ( routes : RouteItem [ ] , isLoading = false ) =>
3128 mockUseAllRoutes . mockReturnValue ( { routes, isLoading, error : false } )
3229
@@ -80,7 +77,7 @@ describe('LineSelector', () => {
8077 fireEvent . change ( screen . getByRole ( 'combobox' , { name : LINE_LABEL } ) , {
8178 target : { value : '42' } ,
8279 } )
83- expect ( setLineNumber ) . not . toHaveBeenCalled ( ) // debounced, not immediate
80+ expect ( setLineNumber ) . not . toHaveBeenCalled ( )
8481
8582 act ( ( ) => {
8683 vi . advanceTimersByTime ( DEBOUNCE_MS )
@@ -92,20 +89,15 @@ describe('LineSelector', () => {
9289 setRoutes ( [ route ( 1 ) ] )
9390 renderSelector ( )
9491
95- // `MuiAutocomplete-inputRoot` carries the compact vertical padding that keeps
96- // this field the same height as the other selectors — its absence was the
97- // 74px-vs-56px regression. `forcePopupIcon` keeps the dropdown arrow so it
98- // looks like OperatorSelector / RouteSelector rather than a bare text field.
92+ // `MuiAutocomplete-inputRoot` keeps this field the same height as the other selectors.
9993 expect (
10094 screen . getByRole ( 'combobox' , { name : LINE_LABEL } ) . closest ( AUTOCOMPLETE_INPUT_ROOT ) ,
10195 ) . not . toBeNull ( )
10296 expect ( screen . getByRole ( 'button' , { name : OPEN_BUTTON } ) ) . toBeInTheDocument ( )
10397 } )
10498
10599 it ( 'tags the clear button with the `clear-indicator` class the e2e helper relies on' , ( ) => {
106- // The `clearInputField` Playwright helper (clearButton.spec.ts) finds the
107- // clear button by the repo-wide `.clear-indicator` class. MUI's built-in
108- // clear indicator only renders once the field has a value to clear.
100+ // MUI only renders its clear indicator once the field has a value to clear.
109101 setRoutes ( [ route ( 5 ) ] )
110102 renderSelector ( { lineNumber : '5' } )
111103
0 commit comments