@@ -128,6 +128,75 @@ class QueryFeaturesSystemTest < ApplicationSystemTestCase
128128 end
129129 end
130130
131+ test "sorts enclosing features correctly with multiple bboxes across antimeridian" do
132+ visit "/#map=15/-16.155/179.995"
133+
134+ within "#map" do
135+ click_on "Query features"
136+
137+ stub_overpass :enclosing_elements => [
138+ {
139+ "type" => "relation" ,
140+ "id" => 571747 ,
141+ "bounds" => {
142+ "minlat" => -21.9434274 ,
143+ "minlon" => 174.4214965 ,
144+ "maxlat" => -12.2613866 ,
145+ "maxlon" => -178.0034928
146+ } ,
147+ "tags" => {
148+ "admin_level" => "2" ,
149+ "boundary" => "administrative" ,
150+ "name" => "Viti" ,
151+ "name:en" => "Fiji" ,
152+ "name:fj" => "Viti" ,
153+ "type" => "boundary"
154+ }
155+ } ,
156+ {
157+ "type" => "relation" ,
158+ "id" => 2325025 ,
159+ "bounds" => {
160+ "minlat" => -17.0160140 ,
161+ "minlon" => 178.4754914 ,
162+ "maxlat" => -16.1243512 ,
163+ "maxlon" => -179.6630100
164+ } ,
165+ "tags" => {
166+ "name" => "Vanua Levu Group" ,
167+ "place" => "archipelago" ,
168+ "type" => "multipolygon" ,
169+ "wikidata" => "Q2756586"
170+ }
171+ } ,
172+ {
173+ "type" => "relation" ,
174+ "id" => 4097003 ,
175+ "bounds" => {
176+ "minlat" => -17.0160140 ,
177+ "minlon" => 178.4754914 ,
178+ "maxlat" => -16.1243512 ,
179+ "maxlon" => -179.9513876
180+ } ,
181+ "tags" => {
182+ "name" => "Vanua Levu" ,
183+ "place" => "island" ,
184+ "type" => "multipolygon" ,
185+ "wikidata" => "Q327733"
186+ }
187+ }
188+ ]
189+
190+ click
191+ end
192+
193+ within_sidebar do
194+ assert_link "Vanua Levu"
195+ assert_link "Vanua Levu Group" , :below => find_link ( "Vanua Levu" )
196+ assert_link "Fiji" , :below => find_link ( "Vanua Levu Group" )
197+ end
198+ end
199+
131200 private
132201
133202 def stub_overpass ( nearby_elements : [ ] , enclosing_elements : [ ] )
0 commit comments