Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function parseFeatureInfoPosition(urlParamValue?: string): FeatureInfoPositions

const featureInfoParamConfig = new UrlParamConfig<string>({
urlParamName: 'featureInfo',
actionsToWatch: ['setFeatureInfoPosition'],
actionsToWatch: ['setFeatureInfoPosition', 'clearAllSelectedFeatures'],
extractValueFromStore: () => useUIStore().featureInfoPosition,
setValuesInStore: (_: RouteLocationNormalizedGeneric, urlParamValue?: string) => {
const position = parseFeatureInfoPosition(urlParamValue)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export function createLayerObject(parsedLayer: Partial<Layer>, currentLayer?: La
layer.opacity = parsedLayer.opacity ?? DEFAULT_OPACITY

if (adminId && layer.type === LayerType.KML) {
;(layer as KMLLayer).adminId = adminId
; (layer as KMLLayer).adminId = adminId
}
} else if (parsedLayer.type === LayerType.KML) {
// format is KML|FILE_URL
Expand Down Expand Up @@ -184,7 +184,7 @@ export function createLayerObject(parsedLayer: Partial<Layer>, currentLayer?: La
const internalLayer = layer as GeoAdminLayer

if (internalLayer.type === LayerType.GEOJSON && updateDelay !== undefined) {
;(internalLayer as GeoAdminGeoJSONLayer).updateDelay = updateDelay
; (internalLayer as GeoAdminGeoJSONLayer).updateDelay = updateDelay
}

// only highlightable feature will output something, for the others a click coordinate is required
Expand Down Expand Up @@ -427,6 +427,7 @@ const layersParam = new UrlParamConfig<string>({
'updateLayer',
'updateLayers',
'setSelectedFeatures',
'clearAllSelectedFeatures'
],
setValuesInStore: dispatchLayersFromUrlIntoStore,
extractValueFromStore: generateLayerUrlParamFromStoreValues,
Expand Down
11 changes: 4 additions & 7 deletions packages/viewer/tests/cypress/tests-e2e/featureSelection.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ describe('Testing the feature selection', () => {
checkFeatures()
checkFeatureInfoPosition(FeatureInfoPositions.ToolTip)
})

it('Synchronise URL and feature selection', () => {
const expectedFeatureIds = [1234, 5678]
const mapSelector = '[data-cy="ol-map"]'
Expand All @@ -137,7 +136,7 @@ describe('Testing the feature selection', () => {
},
})
cy.url().should((url) => {
expect(new URLSearchParams(url.split('map')[1]).get('featureInfo')).to.eq(undefined)
expect(new URLSearchParams(url.split('map')[1]).get('featureInfo')).to.eq(null)
})

cy.log('Check that the features appear in the URL')
Expand Down Expand Up @@ -192,7 +191,8 @@ describe('Testing the feature selection', () => {

cy.log('Check that after a reload, features remain selected')
cy.reload()
cy.wait(`@featureDetail_${expectedFeatureIds[1]}`)
cy.wait(['@layerConfig', '@topics'])
cy.wait(`@featureDetail_${expectedFeatureIds[1]}`, { timeout: 10000 })
cy.url().should((url) => {
new URLSearchParams(url.split('map')[1])
.get('layers')!
Expand All @@ -219,6 +219,7 @@ describe('Testing the feature selection', () => {
.should('be.visible')
.click()
cy.closeMenuIfMobile()
cy.wait(`@htmlPopup`)

cy.get(mapSelector).click()
cy.wait(`@${timeLayer}_identify`)
Expand All @@ -241,7 +242,6 @@ describe('Testing the feature selection', () => {
}
})
})

cy.log('Check that upon closing, the features are no longer in the URL')
cy.get('[data-cy="infobox-close"]').click()
cy.get('[data-cy="highlighted-features"]').should('not.exist')
Expand Down Expand Up @@ -369,7 +369,6 @@ describe('Testing the feature selection', () => {
assertDefined(location[1])
cy.get('@olMap').click(location[0], location[1], { ctrlKey })
}

it('can select an area to identify features inside it', () => {
const fileName = 'external-kml-file.kml'
const localKmlFile = `import-tool/${fileName}`
Expand Down Expand Up @@ -526,7 +525,6 @@ describe('Testing the feature selection', () => {
cy.get('@identifySingleFeature.all').should('have.length', 1)
cy.get('@emptyIdentify.all').should('have.length', 1)
})

it('can select feature by click, add more feature, and deselect feature', () => {
const fileName = '4-points.kml'
const localKmlFile = `import-tool/${fileName}`
Expand Down Expand Up @@ -598,7 +596,6 @@ describe('Testing the feature selection', () => {
})
})
})

it('can print feature information', () => {
const fileName = 'external-kml-file.kml'
const localKmlFile = `import-tool/${fileName}`
Expand Down
Loading