Interactive interface for browsing global, full-resolution satellite imagery
add e2e tests #2306
Benjamin Kinge8bf4f4166c1
diff --git a/e2e/features/palettes/disable-test.js b/e2e/features/palettes/disable-test.jsnew file mode 100644index 000000000..5bf0462e3--- /dev/null+++ b/e2e/features/palettes/disable-test.js@@ -0,0 +1,38 @@+const normalizeViewport = require('../../reuseables/normalize-viewport.js').normalizeViewport;+const TIME_LIMIT = 10000;+const enabledPermalink = '?l=Last_of_the_Wild_1995-2004';+const disabledPermalink = '?l=Last_of_the_Wild_1995-2004(disabled=0-13-12-1-2-6)';+const classColorBoxId = '#Last_of_the_Wild_1995-2004_0_legend-color-active'+module.exports = {+ before: function (client) {+ normalizeViewport(client, 1000, 850);+ client.url(client.globals.url + enabledPermalink)+ },+ 'Verify that toggling class updates permalink and layer-legend': function (client) {+ client.waitForElementVisible('#active-Last_of_the_Wild_1995-2004', TIME_LIMIT, function () {+ client.expect.element('#active-Last_of_the_Wild_1995-2004 .disabled-classification').to.not.be.present;+ client.click('#active-Last_of_the_Wild_1995-2004 .wv-layers-options');+ client.waitForElementVisible('.layer-classification-toggle', 2000, function () {+ client.click('.react-switch-case .react-switch-button');+ client.waitForElementVisible(classColorBoxId + '0.disabled-classification', TIME_LIMIT, () => {+ client.expect.element(classColorBoxId + '1.disabled-classification').to.not.be.present;+ client.assert.urlContains('(disabled=0)');+ })+ });+ });+ },+ 'Verify that loaded permalink disables classes': function (client) {+ client.url(client.globals.url + disabledPermalink)+ client.waitForElementVisible(classColorBoxId + '0', TIME_LIMIT, function () {+ client.expect.element(classColorBoxId + '0.disabled-classification').to.be.present;+ client.expect.element(classColorBoxId + '13.disabled-classification').to.be.present;+ client.expect.element(classColorBoxId + '6.disabled-classification').to.be.present;+ client.expect.element(classColorBoxId + '5.disabled-classification').to.not.be.present;+ client.expect.element(classColorBoxId + '11.disabled-classification').to.not.be.present;+ client.expect.element(classColorBoxId + '3.disabled-classification').to.not.be.present;+ });+ },+ after: function (client) {+ client.end();+ }+};diff --git a/web/js/components/sidebar/paletteLegend.js b/web/js/components/sidebar/paletteLegend.jsindex 9ba37f152..64d426f01 100644--- a/web/js/components/sidebar/paletteLegend.js+++ b/web/js/components/sidebar/paletteLegend.js@@ -258,8 +258,8 @@ class PaletteLegend extends React.Component {{isMoreThanOneColorBar ? (<div className="wv-palettes-title">{legend.title}</div>) : (- ''- )}+ ''+ )}<div className="colorbar-case"><canvasclassName="wv-palettes-colorbar"@@ -342,8 +342,8 @@ class PaletteLegend extends React.Component {const isActiveKey = activeKeyObj && activeKeyObj.index === keyIndex;const palletteClass = isActiveKey ? 'wv-active wv-palettes-class' : 'wv-palettes-class';const isSubLayer = !!parentLayer;- const parentLayerId = isSubLayer ? parentLayer.id : '';- const keyId = layer.id + '-' + legend.id + '-color-' + keyIndex + parentLayerId + layerGroupName;+ const parentLayerId = isSubLayer ? '-' + parentLayer.id : '';+ const keyId = legend.id + '-color' + parentLayerId + '-' + layerGroupName + keyIndex;const keyLabel = activeKeyObj ? activeKeyObj.label : '';const inActive = palette.disabled && palette.disabled.includes(keyIndex);diff --git a/web/js/modules/palettes/util.test.js b/web/js/modules/palettes/util.test.jsindex ce02cd5bd..febd8262c 100644--- a/web/js/modules/palettes/util.test.js+++ b/web/js/modules/palettes/util.test.js@@ -20,6 +20,12 @@ test('hasCustomTypePalette func determines if custom palette is in string', () =);expect(bool).toBeTruthy();});+test('hasCustomTypePalette func determines if custom palette is in string', () => {+ const bool = hasCustomTypePalette(+ 'some-layer(disabled(;0-2)'+ );+ expect(bool).toBeTruthy();+});test('loadPalettes func updates state with correct palette attributes', () => {util.browser = jest.fn(() => {return {