@@ -28,9 +28,6 @@ const sampleData = [
2828] ;
2929const getPanel = ( ) => document . querySelector ( ".p-search-and-filter__panel" ) ;
3030
31- const getSearchContainer = ( ) =>
32- document . querySelector ( ".p-search-and-filter__search-container" ) ;
33-
3431describe ( "Search and filter" , ( ) => {
3532 it ( "renders" , async ( ) => {
3633 const returnSearchData = jest . fn ( ) ;
@@ -155,14 +152,27 @@ describe("Search and filter", () => {
155152 returnSearchData = { returnSearchData }
156153 /> ,
157154 ) ;
158- expect ( getSearchContainer ( ) ) . toHaveAttribute ( "aria-expanded" , "false" ) ;
159155 await userEvent . click (
160156 screen . getByRole ( "searchbox" , { name : Label . SearchAndFilter } ) ,
161157 ) ;
162158 await userEvent . click ( screen . getByRole ( "button" , { name : "us-east1" } ) ) ;
163- await userEvent . click ( screen . getByRole ( "button" , { name : "+1" } ) ) ;
159+ const counter = screen . getByRole ( "button" , { name : "+1" } ) ;
160+ await userEvent . click ( counter ) ;
164161
165- expect ( getSearchContainer ( ) ) . toHaveAttribute ( "aria-expanded" , "true" ) ;
162+ // After expanding, the container should indicate it is expanded.
163+ expect (
164+ document . querySelector ( ".p-search-and-filter__search-container" ) ,
165+ ) . toHaveAttribute ( "data-expanded" , "true" ) ;
166+
167+ expect (
168+ screen . getByRole ( "button" , { name : "us-east1" } ) ,
169+ ) . toBeInTheDocument ( ) ;
170+ expect (
171+ screen . getByRole ( "button" , { name : "us-east2" } ) ,
172+ ) . toBeInTheDocument ( ) ;
173+ expect (
174+ screen . getByRole ( "button" , { name : "us-east3" } ) ,
175+ ) . toBeInTheDocument ( ) ;
166176 } ) ;
167177
168178 it ( "search prompt appears when search field has search term" , async ( ) => {
@@ -388,7 +398,7 @@ describe("Search and filter", () => {
388398 // Dismiss the Cloud: Google filter chip
389399 const cloudChip : HTMLElement = screen . getByText ( "CLOUD" ) . closest ( ".p-chip" ) ;
390400 const dismissButton = within ( cloudChip ) . getByRole ( "button" , {
391- name : "Dismiss" ,
401+ name : "Dismiss Google " ,
392402 } ) ;
393403 await userEvent . click ( dismissButton ) ;
394404
0 commit comments