@@ -15,28 +15,25 @@ test.describe('GeoJSON Query Response', () => {
1515 test . afterAll ( async function ( ) {
1616 await context . close ( ) ;
1717 } ) ;
18- test ( 'Query returns features from all three GeoJSON extents' , async ( ) => {
18+ test ( 'Query returns features from all four GeoJSON extents' , async ( ) => {
1919 await page . click ( 'mapml-viewer' ) ;
2020 const popupContainer = page . locator ( '.mapml-popup-content > iframe' ) ;
2121 await expect ( popupContainer ) . toBeVisible ( ) ;
2222 const popupFeatureCount = page . locator ( '.mapml-feature-count' ) ;
23- await expect ( popupFeatureCount ) . toHaveText ( '1/3 ' , { useInnerText : true } ) ;
23+ await expect ( popupFeatureCount ) . toHaveText ( '1/4 ' , { useInnerText : true } ) ;
2424 } ) ;
2525 test ( 'Standard CRS:84 GeoJSON feature has cs meta set to gcrs' , async ( ) => {
2626 // The first feature comes from the CRS:84 extent (geojsonFeature)
2727 // Its meta should have cs=gcrs since coordinates are standard lon/lat
2828 let csMeta = await page . evaluate ( ( ) => {
29- let layer =
30- document . querySelector ( 'mapml-viewer' ) . layers [ 0 ] . _layer ;
29+ let layer = document . querySelector ( 'mapml-viewer' ) . layers [ 0 ] . _layer ;
3130 let features = layer . _mapmlFeatures ;
3231 // find the feature from CRS:84 response (the polygon from geojsonFeature)
3332 let f = features . find (
3433 ( feat ) => feat . querySelector ( 'map-polygon' ) !== null
3534 ) ;
3635 if ( f && f . meta ) {
37- let cs = f . meta . find (
38- ( m ) => m . getAttribute ( 'name' ) === 'cs'
39- ) ;
36+ let cs = f . meta . find ( ( m ) => m . getAttribute ( 'name' ) === 'cs' ) ;
4037 return cs ? cs . getAttribute ( 'content' ) : null ;
4138 }
4239 return null ;
@@ -47,18 +44,15 @@ test.describe('GeoJSON Query Response', () => {
4744 // The feature from geojsonProjectedWithCrs has a "crs" member
4845 // Its meta should have cs=pcrs
4946 let csMeta = await page . evaluate ( ( ) => {
50- let layer =
51- document . querySelector ( 'mapml-viewer' ) . layers [ 0 ] . _layer ;
47+ let layer = document . querySelector ( 'mapml-viewer' ) . layers [ 0 ] . _layer ;
5248 let features = layer . _mapmlFeatures ;
5349 // find the feature with properties containing "Test Point with CRS"
5450 let f = features . find ( ( feat ) => {
5551 let props = feat . querySelector ( 'map-properties' ) ;
5652 return props && props . innerHTML . includes ( 'Test Point with CRS' ) ;
5753 } ) ;
5854 if ( f && f . meta ) {
59- let cs = f . meta . find (
60- ( m ) => m . getAttribute ( 'name' ) === 'cs'
61- ) ;
55+ let cs = f . meta . find ( ( m ) => m . getAttribute ( 'name' ) === 'cs' ) ;
6256 return cs ? cs . getAttribute ( 'content' ) : null ;
6357 }
6458 return null ;
@@ -69,24 +63,43 @@ test.describe('GeoJSON Query Response', () => {
6963 // The feature from geojsonProjectedNoCrs has large coordinate values
7064 // but no "crs" member — the magnitude heuristic should detect this
7165 let csMeta = await page . evaluate ( ( ) => {
72- let layer =
73- document . querySelector ( 'mapml-viewer' ) . layers [ 0 ] . _layer ;
66+ let layer = document . querySelector ( 'mapml-viewer' ) . layers [ 0 ] . _layer ;
7467 let features = layer . _mapmlFeatures ;
7568 // find the feature with properties containing "Test Point projected no CRS"
7669 let f = features . find ( ( feat ) => {
7770 let props = feat . querySelector ( 'map-properties' ) ;
78- return (
79- props && props . innerHTML . includes ( 'Test Point projected no CRS' )
80- ) ;
71+ return props && props . innerHTML . includes ( 'Test Point projected no CRS' ) ;
8172 } ) ;
8273 if ( f && f . meta ) {
83- let cs = f . meta . find (
84- ( m ) => m . getAttribute ( 'name' ) === 'cs'
85- ) ;
74+ let cs = f . meta . find ( ( m ) => m . getAttribute ( 'name' ) === 'cs' ) ;
8675 return cs ? cs . getAttribute ( 'content' ) : null ;
8776 }
8877 return null ;
8978 } ) ;
9079 expect ( csMeta ) . toBe ( 'pcrs' ) ;
9180 } ) ;
81+ test ( 'GeoJSON with null geometry is processed via geojson2mapml with synthesized click-point geometry' , async ( ) => {
82+ // The feature from geojsonNullGeometry has geometry: null
83+ // It should still be processed by geojson2mapml (properties as table)
84+ // with a synthesized point geometry at the click location
85+ let result = await page . evaluate ( ( ) => {
86+ let layer = document . querySelector ( 'mapml-viewer' ) . layers [ 0 ] . _layer ;
87+ let features = layer . _mapmlFeatures ;
88+ // find the feature with properties containing "PIEN"
89+ let f = features . find ( ( feat ) => {
90+ let props = feat . querySelector ( 'map-properties' ) ;
91+ return props && props . innerHTML . includes ( 'PIEN' ) ;
92+ } ) ;
93+ if ( ! f ) return { found : false } ;
94+ // check that properties are rendered as a table (geojson2mapml default)
95+ let props = f . querySelector ( 'map-properties' ) ;
96+ let hasTable = props . querySelector ( 'table' ) !== null ;
97+ // check that a point geometry was synthesized
98+ let hasPoint = f . querySelector ( 'map-geometry map-point' ) !== null ;
99+ return { found : true , hasTable : hasTable , hasPoint : hasPoint } ;
100+ } ) ;
101+ expect ( result . found ) . toBe ( true ) ;
102+ expect ( result . hasTable ) . toBe ( true ) ;
103+ expect ( result . hasPoint ) . toBe ( true ) ;
104+ } ) ;
92105} ) ;
0 commit comments