Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

update tests, fix linting issues

Jason Kent1783c9b3083c
diff --git a/e2e/features/layers/layers-sidebar-test.js b/e2e/features/layers/layers-sidebar-test.js
index 5e39a4303..a10a55b94 100644
--- a/e2e/features/layers/layers-sidebar-test.js
+++ b/e2e/features/layers/layers-sidebar-test.js
@@ -18,6 +18,7 @@ const {
aodGroup,
aodGroupHeader,
overlaysGroup,
+ overlaysGroupHeader,
baselayersGroup,
baselayersGroupHeader,
groupOptionsBtn,
@@ -32,8 +33,8 @@ const {
const vectorsQueryString = '?v=-70.43215000968726,28.678203599725197,-59.81569241792232,31.62330063930118&l=GRanD_Dams,Reference_Labels(hidden),Reference_Features(hidden),Coastlines,VIIRS_SNPP_CorrectedReflectance_TrueColor(hidden),MODIS_Aqua_CorrectedReflectance_TrueColor(hidden),VIIRS_NOAA20_CorrectedReflectance_TrueColor(hidden),MODIS_Terra_CorrectedReflectance_TrueColor';
const TIME_LIMIT = 10000;
-const someGroupsQueryString = '?l=MODIS_Combined_Value_Added_AOD,MODIS_Combined_MAIAC_L2G_AerosolOpticalDepth,Reference_Labels(hidden),Reference_Features,MODIS_Terra_CorrectedReflectance_TrueColor';
-const twoGroupsQueryString = '?v=-107.15747724134027,-81.6706340523014,47.81381180183274,89.12472754295932&l=VIIRS_SNPP_Thermal_Anomalies_375m_All,VIIRS_NOAA20_Thermal_Anomalies_375m_All,MODIS_Combined_Value_Added_AOD,MODIS_Combined_MAIAC_L2G_AerosolOpticalDepth,Reference_Features,MODIS_Terra_CorrectedReflectance_TrueColor';
+const someGroupsQueryString = '?l=MODIS_Combined_Value_Added_AOD,MODIS_Combined_MAIAC_L2G_AerosolOpticalDepth,Reference_Labels(hidden),Reference_Features,MODIS_Terra_CorrectedReflectance_TrueColor&lg=true';
+const twoGroupsQueryString = '?v=-107.15747724134027,-81.6706340523014,47.81381180183274,89.12472754295932&l=VIIRS_SNPP_Thermal_Anomalies_375m_All,VIIRS_NOAA20_Thermal_Anomalies_375m_All,MODIS_Combined_Value_Added_AOD,MODIS_Combined_MAIAC_L2G_AerosolOpticalDepth,Reference_Features,MODIS_Terra_CorrectedReflectance_TrueColor&lg=true';
const mixedLayersGroupsDisabledQueryString = '?v=-107.15747724134027,-81.6706340523014,47.81381180183274,89.12472754295932&l=Reference_Features,VIIRS_SNPP_Thermal_Anomalies_375m_All,MODIS_Combined_Value_Added_AOD,VIIRS_NOAA20_Thermal_Anomalies_375m_All,MODIS_Combined_MAIAC_L2G_AerosolOpticalDepth,MODIS_Terra_CorrectedReflectance_TrueColor&lg=false';
const mixedLayerIdOrder = [
'active-Reference_Features',
@@ -64,18 +65,21 @@ module.exports = {
// Individual layer interactions
'Toggle layer Info': (c) => {
+ c.url(c.globals.url + twoGroupsQueryString);
+ c.moveToElement(firesLayer, 0, 0);
+ c.waitForElementVisible(infoButton, TIME_LIMIT);
c.click(infoButton);
- c.waitForElementVisible(infoDialog, TIME_LIMIT, (e) => {
- c.click(infoButton).pause(100);
- c.expect.element(infoDialog).to.not.be.present;
- });
+ c.waitForElementVisible(infoDialog, TIME_LIMIT);
+ c.click(infoButton).pause(100);
+ c.expect.element(infoDialog).to.not.be.present;
},
'Toggle Layer Options': (c) => {
+ c.moveToElement(firesLayer, 0, 0);
+ c.waitForElementVisible(optionsButton, TIME_LIMIT);
c.click(optionsButton);
- c.waitForElementVisible(optionsDialog, TIME_LIMIT, (e) => {
- c.click(optionsButton).pause(100);
- c.expect.element(optionsDialog).to.not.be.present;
- });
+ c.waitForElementVisible(optionsDialog, TIME_LIMIT);
+ c.click(optionsButton).pause(100);
+ c.expect.element(optionsDialog).to.not.be.present;
},
// Layer grouping
@@ -113,6 +117,8 @@ module.exports = {
},
'Removing the last layer in a group removes the group': (c) => {
+ c.moveToElement(firesLayer, 0, 0);
+ c.waitForElementVisible(firesRemove, TIME_LIMIT);
c.click(firesRemove).pause(500);
c.expect.element(firesGroup).to.not.be.present;
},
@@ -171,8 +177,8 @@ module.exports = {
c.click(groupCheckbox);
c.expect.element(groupCheckbox).to.not.have.attribute('checked');
- c.moveToElement(overlaysGroup, 0, 0);
- c.waitForElementVisible(`${overlaysGroup} ${groupOptionsBtn}`);
+ c.moveToElement(overlaysGroupHeader, 0, 0);
+ c.waitForElementVisible(`${overlaysGroupHeader} ${groupOptionsBtn}`);
c.click(`${overlaysGroup} ${groupOptionsBtn}`).pause(200);
c.click(`${overlaysGroup} ${groupRemove}`).pause(200);
@@ -227,7 +233,7 @@ module.exports = {
c.click(groupCheckbox).pause(200);
// Modify by setting AOD layers to hidden
c.moveToElement(sidebarContainer, 0, 0);
- c.moveToElement(aodGroup, 0, 0);
+ c.moveToElement(aodGroupHeader, 0, 0);
c.waitForElementVisible(`${aodGroup} ${groupOptionsBtn}`);
c.click(`${aodGroup} ${groupOptionsBtn}`).pause(200);
c.click(`${aodGroup} ${groupHide}`).pause(200);
diff --git a/e2e/reuseables/selectors.js b/e2e/reuseables/selectors.js
index 13b9a0eec..1c4889bb5 100644
--- a/e2e/reuseables/selectors.js
+++ b/e2e/reuseables/selectors.js
@@ -25,10 +25,11 @@ module.exports = {
viirsFiresCheckbox: '#VIIRS_NOAA20_Thermal_Anomalies_375m_All-checkbox',
firesGroup: '#active-Fires_and_Thermal_Anomalies',
firesLayer: '#active-VIIRS_NOAA20_Thermal_Anomalies_375m_All',
- firesRemove: '#closeactiveVIIRS_NOAA20_Thermal_Anomalies_375m_All',
+ firesRemove: '#close-activeVIIRS_NOAA20_Thermal_Anomalies_375m_All',
aodGroup: '#active-Aerosol_Optical_Depth',
aodGroupHeader: '#active-Aerosol_Optical_Depth .layer-group-header',
overlaysGroup: '#active-overlays',
+ overlaysGroupHeader: '#active-overlays .layer-group-header',
baselayersGroup: '#active-baselayers',
baselayersGroupHeader: '#active-baselayers .layer-group-header',
groupOptionsBtn: '.layer-group-more-options > button',
diff --git a/web/css/sidebar-panel.css b/web/css/sidebar-panel.css
index ea6e50e66..861b9d14c 100644
--- a/web/css/sidebar-panel.css
+++ b/web/css/sidebar-panel.css
@@ -455,11 +455,7 @@ li.item.productsitem.inmotion,
position: absolute;
right: 0;
background: #ccc;
- background: linear-gradient(
- 90deg,
- rgba(204,204,204,0) 0%,
- rgba(204,204,204,1) 30%
- );
+ background: linear-gradient(90deg, rgba(204, 204, 204, 0) 0%, rgba(204, 204, 204, 1) 30%);
width: 100px;
}
}
@@ -469,7 +465,7 @@ li.item.productsitem.inmotion,
}
.layer-buttons {
background: #666;
- background: linear-gradient(90deg, rgba(102,102,102,0) 0%, rgba(102,102,102,1) 30%);
+ background: linear-gradient(90deg, rgba(102, 102, 102, 0) 0%, rgba(102, 102, 102, 1) 30%);
}
}
& .layer-main {
diff --git a/web/js/app.js b/web/js/app.js
index dcfa1474c..7616ffd67 100644
--- a/web/js/app.js
+++ b/web/js/app.js
@@ -145,8 +145,6 @@ class App extends React.Component {
};
const main = function() {
- const { models } = self.props;
-
// Load any additional scripts as needed
if (config.scripts) {
lodashEach(config.scripts, (script) => {
@@ -244,13 +242,13 @@ export default connect(
mapStateToProps,
mapDispatchToProps,
)(App);
+
App.propTypes = {
isAnimationWidgetActive: PropTypes.bool,
isMobile: PropTypes.bool,
isTourActive: PropTypes.bool,
keyPressAction: PropTypes.func,
locationKey: PropTypes.string,
- mapMouseEvents: PropTypes.object,
modalId: PropTypes.string,
parameters: PropTypes.object,
};
diff --git a/web/js/components/measure-tool/measure-menu.js b/web/js/components/measure-tool/measure-menu.js
index ccbdbf7dd..54b0a771c 100644
--- a/web/js/components/measure-tool/measure-menu.js
+++ b/web/js/components/measure-tool/measure-menu.js
@@ -86,7 +86,7 @@ class MeasureMenu extends Component {
isTouchDevice, unitOfMeasure, measurementsInProj, isMobile,
} = this.props;
const listSize = isTouchDevice ? 'medium' : 'small';
- DOWNLOAD_SHAPEFILE.hidden = !measurementsInProj || isMobile;
+ // DOWNLOAD_SHAPEFILE.hidden = !measurementsInProj || isMobile;
DOWNLOAD_GEOJSON.hidden = !measurementsInProj || isMobile;
return (
<>
@@ -129,6 +129,7 @@ const mapStateToProps = (state) => {
measurementsInProj,
};
};
+
const mapDispatchToProps = (dispatch) => ({
onToggleUnits: (unitOfMeasure) => {
dispatch(changeUnits(unitOfMeasure));
@@ -146,7 +147,6 @@ export default connect(
MeasureMenu.propTypes = {
isMobile: PropTypes.bool,
isTouchDevice: PropTypes.bool,
- map: PropTypes.object,
measurementsInProj: PropTypes.bool,
onCloseModal: PropTypes.func,
onToggleUnits: PropTypes.func,
diff --git a/web/js/map/data/ui.js b/web/js/map/data/ui.js
index 66e19e7f0..7bebe3faa 100644
--- a/web/js/map/data/ui.js
+++ b/web/js/map/data/ui.js
@@ -440,8 +440,6 @@ const dataUiDownloadListPanel = function(config, store) {
let urs = false;
let $dialog;
- events = util.events;
-
self.show = function() {
$dialog = wvui.getDialog().attr('id', 'wv-data-selection');
diff --git a/web/js/map/model.js b/web/js/map/model.js
index d03b75084..365f60a5b 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -3,9 +3,6 @@ import { register } from 'ol/proj/proj4';
import proj4 from 'proj4';
import lodashClone from 'lodash/clone';
import { intersects } from 'ol/extent';
-import util from '../util/util';
-
-const { events } = util;
export default function mapModel(models, config) {
const self = {};
diff --git a/web/js/modules/layers/reducers.test.js b/web/js/modules/layers/reducers.test.js
index 72e8f105b..82ce3e65f 100644
--- a/web/js/modules/layers/reducers.test.js
+++ b/web/js/modules/layers/reducers.test.js
@@ -69,14 +69,12 @@ describe('layer Reducer tests', () => {
const actions = [
RESET_LAYERS,
ADD_LAYER,
- ADD_LAYERS_FOR_EVENT,
REMOVE_LAYER,
REMOVE_GROUP,
REORDER_LAYERS,
TOGGLE_OVERLAY_GROUP_VISIBILITY,
];
actions.forEach((ACTION) => {
- const layers = [...initialLayers, newLayer];
const expectedState = update(initialState, {
active: {
layers: { $push: [newLayer] },
@@ -86,12 +84,36 @@ describe('layer Reducer tests', () => {
const resultState = layerReducer(initialState, {
type: ACTION,
activeString: 'active',
- layers,
+ layers: [...initialLayers, newLayer],
});
expect(resultState).toEqual(expectedState);
});
});
+ test('ADD_LAYERS_FOR_EVENT sets new groups, layers, and clears prevLayeers', () => {
+ const response = layerReducer(initialState, {
+ type: ADD_LAYERS_FOR_EVENT,
+ activeString: 'active',
+ layers: initialLayers,
+ overlayGroups: initialGroups,
+ });
+ expect(response.active.layers).toEqual(initialLayers);
+ expect(response.active.overlayGroups).toEqual(initialGroups);
+ expect(response.active.prevLayers).toEqual([]);
+ });
+
+ test('REORDER_OVERLAY_GROUPS sets new groups, layers, and clears prevLayeers', () => {
+ const response = layerReducer(initialState, {
+ type: REORDER_OVERLAY_GROUPS,
+ activeString: 'active',
+ layers: initialLayers,
+ overlayGroups: initialGroups,
+ });
+ expect(response.active.layers).toEqual(initialLayers);
+ expect(response.active.overlayGroups).toEqual(initialGroups);
+ expect(response.active.prevLayers).toEqual([]);
+ });
+
test('INIT_SECOND_LAYER_GROUP copies current layer state', () => {
const response = layerReducer(initialState, {
type: INIT_SECOND_LAYER_GROUP,
@@ -152,18 +174,6 @@ describe('layer Reducer tests', () => {
expect(response.active.prevLayers).toEqual(initialLayers);
});
- test('REORDER_OVERLAY_GROUPS sets new groups, layers, and clears prevLayeers', () => {
- const response = layerReducer(initialState, {
- type: REORDER_OVERLAY_GROUPS,
- activeString: 'active',
- layers: initialLayers,
- overlayGroups: initialGroups,
- });
- expect(response.active.layers).toEqual(initialLayers);
- expect(response.active.overlayGroups).toEqual(initialGroups);
- expect(response.active.prevLayers).toEqual([]);
- });
-
test('SET_THRESHOLD_RANGE_AND_SQUASH action updates palette-related props', () => {
const response = layerReducer(initialState, {
type: SET_THRESHOLD_RANGE_AND_SQUASH,