-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Refactor layers menu to not remove active layers on map move * Fix layer group title not showing when its layers are visible * Remove bounds that is no longer relevant * Limit requesting data to layer extents * Add cypress intellisense support and update package-lock file * Add tests to check layer filtering * Remove references to layerData.json * Fixed failing tests
- Loading branch information
Showing
11 changed files
with
306 additions
and
107 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
describe('Layers menu filters and displays layers on map', function() { | ||
it('filters layers at map initialization', function() { | ||
cy.openWindow('/example/index.html#lat=43.00&lon=-83.00&zoom=3&layers=Standard') | ||
cy.wait(200) | ||
cy.get('.leaflet-control-layers').trigger('mouseover') | ||
cy.get('.layer-info-container').should('have.css', 'display', 'block').then((layers) => { | ||
const layersArray = Array.prototype.slice.call(layers) | ||
expect(layersArray.filter(layer => layer.style.display === 'block').length).to.equal(9) | ||
}) | ||
cy.get('.leaflet-control-layers').trigger('mouseout') | ||
}) | ||
|
||
it('adds an alert displaying the number of new layers on map movement', function() { | ||
cy.window().its('map').invoke('setView',[38.565, -100.767], 5) | ||
cy.wait(200) | ||
cy.get('.leaflet-control-layers-toggle .rounded-circle') | ||
.should('have.css', 'display', 'flex') | ||
.invoke('text').should('eq', '13') | ||
}) | ||
|
||
it('adds layers to the menu on map movement', function() { | ||
cy.get('.leaflet-control-layers').trigger('mouseover') | ||
cy.get('.layer-info-container').should('have.css', 'display', 'block').then((layers) => { | ||
const layersArray = Array.prototype.slice.call(layers) | ||
expect(layersArray.filter(layer => layer.style.display === 'block').length).to.equal(14) | ||
}) | ||
}) | ||
|
||
it('removes alert after layer menu is expanded', function() { | ||
cy.get('.leaflet-control-layers').trigger('mouseout') | ||
cy.get('.leaflet-control-layers-toggle .rounded-circle') | ||
.should('have.css', 'display', 'none') | ||
.invoke('text').should('eq', '') | ||
}) | ||
|
||
it('removes layers from the menu on map movement', function() { | ||
cy.window().its('map').invoke('setView',[43.00, -83.00], 3) | ||
cy.wait(300) | ||
cy.get('.leaflet-control-layers').trigger('mouseover') | ||
cy.get('.layer-info-container').should('have.css', 'display', 'block').then((layers) => { | ||
const layersArray = Array.prototype.slice.call(layers) | ||
expect(layersArray.filter(layer => layer.style.display === 'block').length).to.equal(9) | ||
}) | ||
}) | ||
|
||
it('retains an active layer when map view does not intersect with its extents', function() { | ||
cy.window().its('map').invoke('setView',[38.565, -100.767], 5) | ||
cy.wait(300) | ||
cy.get('.leaflet-control-layers').trigger('mouseover') | ||
cy.get('#groupName-justiceMap a[data-toggle="collapse"]').click() | ||
cy.get('div#justiceMap.layers-sub-list.collapse.show').children('div') | ||
.last('label').click() | ||
.find('input[type="checkbox"]').should('be.checked') | ||
cy.window().its('map').invoke('setView',[43.00, -83.00], 3) | ||
cy.wait(300) | ||
cy.get('#groupName-justiceMap').should('have.css', 'display', 'block') | ||
cy.get('div#justiceMap.layers-sub-list.collapse.show').children('div') | ||
.last('label').should('have.css', 'display', 'block') | ||
cy.get('div#justiceMap.layers-sub-list.collapse.show').children('div') | ||
.first('label').should('have.css', 'display', 'none') | ||
}) | ||
|
||
it('filters out the layer on map move after it is unchecked', function() { | ||
cy.get('div#justiceMap.layers-sub-list.collapse.show').children('div') | ||
.last('label').click() | ||
.find('input[type="checkbox"]').should('not.be.checked') | ||
cy.window().its('map').invoke('setView',[43.00, -85.00], 3) | ||
cy.wait(300) | ||
cy.get('#groupName-justiceMap').should('have.css', 'display', 'none') | ||
cy.get('div#justiceMap.layers-sub-list.collapse.show').children('div') | ||
.last('label').should('have.css', 'display', 'none') | ||
}) | ||
}) |
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,6 @@ | ||
{ | ||
"include": [ | ||
"./node_modules/cypress", | ||
"cypress/**/*.js" | ||
] | ||
} |
Oops, something went wrong.