@@ -395,6 +395,11 @@ const generateMockedProps = (
395395 } ;
396396} ;
397397
398+ // Matches the antd Select's rendered selection, whether it renders as
399+ // content (single/tag mode) or as a selection item (default mode).
400+ const selectedValueSelector = ( title : string ) =>
401+ `.ant-select-content-has-value[title="${ title } "], .ant-select-selection-item[title="${ title } "]` ;
402+
398403// combobox selector for mocking user input
399404const comboboxSelect = async (
400405 element : HTMLElement ,
@@ -1889,7 +1894,7 @@ test('filter reappears in dropdown after clearing with X icon', async () => {
18891894
18901895 await waitFor ( ( ) => {
18911896 const selectionItem = document . querySelector (
1892- '.ant-select-content-has-value[title=" Test Filter 1"], .ant-select-selection-item[title="Test Filter 1"]' ,
1897+ selectedValueSelector ( ' Test Filter 1' ) ,
18931898 ) ;
18941899 expect ( selectionItem ) . toBeInTheDocument ( ) ;
18951900 } ) ;
@@ -1911,7 +1916,7 @@ test('filter reappears in dropdown after clearing with X icon', async () => {
19111916
19121917 await waitFor ( ( ) => {
19131918 const selectionItem = document . querySelector (
1914- '.ant-select-content-has-value[title=" Test Filter 1"], .ant-select-selection-item[title="Test Filter 1"]' ,
1919+ selectedValueSelector ( ' Test Filter 1' ) ,
19151920 ) ;
19161921 expect ( selectionItem ) . not . toBeInTheDocument ( ) ;
19171922 } ) ;
@@ -2430,15 +2435,13 @@ test('edit mode shows friendly filter names instead of raw IDs', async () => {
24302435
24312436 await waitFor ( ( ) => {
24322437 const selectionItem = document . querySelector (
2433- '.ant-select-content-has-value[title=" Country"], .ant-select-selection-item[title="Country"]' ,
2438+ selectedValueSelector ( ' Country' ) ,
24342439 ) ;
24352440 expect ( selectionItem ) . toBeInTheDocument ( ) ;
24362441 } ) ;
24372442
24382443 expect (
2439- document . querySelector (
2440- '.ant-select-content-has-value[title="NATIVE_FILTER-abc123"], .ant-select-selection-item[title="NATIVE_FILTER-abc123"]' ,
2441- ) ,
2444+ document . querySelector ( selectedValueSelector ( 'NATIVE_FILTER-abc123' ) ) ,
24422445 ) . not . toBeInTheDocument ( ) ;
24432446} ) ;
24442447
@@ -2457,7 +2460,7 @@ test('edit mode falls back to raw ID when filterName is missing', async () => {
24572460
24582461 await waitFor ( ( ) => {
24592462 const selectionItem = document . querySelector (
2460- '.ant-select-content-has-value[title=" NATIVE_FILTER-xyz789"], .ant-select-selection-item[title="NATIVE_FILTER-xyz789"]' ,
2463+ selectedValueSelector ( ' NATIVE_FILTER-xyz789' ) ,
24612464 ) ;
24622465 expect ( selectionItem ) . toBeInTheDocument ( ) ;
24632466 } ) ;
@@ -2564,9 +2567,7 @@ test('selecting filter triggers chart data request with correct params', async (
25642567
25652568 // Select the Country Filter using comboboxSelect pattern
25662569 await comboboxSelect ( filterDropdown , 'Country Filter' , ( ) =>
2567- document . querySelector (
2568- '.ant-select-content-has-value[title="Country Filter"], .ant-select-selection-item[title="Country Filter"]' ,
2569- ) ,
2570+ document . querySelector ( selectedValueSelector ( 'Country Filter' ) ) ,
25702571 ) ;
25712572
25722573 // getChartDataRequest should have been called for filter values
@@ -2615,9 +2616,7 @@ test('selected filter excluded from other row dropdowns', async () => {
26152616
26162617 // Select Country Filter in row 1
26172618 await comboboxSelect ( filterDropdown , 'Country Filter' , ( ) =>
2618- document . querySelector (
2619- '.ant-select-content-has-value[title="Country Filter"], .ant-select-selection-item[title="Country Filter"]' ,
2620- ) ,
2619+ document . querySelector ( selectedValueSelector ( 'Country Filter' ) ) ,
26212620 ) ;
26222621
26232622 // Wait for getChartDataRequest to complete AND state update to propagate.
0 commit comments