Skip to content

Commit

Permalink
Merge pull request #167 from Geoportail-Luxembourg/GSLUX-753-legends
Browse files Browse the repository at this point in the history
GSLUX-753: Legend panel
  • Loading branch information
AlitaBernachot authored Nov 4, 2024
2 parents c3cc294 + df14897 commit 55e4941
Show file tree
Hide file tree
Showing 26 changed files with 1,551 additions and 1,796 deletions.
6 changes: 3 additions & 3 deletions cypress/e2e/layers-selection/layers-selection-catalog.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ describe('Catalogue', () => {
cy.get('[data-cy="catalogButton"]').click()
cy.get('[data-cy="parentLayerLabel-242"]').find('button').first().click()
cy.get('[data-cy="parentLayerLabel-309"]').click()
cy.get('[data-cy^="layerLabel-269"]').click()
cy.get('[data-cy^="layerLabel-349"]').click()
cy.get('[data-cy^="layerLabel-329"]').click()
cy.get('[data-cy="layerLabel-269"]').click()
cy.get('[data-cy="layerLabel-349"]').click()
cy.get('[data-cy="layerLabel-329"]').click()
})

it('adds selected layers to the map and to the layer manager', () => {
Expand Down
106 changes: 106 additions & 0 deletions cypress/e2e/legends/legends.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
describe('Legends', () => {
beforeEach(() => {
cy.visit('/')
})

describe('When user opens the legend panel', () => {
beforeEach(() => {
cy.get('[data-cy="legendsOpenClose"] > button').click()
})

it('displays the bg legend and a txt saying there are no legends for layers', () => {
cy.get('[data-cy="legendsPanel"]').should('exist')
cy.get('[data-cy="legendsPanel"]').should(
'contain.text',
"Aucune légende n'est disponible pour les couches sélectionnées."
)
cy.get('[data-cy="legendBgLayer"]').should('exist')
})

it('hides all other side panels', () => {
cy.get('[data-cy="layerPanel"]').should('not.exist')
cy.get('[data-cy="myMapsPanel"]').should('not.exist')
})
})

describe('When user adds layers without legends', () => {
beforeEach(() => {
cy.get('[data-cy="catalogButton"]').click()
cy.get('[data-cy="parentLayerLabel-242"]').find('button').first().click()
cy.get('[data-cy="parentLayerLabel-309"]').click()
cy.get('[data-cy="layerLabel-269"]').click()
cy.get('[data-cy="layerLabel-349"]').click()
cy.get('[data-cy="layerLabel-329"]').click()
cy.get('[data-cy="legendsOpenClose"] > button').click()
})

it('displays a txt saying there are no legend for selected layers', () => {
cy.get('[data-cy="legendsPanel"]').should(
'contain.text',
"Aucune légende n'est disponible pour les couches sélectionnées."
)
})
})

describe('When user adds layers with legends', () => {
beforeEach(() => {
cy.get('[data-cy="catalogButton"]').click()
cy.get('[data-cy^="layerLabel-1813"]').click()
cy.get('[data-cy="catalog"]')
.find('[data-cy="layerLabel-359"]')
.click({ force: true })
cy.get('[data-cy="legendsOpenClose"] > button').click()
})

it('displays the legends for both layers', () => {
cy.get('[data-cy="legendLayer"]').should('have.length', 2)
})
})

describe('When user adds layers with legends and one without a legend', () => {
beforeEach(() => {
cy.get('[data-cy="catalogButton"]').click()
cy.get('[data-cy^="layerLabel-1813"]').click()
cy.get('[data-cy="catalog"]')
.find('[data-cy="layerLabel-359"]')
.click({ force: true })

cy.get('[data-cy="parentLayerLabel-242"]').find('button').first().click()
cy.get('[data-cy="parentLayerLabel-309"]').click()
cy.get('[data-cy="layerLabel-269"]').click()
cy.get('[data-cy="layerLabel-349"]').click()
cy.get('[data-cy="layerLabel-329"]').click()
cy.get('[data-cy="legendsOpenClose"] > button').click()
})

it('displays the legends for both layers having legend', () => {
cy.get('[data-cy="legendLayer"]').should('have.length', 2)
})
})

describe('When a layer with a legend is removed', () => {
beforeEach(() => {
cy.get('[data-cy="catalogButton"]').click()
cy.get('[data-cy^="layerLabel-262"]').click()

cy.get('[data-cy="legendsOpenClose"] > button').click()
})

it('displays a txt saying there are no legend to show', () => {
cy.get('[data-cy="legendLayer"]').should('have.length', 1)

cy.get('[data-cy="selectedBg"]').find('button').click()
cy.get('[data-cy="available-bgs"]')
.find('button')
.filter('[title*="Carte topographique"]')
.click()

cy.get('[data-cy="legendsPanel"]').should(
'contain.text',
"Aucune légende n'est disponible pour les couches sélectionnées."
)

cy.get('[data-cy="legendLayer"]').should('have.length', 0)
})
})
})
2 changes: 1 addition & 1 deletion cypress/e2e/metadata/metadata.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe('Metadata', () => {
cy.get('[data-cy="layerMetadata-698"]').click()
})

it('it show the popup with the layer metadata', () => {
it('it shows the popup with the layer metadata', () => {
cy.get('[data-cy="metadata"]').find('span').eq(0).contains('Nom')
cy.get('[data-cy="metadata"] .lux-legend')
.find('h4')
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/permalink/layers-comparator.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ describe('Permalink/State persistor - Layer comparator (lc & sliderRatio)', () =
cy.get('[data-cy="catalogButton"]').click()
cy.get('[data-cy="parentLayerLabel-242"]').find('button').first().click()
cy.get('[data-cy="parentLayerLabel-309"]').click()
cy.get('[data-cy^="layerLabel-269"]').click()
cy.get('[data-cy^="layerLabel-349"]').click()
cy.get('[data-cy^="layerLabel-329"]').click()
cy.get('[data-cy="layerLabel-269"]').click()
cy.get('[data-cy="layerLabel-349"]').click()
cy.get('[data-cy="layerLabel-329"]').click()
cy.get('[data-cy="myLayersButton"]').click()
})

Expand Down
Loading

0 comments on commit 55e4941

Please sign in to comment.