@esri/solutions-components 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/calcite-input-text_5.cjs.entry.js +36 -36
- package/dist/cjs/calcite-shell-panel_14.cjs.entry.js +1 -1
- package/dist/cjs/solution-configuration.cjs.entry.js +1 -1
- package/dist/cjs/solution-contents_3.cjs.entry.js +1 -1
- package/dist/cjs/{solution-store-70002b57.js → solution-store-ca4639d5.js} +3 -3
- package/dist/collection/components/add-record-modal/test/add-record-modal.e2e.js +24 -0
- package/dist/collection/components/add-record-modal/test/add-record-modal.spec.js +32 -0
- package/dist/collection/components/buffer-tools/test/buffer-tools.e2e.js +24 -0
- package/dist/collection/components/buffer-tools/test/buffer-tools.spec.js +157 -0
- package/dist/collection/components/card-manager/test/card-manager.e2e.js +24 -0
- package/dist/collection/components/card-manager/test/card-manager.spec.js +32 -0
- package/dist/collection/components/comment-card/test/comment-card.e2e.js +24 -0
- package/dist/collection/components/comment-card/test/comment-card.spec.js +32 -0
- package/dist/collection/components/crowdsource-manager/test/crowdsource-manager.e2e.js +24 -0
- package/dist/collection/components/crowdsource-manager/test/crowdsource-manager.spec.js +32 -0
- package/dist/collection/components/crowdsource-reporter/test/crowdsource-reporter.e2e.js +24 -0
- package/dist/collection/components/crowdsource-reporter/test/crowdsource-reporter.spec.js +32 -0
- package/dist/collection/components/deduct-calculator/test/deduct-calculator.e2e.js +24 -0
- package/dist/collection/components/deduct-calculator/test/deduct-calculator.spec.js +32 -0
- package/dist/collection/components/edit-record-modal/test/edit-record-modal.e2e.js +24 -0
- package/dist/collection/components/edit-record-modal/test/edit-record-modal.spec.js +32 -0
- package/dist/collection/components/info-card/test/info-card.e2e.js +24 -0
- package/dist/collection/components/info-card/test/info-card.spec.js +32 -0
- package/dist/collection/components/json-editor/test/json-editor.e2e.js +31 -0
- package/dist/collection/components/json-editor/test/json-editor.spec.js +60 -0
- package/dist/collection/components/layer-table/test/layer-table.e2e.js +24 -0
- package/dist/collection/components/layer-table/test/layer-table.spec.js +32 -0
- package/dist/collection/components/list-item/test/list-item.e2e.js +24 -0
- package/dist/collection/components/list-item/test/list-item.spec.js +32 -0
- package/dist/collection/components/map-card/test/map-card.e2e.js +24 -0
- package/dist/collection/components/map-card/test/map-card.spec.js +32 -0
- package/dist/collection/components/map-draw-tools/test/map-draw-tools.e2e.js +24 -0
- package/dist/collection/components/map-draw-tools/test/map-draw-tools.spec.js +32 -0
- package/dist/collection/components/map-layer-picker/test/map-layer-picker.e2e.js +24 -0
- package/dist/collection/components/map-layer-picker/test/map-layer-picker.spec.js +109 -0
- package/dist/collection/components/map-search/test/map-search.e2e.js +24 -0
- package/dist/collection/components/map-search/test/map-search.spec.js +53 -0
- package/dist/collection/components/map-select-tools/map-select-tools.js +36 -36
- package/dist/collection/components/map-select-tools/test/map-select-tools.e2e.js +24 -0
- package/dist/collection/components/map-select-tools/test/map-select-tools.spec.js +349 -0
- package/dist/collection/components/media-card/test/media-card.e2e.js +24 -0
- package/dist/collection/components/media-card/test/media-card.spec.js +32 -0
- package/dist/collection/components/pci-calculator/test/pci-calculator.e2e.js +24 -0
- package/dist/collection/components/pci-calculator/test/pci-calculator.spec.js +32 -0
- package/dist/collection/components/pdf-download/test/pdf-download.e2e.js +71 -0
- package/dist/collection/components/pdf-download/test/pdf-download.spec.js +104 -0
- package/dist/collection/components/public-notification/test/public-notification.e2e.js +95 -0
- package/dist/collection/components/public-notification/test/public-notification.spec.js +149 -0
- package/dist/collection/components/refine-selection/refine-selection.css +85 -85
- package/dist/collection/components/solution-configuration/test/solution-configuration.e2e.js +31 -0
- package/dist/collection/components/solution-configuration/test/solution-configuration.spec.js +114 -0
- package/dist/collection/components/solution-contents/test/solution-contents.e2e.js +89 -0
- package/dist/collection/components/solution-contents/test/solution-contents.spec.js +138 -0
- package/dist/collection/components/solution-item/test/solution-item.e2e.js +31 -0
- package/dist/collection/components/solution-item/test/solution-item.spec.js +72 -0
- package/dist/collection/components/solution-item-details/test/solution-item-details.e2e.js +31 -0
- package/dist/collection/components/solution-item-details/test/solution-item-details.spec.js +137 -0
- package/dist/collection/components/solution-item-icon/test/solution-item-icon.e2e.js +24 -0
- package/dist/collection/components/solution-item-icon/test/solution-item-icon.spec.js +34 -0
- package/dist/collection/components/solution-item-sharing/test/solution-item-sharing.e2e.js +31 -0
- package/dist/collection/components/solution-item-sharing/test/solution-item-sharing.spec.js +49 -0
- package/dist/collection/components/solution-organization-variables/test/solution-organization-variables.e2e.js +31 -0
- package/dist/collection/components/solution-organization-variables/test/solution-organization-variables.spec.js +60 -0
- package/dist/collection/components/solution-resource-item/test/solution-resource-item.e2e.js +31 -0
- package/dist/collection/components/solution-resource-item/test/solution-resource-item.spec.js +50 -0
- package/dist/collection/components/solution-spatial-ref/test/solution-spatial-ref.e2e.js +31 -0
- package/dist/collection/components/solution-spatial-ref/test/solution-spatial-ref.spec.js +170 -0
- package/dist/collection/components/solution-template-data/test/solution-template-data.e2e.js +31 -0
- package/dist/collection/components/solution-template-data/test/solution-template-data.spec.js +55 -0
- package/dist/collection/components/solution-variables/test/solution-variables.e2e.js +31 -0
- package/dist/collection/components/solution-variables/test/solution-variables.spec.js +126 -0
- package/dist/collection/utils/publicNotificationUtils.js +45 -0
- package/dist/collection/utils/templates.e2e.js +25 -0
- package/dist/collection/utils/test/csvUtils.spec.js +46 -0
- package/dist/collection/utils/test/downloadUtils.spec.js +102 -0
- package/dist/collection/utils/test/pciUtils.spec.js +297 -0
- package/dist/collection/utils/test/solution-store.spec.js +439 -0
- package/dist/components/map-select-tools2.js +36 -36
- package/dist/components/solution-store.js +3 -3
- package/dist/esm/calcite-input-text_5.entry.js +36 -36
- package/dist/esm/calcite-shell-panel_14.entry.js +1 -1
- package/dist/esm/solution-configuration.entry.js +1 -1
- package/dist/esm/solution-contents_3.entry.js +1 -1
- package/dist/esm/{solution-store-5d068b07.js → solution-store-70f874f8.js} +3 -3
- package/dist/solutions-components/{p-41802f6b.entry.js → p-16dfb254.entry.js} +1 -1
- package/dist/solutions-components/{p-4769a2a5.entry.js → p-5ed755a2.entry.js} +1 -1
- package/dist/solutions-components/{p-826a814d.js → p-78719506.js} +2 -2
- package/dist/solutions-components/{p-9f620303.entry.js → p-b4b19fd3.entry.js} +1 -1
- package/dist/solutions-components/{p-24fe6e1c.entry.js → p-d5d5942d.entry.js} +1 -1
- package/dist/solutions-components/solutions-components.esm.js +1 -1
- package/dist/solutions-components/utils/common.js +291 -0
- package/dist/solutions-components/utils/csvDownload.js +36 -0
- package/dist/solutions-components/utils/csvUtils.js +32 -0
- package/dist/solutions-components/utils/downloadUtils.js +386 -0
- package/dist/solutions-components/utils/interfaces.js +56 -0
- package/dist/solutions-components/utils/languageUtil.js +85 -0
- package/dist/solutions-components/utils/loadModules.js +20 -0
- package/dist/solutions-components/utils/locale.js +56 -0
- package/dist/solutions-components/utils/mapViewUtils.js +140 -0
- package/dist/solutions-components/utils/pciUtils.js +837 -0
- package/dist/solutions-components/utils/pdfUtils.js +62 -0
- package/dist/solutions-components/utils/publicNotificationStore.js +38 -0
- package/dist/solutions-components/utils/publicNotificationUtils.js +45 -0
- package/dist/solutions-components/utils/queryUtils.js +148 -0
- package/dist/solutions-components/utils/solution-store.js +579 -0
- package/dist/solutions-components/utils/templates.e2e.js +25 -0
- package/dist/solutions-components/utils/templates.js +341 -0
- package/dist/solutions-components/utils/test/csvUtils.spec.js +46 -0
- package/dist/solutions-components/utils/test/downloadUtils.spec.js +102 -0
- package/dist/solutions-components/utils/test/mocks/jsApi.js +74 -0
- package/dist/solutions-components/utils/test/pciUtils.spec.js +297 -0
- package/dist/solutions-components/utils/test/solution-store.spec.js +439 -0
- package/dist/solutions-components/utils/test/testUtils.js +135 -0
- package/dist/solutions-components/utils/types.js +14 -0
- package/dist/solutions-components_commit.txt +7 -0
- package/package.json +7 -7
@@ -0,0 +1,53 @@
|
|
1
|
+
/** @license
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { h } from '@stencil/core';
|
17
|
+
import { newSpecPage } from '@stencil/core/testing';
|
18
|
+
import { MapSearch } from '../map-search';
|
19
|
+
import * as locale from "../../../utils/locale";
|
20
|
+
import * as translations from "../../../assets/t9n/map-search/resources.json";
|
21
|
+
jest.setTimeout(30000);
|
22
|
+
afterEach(() => {
|
23
|
+
jest.restoreAllMocks();
|
24
|
+
});
|
25
|
+
let mapView;
|
26
|
+
beforeEach(() => {
|
27
|
+
jest.spyOn(locale, "getLocaleComponentStrings").mockImplementation(() => [
|
28
|
+
translations
|
29
|
+
]);
|
30
|
+
mapView = {
|
31
|
+
map: {
|
32
|
+
layers: {
|
33
|
+
add: () => { },
|
34
|
+
getItemAt: () => { return -1; },
|
35
|
+
findIndex: () => { return -1; }
|
36
|
+
}
|
37
|
+
}
|
38
|
+
};
|
39
|
+
});
|
40
|
+
describe('map-search', () => {
|
41
|
+
xit('renders', async () => {
|
42
|
+
const page = await newSpecPage({
|
43
|
+
components: [MapSearch],
|
44
|
+
template: () => (h("map-search", { mapView: mapView })),
|
45
|
+
});
|
46
|
+
expect(page.root).toEqualHtml(`
|
47
|
+
<map-search>
|
48
|
+
<div class="search-widget"></div>
|
49
|
+
</map-search>
|
50
|
+
`);
|
51
|
+
await page.root.clear();
|
52
|
+
});
|
53
|
+
});
|
@@ -421,34 +421,37 @@ export class MapSelectTools {
|
|
421
421
|
*/
|
422
422
|
async _sketchGraphicsChanged(event, forceUpdate = false) {
|
423
423
|
const graphics = event.detail.graphics;
|
424
|
-
if (
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
this.
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
424
|
+
if (graphics.length > 0 && graphics[0]) {
|
425
|
+
if (!forceUpdate) {
|
426
|
+
this._sketchGraphic = graphics[0];
|
427
|
+
}
|
428
|
+
this._workflowType = this._useLayerFeaturesEnabled ? EWorkflowType.SELECT : EWorkflowType.SKETCH;
|
429
|
+
if (this._workflowType === EWorkflowType.SKETCH) {
|
430
|
+
this._drawTools.updateGraphics();
|
431
|
+
}
|
432
|
+
this._updateLabel();
|
433
|
+
this._clearSearchWidget();
|
434
|
+
if (this._useLayerFeaturesEnabled && !forceUpdate) {
|
435
|
+
// Will only ever be a single graphic
|
436
|
+
const geometries = Array.isArray(graphics) ? graphics.map(g => g.geometry) : this.geometries;
|
437
|
+
await this._selectLayerFeatures(geometries[0]);
|
438
|
+
}
|
439
|
+
else {
|
440
|
+
const oids = graphics.reduce((prev, cur) => {
|
441
|
+
var _a;
|
442
|
+
if ((_a = cur === null || cur === void 0 ? void 0 : cur.layer) === null || _a === void 0 ? void 0 : _a.objectIdField) {
|
443
|
+
prev.push(cur.attributes[cur.layer.objectIdField]);
|
444
|
+
}
|
445
|
+
else if (cur.getObjectId) {
|
446
|
+
prev.push(cur.getObjectId());
|
447
|
+
}
|
448
|
+
return prev;
|
449
|
+
}, []);
|
450
|
+
const useOIDs = event.detail.useOIDs && oids.length > 0;
|
451
|
+
this._updateSelection(graphics, useOIDs, oids);
|
452
|
+
if (useOIDs) {
|
453
|
+
await this._highlightFeatures(oids);
|
445
454
|
}
|
446
|
-
return prev;
|
447
|
-
}, []);
|
448
|
-
const useOIDs = event.detail.useOIDs && oids.length > 0;
|
449
|
-
this._updateSelection(graphics, useOIDs, oids);
|
450
|
-
if (useOIDs) {
|
451
|
-
await this._highlightFeatures(oids);
|
452
455
|
}
|
453
456
|
}
|
454
457
|
}
|
@@ -570,7 +573,6 @@ export class MapSelectTools {
|
|
570
573
|
this._selectedIds = [];
|
571
574
|
this._distance = undefined;
|
572
575
|
this._unit = undefined;
|
573
|
-
this._sketchGraphic = undefined;
|
574
576
|
if (clearLabel) {
|
575
577
|
this._selectionLabel = "";
|
576
578
|
this._labelName.value = "";
|
@@ -737,14 +739,12 @@ export class MapSelectTools {
|
|
737
739
|
*/
|
738
740
|
_useLayerFeaturesEnabledChanged() {
|
739
741
|
this._useLayerFeaturesEnabled = !this._useLayerFeaturesEnabled;
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
});
|
747
|
-
}
|
742
|
+
void this._sketchGraphicsChanged({
|
743
|
+
detail: {
|
744
|
+
graphics: [this._sketchGraphic],
|
745
|
+
useOIDs: false
|
746
|
+
}
|
747
|
+
});
|
748
748
|
}
|
749
749
|
/**
|
750
750
|
* Fetches the component's translations
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/** @license
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { newE2EPage } from '@stencil/core/testing';
|
17
|
+
xdescribe('map-select-tools', () => {
|
18
|
+
it('renders', async () => {
|
19
|
+
const page = await newE2EPage();
|
20
|
+
await page.setContent('<map-select-tools></map-select-tools>');
|
21
|
+
const element = await page.find('map-select-tools');
|
22
|
+
expect(element).toHaveClass('hydrated');
|
23
|
+
});
|
24
|
+
});
|
@@ -0,0 +1,349 @@
|
|
1
|
+
/** @license
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { h } from '@stencil/core';
|
17
|
+
import { newSpecPage } from '@stencil/core/testing';
|
18
|
+
import { MapSelectTools } from '../map-select-tools';
|
19
|
+
import * as locale from "../../../utils/locale";
|
20
|
+
import * as translations from "../../../assets/t9n/map-select-tools/resources.json";
|
21
|
+
import { LayerView } from "../../../utils/test/mocks/jsApi";
|
22
|
+
import * as mapViewUtils from "../../../utils/mapViewUtils";
|
23
|
+
import * as queryUtils from "../../../utils/queryUtils";
|
24
|
+
import { EWorkflowType } from '../../../utils/interfaces';
|
25
|
+
jest.setTimeout(30000);
|
26
|
+
afterEach(() => {
|
27
|
+
jest.restoreAllMocks();
|
28
|
+
});
|
29
|
+
let mapView;
|
30
|
+
let _unknown;
|
31
|
+
beforeEach(() => {
|
32
|
+
jest.spyOn(locale, "getLocaleComponentStrings").mockImplementation(() => [
|
33
|
+
translations
|
34
|
+
]);
|
35
|
+
jest.spyOn(mapViewUtils, "highlightFeatures").mockImplementation(async () => {
|
36
|
+
return { remove: () => { } };
|
37
|
+
});
|
38
|
+
jest.spyOn(mapViewUtils, "goToSelection").mockImplementation(async () => { });
|
39
|
+
jest.spyOn(queryUtils, "getQueryGeoms").mockImplementation((geoms) => {
|
40
|
+
return geoms;
|
41
|
+
});
|
42
|
+
jest.spyOn(queryUtils, "queryObjectIds").mockImplementation(async (oids) => {
|
43
|
+
return oids.map((oid, i) => i);
|
44
|
+
});
|
45
|
+
jest.spyOn(console, 'warn').mockImplementation(() => { });
|
46
|
+
mapView = {
|
47
|
+
map: {
|
48
|
+
layers: {
|
49
|
+
add: () => { },
|
50
|
+
getItemAt: () => { return -1; },
|
51
|
+
findIndex: () => { return -1; }
|
52
|
+
}
|
53
|
+
}
|
54
|
+
};
|
55
|
+
_unknown = {};
|
56
|
+
});
|
57
|
+
xdescribe('map-select-tools', () => {
|
58
|
+
it('renders', async () => {
|
59
|
+
const page = await newSpecPage({
|
60
|
+
components: [MapSelectTools],
|
61
|
+
template: () => (h("map-select-tools", { mapView: mapView })),
|
62
|
+
});
|
63
|
+
expect(page.root).toEqualHtml(`
|
64
|
+
<map-select-tools>
|
65
|
+
<div class="padding-bottom-1">
|
66
|
+
<calcite-radio-group class="w-100">
|
67
|
+
<calcite-radio-group-item checked="" class="end-border w-50" value="SEARCH">
|
68
|
+
Search
|
69
|
+
</calcite-radio-group-item>
|
70
|
+
<calcite-radio-group-item class="w-50" value="SKETCH">
|
71
|
+
Sketch
|
72
|
+
</calcite-radio-group-item>
|
73
|
+
</calcite-radio-group>
|
74
|
+
</div>
|
75
|
+
<div class="div-visible-search">
|
76
|
+
<div class="search-widget"></div>
|
77
|
+
</div>
|
78
|
+
<div class="div-not-visible">
|
79
|
+
<calcite-label layout="inline">
|
80
|
+
<calcite-checkbox></calcite-checkbox>
|
81
|
+
Use layer features
|
82
|
+
</calcite-label>
|
83
|
+
</div>
|
84
|
+
<div class="div-not-visible">
|
85
|
+
<map-draw-tools active="" border=""></map-draw-tools>
|
86
|
+
</div>
|
87
|
+
<div class="div-not-visible">
|
88
|
+
<refine-selection-tools active="" border="" mode="ADD" refinemode="SUBSET"></refine-selection-tools>
|
89
|
+
</div>
|
90
|
+
<calcite-label class="search-distance">
|
91
|
+
Search Distance
|
92
|
+
<buffer-tools></buffer-tools>
|
93
|
+
</calcite-label>
|
94
|
+
</map-select-tools>
|
95
|
+
`);
|
96
|
+
const actual = await page.root.getSelection();
|
97
|
+
expect(actual.workflowType).toEqual(EWorkflowType.SEARCH);
|
98
|
+
expect(actual.selectedIds.length).toEqual(0);
|
99
|
+
});
|
100
|
+
it('fires selectionSetChange event when geometries are cleared', async () => {
|
101
|
+
const page = await newSpecPage({
|
102
|
+
components: [MapSelectTools],
|
103
|
+
template: () => (h("map-select-tools", { geometries: [_unknown], mapView: mapView })),
|
104
|
+
});
|
105
|
+
expect(page.root.geometries.length).toEqual(1);
|
106
|
+
page.doc.addEventListener("selectionSetChange", (evt) => {
|
107
|
+
expect(evt.detail).toEqual(0);
|
108
|
+
});
|
109
|
+
page.root.geometries = [];
|
110
|
+
});
|
111
|
+
it('fires selectionSetChange event when geometries are changed', async () => {
|
112
|
+
const page = await newSpecPage({
|
113
|
+
components: [MapSelectTools],
|
114
|
+
template: () => (h("map-select-tools", { geometries: [_unknown], mapView: mapView, selectLayerView: new LayerView() })),
|
115
|
+
});
|
116
|
+
expect(page.root.geometries.length).toEqual(1);
|
117
|
+
let selectionSetChange = (evt) => {
|
118
|
+
expect(evt.detail).toEqual(2);
|
119
|
+
};
|
120
|
+
page.doc.addEventListener("selectionSetChange", selectionSetChange);
|
121
|
+
page.root.geometries = [...page.root.geometries, _unknown];
|
122
|
+
});
|
123
|
+
it('clears geometries on clearSelection', async () => {
|
124
|
+
const page = await newSpecPage({
|
125
|
+
components: [MapSelectTools],
|
126
|
+
template: () => (h("map-select-tools", { geometries: [_unknown], mapView: mapView, selectLayerView: new LayerView() })),
|
127
|
+
});
|
128
|
+
expect(page.root.geometries.length).toEqual(1);
|
129
|
+
let selectionSetChange = (evt) => {
|
130
|
+
expect(evt.detail).toEqual(0);
|
131
|
+
};
|
132
|
+
page.doc.addEventListener("selectionSetChange", selectionSetChange);
|
133
|
+
page.root.clearSelection();
|
134
|
+
});
|
135
|
+
it('can reload existing SELECT selectionSet', async () => {
|
136
|
+
const layerView = new LayerView();
|
137
|
+
const selectionSet = {
|
138
|
+
id: 12345,
|
139
|
+
workflowType: EWorkflowType.SELECT,
|
140
|
+
searchResult: undefined,
|
141
|
+
buffer: _unknown,
|
142
|
+
distance: 100,
|
143
|
+
download: true,
|
144
|
+
unit: "feet",
|
145
|
+
label: "selection-label",
|
146
|
+
selectedIds: [0],
|
147
|
+
layerView,
|
148
|
+
geometries: [_unknown],
|
149
|
+
refineSelectLayers: [],
|
150
|
+
refineIds: undefined
|
151
|
+
};
|
152
|
+
const page = await newSpecPage({
|
153
|
+
components: [MapSelectTools],
|
154
|
+
template: () => (h("map-select-tools", { selectLayerView: layerView, selectionSet: selectionSet, mapView: mapView })),
|
155
|
+
});
|
156
|
+
page.doc.addEventListener("workflowTypeChange", (evt) => {
|
157
|
+
expect(evt.detail).toEqual(EWorkflowType.SELECT);
|
158
|
+
});
|
159
|
+
expect(page.root).toEqualHtml(`
|
160
|
+
<map-select-tools>
|
161
|
+
<div class="padding-bottom-1">
|
162
|
+
<calcite-radio-group class="w-100">
|
163
|
+
<calcite-radio-group-item class="end-border w-50" value="SEARCH">
|
164
|
+
Search
|
165
|
+
</calcite-radio-group-item>
|
166
|
+
<calcite-radio-group-item checked="" class="w-50" value="SKETCH">
|
167
|
+
Sketch
|
168
|
+
</calcite-radio-group-item>
|
169
|
+
</calcite-radio-group>
|
170
|
+
</div>
|
171
|
+
<div class="div-not-visible">
|
172
|
+
<div class="search-widget"></div>
|
173
|
+
</div>
|
174
|
+
<div class="div-visible">
|
175
|
+
<calcite-label layout="inline">
|
176
|
+
<calcite-checkbox></calcite-checkbox>
|
177
|
+
Use layer features
|
178
|
+
</calcite-label>
|
179
|
+
</div>
|
180
|
+
<div class="div-visible">
|
181
|
+
<map-draw-tools active="" border=""></map-draw-tools>
|
182
|
+
</div>
|
183
|
+
<div class="div-not-visible">
|
184
|
+
<refine-selection-tools active="" border="" mode="ADD" refinemode="SUBSET"></refine-selection-tools>
|
185
|
+
</div>
|
186
|
+
<calcite-label class="search-distance">
|
187
|
+
Search Distance
|
188
|
+
<buffer-tools distance="100" unit="feet"></buffer-tools>
|
189
|
+
</calcite-label>
|
190
|
+
</map-select-tools>
|
191
|
+
`);
|
192
|
+
const actual = await page.root.getSelection();
|
193
|
+
expect(actual.label.startsWith("Layer")).toEqual(true);
|
194
|
+
});
|
195
|
+
it('can reload existing SKETCH selectionSet', async () => {
|
196
|
+
const layerView = new LayerView();
|
197
|
+
const selectionSet = {
|
198
|
+
id: 12345,
|
199
|
+
workflowType: EWorkflowType.SKETCH,
|
200
|
+
searchResult: undefined,
|
201
|
+
buffer: _unknown,
|
202
|
+
distance: 100,
|
203
|
+
download: true,
|
204
|
+
unit: "feet",
|
205
|
+
label: "selection-label",
|
206
|
+
selectedIds: [0],
|
207
|
+
layerView,
|
208
|
+
geometries: [_unknown],
|
209
|
+
refineSelectLayers: [],
|
210
|
+
refineIds: undefined
|
211
|
+
};
|
212
|
+
const page = await newSpecPage({
|
213
|
+
components: [MapSelectTools],
|
214
|
+
template: () => (h("map-select-tools", { selectLayerView: layerView, selectionSet: selectionSet, mapView: mapView })),
|
215
|
+
});
|
216
|
+
page.doc.addEventListener("workflowTypeChange", (evt) => {
|
217
|
+
expect(evt.detail).toEqual(EWorkflowType.SKETCH);
|
218
|
+
});
|
219
|
+
expect(page.root).toEqualHtml(`
|
220
|
+
<map-select-tools>
|
221
|
+
<div class="padding-bottom-1">
|
222
|
+
<calcite-radio-group class="w-100">
|
223
|
+
<calcite-radio-group-item class="end-border w-50" value="SEARCH">
|
224
|
+
Search
|
225
|
+
</calcite-radio-group-item>
|
226
|
+
<calcite-radio-group-item checked="" class="w-50" value="SKETCH">
|
227
|
+
Sketch
|
228
|
+
</calcite-radio-group-item>
|
229
|
+
</calcite-radio-group>
|
230
|
+
</div>
|
231
|
+
<div class="div-not-visible">
|
232
|
+
<div class="search-widget"></div>
|
233
|
+
</div>
|
234
|
+
<div class="div-visible">
|
235
|
+
<calcite-label layout="inline">
|
236
|
+
<calcite-checkbox></calcite-checkbox>
|
237
|
+
Use layer features
|
238
|
+
</calcite-label>
|
239
|
+
</div>
|
240
|
+
<div class="div-visible">
|
241
|
+
<map-draw-tools active="" border=""></map-draw-tools>
|
242
|
+
</div>
|
243
|
+
<div class="div-not-visible">
|
244
|
+
<refine-selection-tools active="" border="" mode="ADD" refinemode="SUBSET"></refine-selection-tools>
|
245
|
+
</div>
|
246
|
+
<calcite-label class="search-distance">
|
247
|
+
Search Distance
|
248
|
+
<buffer-tools distance="100" unit="feet"></buffer-tools>
|
249
|
+
</calcite-label>
|
250
|
+
</map-select-tools>
|
251
|
+
`);
|
252
|
+
const actual = await page.root.getSelection();
|
253
|
+
expect(actual.label.startsWith("Sketch")).toEqual(true);
|
254
|
+
});
|
255
|
+
it('can reload existing SEARCH selectionSet', async () => {
|
256
|
+
const layerView = new LayerView();
|
257
|
+
const selectionSet = {
|
258
|
+
id: 12345,
|
259
|
+
workflowType: EWorkflowType.SEARCH,
|
260
|
+
searchResult: undefined,
|
261
|
+
buffer: _unknown,
|
262
|
+
distance: 100,
|
263
|
+
download: true,
|
264
|
+
unit: "feet",
|
265
|
+
label: "selection-label",
|
266
|
+
selectedIds: [0, 1],
|
267
|
+
layerView,
|
268
|
+
geometries: [_unknown, _unknown],
|
269
|
+
refineSelectLayers: [],
|
270
|
+
refineIds: undefined
|
271
|
+
};
|
272
|
+
const page = await newSpecPage({
|
273
|
+
components: [MapSelectTools],
|
274
|
+
template: () => (h("map-select-tools", { isUpdate: true, selectLayerView: layerView, selectionSet: selectionSet, mapView: mapView })),
|
275
|
+
});
|
276
|
+
page.doc.addEventListener("workflowTypeChange", (evt) => {
|
277
|
+
expect(evt.detail).toEqual(EWorkflowType.SEARCH);
|
278
|
+
});
|
279
|
+
expect(page.root).toEqualHtml(`
|
280
|
+
<map-select-tools>
|
281
|
+
<div class="padding-bottom-1">
|
282
|
+
<calcite-radio-group class="w-100">
|
283
|
+
<calcite-radio-group-item checked="" class="end-border w-50" value="SEARCH">
|
284
|
+
Search
|
285
|
+
</calcite-radio-group-item>
|
286
|
+
<calcite-radio-group-item class="w-50" value="SKETCH">
|
287
|
+
Sketch
|
288
|
+
</calcite-radio-group-item>
|
289
|
+
</calcite-radio-group>
|
290
|
+
</div>
|
291
|
+
<div class="div-visible-search">
|
292
|
+
<div class="search-widget"></div>
|
293
|
+
</div>
|
294
|
+
<div class="div-not-visible">
|
295
|
+
<calcite-label layout="inline">
|
296
|
+
<calcite-checkbox></calcite-checkbox>
|
297
|
+
Use layer features
|
298
|
+
</calcite-label>
|
299
|
+
</div>
|
300
|
+
<div class="div-not-visible">
|
301
|
+
<map-draw-tools active="" border=""></map-draw-tools>
|
302
|
+
</div>
|
303
|
+
<div class="div-not-visible">
|
304
|
+
<refine-selection-tools active="" border="" mode="ADD" refinemode="SUBSET"></refine-selection-tools>
|
305
|
+
</div>
|
306
|
+
<calcite-label class="search-distance">
|
307
|
+
Search Distance
|
308
|
+
<buffer-tools distance="100" unit="feet"></buffer-tools>
|
309
|
+
</calcite-label>
|
310
|
+
</map-select-tools>
|
311
|
+
`);
|
312
|
+
const actual = await page.root.getSelection();
|
313
|
+
expect(actual.id).toEqual(selectionSet.id);
|
314
|
+
});
|
315
|
+
it('handles sketchGraphicsChange', async () => {
|
316
|
+
const page = await newSpecPage({
|
317
|
+
components: [MapSelectTools],
|
318
|
+
template: () => (h("map-select-tools", { geometries: [_unknown], mapView: mapView, selectLayerView: new LayerView() })),
|
319
|
+
});
|
320
|
+
expect(page.root.geometries.length).toEqual(1);
|
321
|
+
page.win.dispatchEvent(new CustomEvent("sketchGraphicsChange", { detail: [] }));
|
322
|
+
expect(page.root.geometries.length).toEqual(0);
|
323
|
+
_unknown = { geometry: {} };
|
324
|
+
page.win.dispatchEvent(new CustomEvent("sketchGraphicsChange", { detail: [_unknown, _unknown] }));
|
325
|
+
expect(page.root.geometries.length).toEqual(2);
|
326
|
+
page.win.dispatchEvent(new CustomEvent("sketchGraphicsChange", { detail: undefined }));
|
327
|
+
expect(page.root.geometries.length).toEqual(2);
|
328
|
+
});
|
329
|
+
it('handles sketchGraphicsChange', async () => {
|
330
|
+
const page = await newSpecPage({
|
331
|
+
components: [MapSelectTools],
|
332
|
+
template: () => (h("map-select-tools", { geometries: [], mapView: mapView, selectLayerView: new LayerView() })),
|
333
|
+
});
|
334
|
+
page.win.dispatchEvent(new CustomEvent("layerSelectionGraphicsChange", { detail: undefined }));
|
335
|
+
expect(page.root.geometries.length).toEqual(0);
|
336
|
+
page.doc.addEventListener("selectionSetChange", (evt) => {
|
337
|
+
expect(evt.detail).toEqual(1);
|
338
|
+
});
|
339
|
+
_unknown = {
|
340
|
+
attributes: { "OID": 1 },
|
341
|
+
layer: {
|
342
|
+
objectIdField: "OID"
|
343
|
+
},
|
344
|
+
geometry: {}
|
345
|
+
};
|
346
|
+
page.win.dispatchEvent(new CustomEvent("layerSelectionGraphicsChange", { detail: [_unknown] }));
|
347
|
+
expect(page.root.geometries.length).toEqual(1);
|
348
|
+
});
|
349
|
+
});
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/** @license
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { newE2EPage } from '@stencil/core/testing';
|
17
|
+
xdescribe('media-card', () => {
|
18
|
+
it('renders', async () => {
|
19
|
+
const page = await newE2EPage();
|
20
|
+
await page.setContent('<media-card></media-card>');
|
21
|
+
const element = await page.find('media-card');
|
22
|
+
expect(element).toHaveClass('hydrated');
|
23
|
+
});
|
24
|
+
});
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/** @license
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { newSpecPage } from '@stencil/core/testing';
|
17
|
+
import { MediaCard } from '../media-card';
|
18
|
+
xdescribe('media-card', () => {
|
19
|
+
it('renders', async () => {
|
20
|
+
const page = await newSpecPage({
|
21
|
+
components: [MediaCard],
|
22
|
+
html: `<media-card></media-card>`,
|
23
|
+
});
|
24
|
+
expect(page.root).toEqualHtml(`
|
25
|
+
<media-card>
|
26
|
+
<mock:shadow-root>
|
27
|
+
<slot></slot>
|
28
|
+
</mock:shadow-root>
|
29
|
+
</media-card>
|
30
|
+
`);
|
31
|
+
});
|
32
|
+
});
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/** @license
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { newE2EPage } from '@stencil/core/testing';
|
17
|
+
xdescribe('pci-calculator', () => {
|
18
|
+
it('renders', async () => {
|
19
|
+
const page = await newE2EPage();
|
20
|
+
await page.setContent('<pci-calculator></pci-calculator>');
|
21
|
+
const element = await page.find('pci-calculator');
|
22
|
+
expect(element).toHaveClass('hydrated');
|
23
|
+
});
|
24
|
+
});
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/** @license
|
2
|
+
* Copyright 2022 Esri
|
3
|
+
*
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
* you may not use this file except in compliance with the License.
|
6
|
+
* You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
import { newSpecPage } from '@stencil/core/testing';
|
17
|
+
import { PciCalculator } from '../pci-calculator';
|
18
|
+
xdescribe('pci-calculator', () => {
|
19
|
+
it('renders', async () => {
|
20
|
+
const page = await newSpecPage({
|
21
|
+
components: [PciCalculator],
|
22
|
+
html: `<pci-calculator></pci-calculator>`,
|
23
|
+
});
|
24
|
+
expect(page.root).toEqualHtml(`
|
25
|
+
<pci-calculator>
|
26
|
+
<mock:shadow-root>
|
27
|
+
<slot></slot>
|
28
|
+
</mock:shadow-root>
|
29
|
+
</pci-calculator>
|
30
|
+
`);
|
31
|
+
});
|
32
|
+
});
|