@@ -55,4 +55,70 @@ describe('Compass GlobalWrites Plugin', function () {
5555 expect ( within ( rows [ 2 ] ) . getByText ( 'Germany - Berlin (DE-BE)' ) ) . to . be . visible ;
5656 expect ( within ( rows [ 2 ] ) . getByText ( 'EMEA (Frankfurt)' ) ) . to . be . visible ;
5757 } ) ;
58+
59+ it ( 'allows top level search' , function ( ) {
60+ render (
61+ < ShardZonesTable
62+ shardZones = { [
63+ ...shardZones ,
64+ {
65+ zoneId : '438908' ,
66+ country : 'Slovakia' ,
67+ readableName : 'Slovakia' ,
68+ isoCode : 'SK' ,
69+ typeOneIsoCode : 'SK' ,
70+ zoneName : 'Zone 2' ,
71+ zoneLocations : [ 'Location 2' ] ,
72+ } ,
73+ ] }
74+ />
75+ ) ;
76+
77+ const searchInput = screen . getByLabelText ( 'Search for a location' ) ;
78+ expect ( searchInput ) . to . be . visible ;
79+ userEvent . type ( searchInput , 'Slo' ) ;
80+ const rows = screen . getAllByRole ( 'row' ) ;
81+ expect ( rows ) . to . have . lengthOf ( 2 ) ; // 1 header, 1 item
82+ expect ( within ( rows [ 1 ] ) . getByText ( 'Slovakia (SK)' ) ) . to . be . visible ;
83+ expect ( within ( rows [ 1 ] ) . getByText ( 'Zone 2 (Location 2)' ) ) . to . be . visible ;
84+ } ) ;
85+
86+ it ( 'allows subZone search' , function ( ) {
87+ render (
88+ < ShardZonesTable
89+ shardZones = { [
90+ ...shardZones ,
91+ {
92+ zoneId : '4389048' ,
93+ country : 'Slovakia' ,
94+ readableName : 'Slovakia' ,
95+ isoCode : 'SK' ,
96+ typeOneIsoCode : 'SK' ,
97+ zoneName : 'Zone 2' ,
98+ zoneLocations : [ 'Location 2' ] ,
99+ } ,
100+ {
101+ zoneId : '8908900' ,
102+ country : 'Slovakia' ,
103+ readableName : 'Slovakia - Bratislava' ,
104+ isoCode : 'SK-BA' ,
105+ typeOneIsoCode : 'SK' ,
106+ zoneName : 'Zone 2' ,
107+ zoneLocations : [ 'Location 2' ] ,
108+ } ,
109+ ] }
110+ />
111+ ) ;
112+
113+ const searchInput = screen . getByLabelText ( 'Search for a location' ) ;
114+ expect ( searchInput ) . to . be . visible ;
115+ userEvent . type ( searchInput , 'Bra' ) ;
116+ const rows = screen . getAllByRole ( 'row' ) ;
117+ expect ( rows ) . to . have . lengthOf ( 3 ) ; // 1 header, 2 items
118+ expect ( within ( rows [ 1 ] ) . getByText ( 'Slovakia (SK)' ) ) . to . be . visible ;
119+ expect ( within ( rows [ 1 ] ) . getByText ( 'Zone 2 (Location 2)' ) ) . to . be . visible ;
120+ expect ( within ( rows [ 2 ] ) . getByText ( 'Slovakia - Bratislava (SK-BA)' ) ) . to . be
121+ . visible ;
122+ expect ( within ( rows [ 2 ] ) . getByText ( 'Zone 2 (Location 2)' ) ) . to . be . visible ;
123+ } ) ;
58124} ) ;
0 commit comments