-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #85 from Geoportail-Luxembourg/GSLUX-601-style-sel…
…ector GSLUX-601: Style selector
- Loading branch information
Showing
12 changed files
with
11,644 additions
and
11,486 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
describe('Style selector', () => { | ||
beforeEach(() => { | ||
cy.visit('/') | ||
cy.get('[data-cy="myLayersButton"]').click() | ||
cy.get('.fa-pencil').click() | ||
}) | ||
|
||
it('renders the style selector properly', () => { | ||
cy.get('[data-cy="styleSelector"').should('not.be.hidden') | ||
cy.get('[data-cy="styleSelector"') | ||
.find('button') | ||
.filter(':visible') | ||
.should('have.length', 3) | ||
}) | ||
|
||
it('has no style value in localStorage', () => { | ||
expect(localStorage.getItem('basemap_2015_global')).to.eq('') | ||
}) | ||
|
||
describe('Simple style selector', () => { | ||
beforeEach(() => { | ||
cy.get('[data-cy="styleSelector"') | ||
.find('button') | ||
.filter(':visible') | ||
.first() | ||
.as('simple') | ||
cy.get('@simple').click() | ||
}) | ||
it('renders the simple style selector properly', () => { | ||
cy.get('@simple') | ||
.siblings() | ||
.find('button') | ||
.filter(':visible') | ||
.should('have.length', 6) | ||
}) | ||
it('sets style to 4th style of list', () => { | ||
const newStyle = `{"medium":[{"label":"Roads primary","color":"#f9c50d","lines":["lu_road_trunk_primary","lu_bridge_major","lu_tunnel_major","lu_road_major_motorway"],"visible":true},{"label":"Roads secondary","color":"#ffffff","lines":["lu_road_minor","lu_road_secondary_tertiary","lu_bridge_minor","lu_road_path","lu_bridge_path","lu_bridge_railway case","lu_bridge_path case"],"visible":true},{"label":"Vegetation","color":"#839836","opacity":"1","fills":["lu_landcover_wood","lu_landcover_grass","lu_landuse_stadium","lu_landuse_cemetery"],"visible":true},{"label":"Buildings","color":"#d6d3ce","opacity":"1","fillExtrusions":["lu_building-3d_public","lu_building-3d"],"fills":["lu_building","lu_building_public"],"lines":["lu_bridge_railway","lu_railway","lu_tunnel_railway"],"visible":true},{"label":"Water","color":"#2a5ba8","lines":["lu_waterway","lu_waterway_tunnel","lu_waterway_intermittent"],"fills":["lu_water"],"visible":true},{"label":"Background","color":"#eeeeee","backgrounds":["background"],"visible":true},{"label":"Hillshade","hillshades":["hillshade"],"visible":false}]}` | ||
cy.get('@simple') | ||
.siblings() | ||
.find('button') | ||
.filter(':visible') | ||
.eq(3) | ||
.click() | ||
cy.window().then(win => { | ||
expect(win.localStorage.getItem('basemap_2015_global')).to.eq(newStyle) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('Medium style selector', () => { | ||
beforeEach(() => { | ||
cy.get('[data-cy="styleSelector"') | ||
.find('button') | ||
.filter(':visible') | ||
.eq(1) | ||
.as('medium') | ||
cy.get('@medium').click() | ||
}) | ||
it('renders the medium style selector properly', () => { | ||
cy.get('@medium') | ||
.siblings() | ||
.find('input[type="checkbox"]') | ||
.filter(':visible') | ||
.should('have.length', 7) | ||
cy.get('@medium') | ||
.siblings() | ||
.find('input[type="color"]') | ||
.filter(':visible') | ||
.should('have.length', 6) | ||
}) | ||
it('sets "Roads primary" to "visible":false', () => { | ||
const newStyle = `{"medium":[{"label":"Roads primary","color":"#f7f7f7","lines":["lu_road_trunk_primary","lu_bridge_major","lu_tunnel_major","lu_road_major_motorway"],"visible":false},{"label":"Roads secondary","color":"#f7f7f7","lines":["lu_road_minor","lu_road_secondary_tertiary","lu_bridge_minor","lu_road_path","lu_bridge_path","lu_bridge_railway case","lu_bridge_path case"],"visible":true},{"label":"Vegetation","color":"#B8D293","opacity":"1","fills":["lu_landcover_wood","lu_landcover_grass","lu_landuse_stadium","lu_landuse_cemetery"],"visible":true},{"label":"Buildings","color":"#D6AA85","opacity":"1","fillExtrusions":["lu_building-3d_public","lu_building-3d"],"fills":["lu_building","lu_building_public"],"lines":["lu_bridge_railway","lu_railway","lu_tunnel_railway"],"visible":true},{"label":"Water","color":"#94c1e1","lines":["lu_waterway","lu_waterway_tunnel","lu_waterway_intermittent"],"fills":["lu_water"],"visible":true},{"label":"Background","color":"#e7e7e7","backgrounds":["background"],"visible":true},{"label":"Hillshade","hillshades":["hillshade"],"visible":true}]}` | ||
cy.get('@medium') | ||
.siblings() | ||
.find('input[type="checkbox"]') | ||
.filter(':visible') | ||
.first() | ||
.click() | ||
cy.window().then(win => { | ||
expect(win.localStorage.getItem('basemap_2015_global')).to.eq(newStyle) | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<script lang="ts" setup> | ||
defineProps<{ | ||
expanded: boolean | ||
title: string | ||
}>() | ||
defineEmits<{ | ||
(e: 'togglePanel'): void | ||
}>() | ||
</script> | ||
|
||
<template> | ||
<button | ||
@click="$emit('togglePanel')" | ||
class="group w-full text-left flex px-2 py-1.5 uppercase bg-tertiary" | ||
:aria-expanded="expanded" | ||
> | ||
<div class="grow" :class="expanded ? 'text-white' : 'text-secondary'"> | ||
{{ title }} | ||
</div> | ||
<div class="leading-6"> | ||
<div | ||
class="fa fa-sharp fa-solid group-hover:text-white text-primary" | ||
:class="expanded ? 'fa-caret-up' : 'fa-caret-down'" | ||
></div> | ||
</div> | ||
</button> | ||
<div :class="expanded ? '' : 'hidden'"> | ||
<slot></slot> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters