@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,71 @@
|
|
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
|
+
import * as locale from "../../../utils/locale";
|
18
|
+
import * as translations from "../../../assets/t9n/pdf-download/resources.json";
|
19
|
+
import { LayerView } from "../../../utils/test/mocks/jsApi";
|
20
|
+
jest.setTimeout(60000);
|
21
|
+
afterEach(() => {
|
22
|
+
jest.restoreAllMocks();
|
23
|
+
});
|
24
|
+
beforeEach(() => {
|
25
|
+
jest.spyOn(locale, "getLocaleComponentStrings").mockImplementation(() => [
|
26
|
+
translations
|
27
|
+
]);
|
28
|
+
});
|
29
|
+
xdescribe('pdf-download', () => {
|
30
|
+
it('renders', async (done) => {
|
31
|
+
const page = await newE2EPage();
|
32
|
+
await page.setContent('<pdf-download></pdf-download>');
|
33
|
+
const element = await page.find('pdf-download');
|
34
|
+
expect(element).toHaveClass('hydrated');
|
35
|
+
expect(element).toEqualHtml(`
|
36
|
+
<pdf-download class="hydrated">
|
37
|
+
<mock:shadow-root>
|
38
|
+
<calcite-select aria-disabled="true" class="hydrated" disabled="" scale="m" tabindex="-1" width="auto">
|
39
|
+
<calcite-option class="hydrated" selected="">
|
40
|
+
6 per page | 4 x 3-1/3
|
41
|
+
</calcite-option>
|
42
|
+
<calcite-option class="hydrated">
|
43
|
+
10 per page | 4 x 2
|
44
|
+
</calcite-option>
|
45
|
+
<calcite-option class="hydrated">
|
46
|
+
14 per page | 4 x 1-1/3
|
47
|
+
</calcite-option>
|
48
|
+
<calcite-option class="hydrated">
|
49
|
+
20 per page | 4 x 1
|
50
|
+
</calcite-option>
|
51
|
+
<calcite-option class="hydrated">
|
52
|
+
30 per page | 2-5/8 x 1
|
53
|
+
</calcite-option>
|
54
|
+
<calcite-option class="hydrated">
|
55
|
+
60 per page | 1-3/4 x 2/3
|
56
|
+
</calcite-option>
|
57
|
+
<calcite-option class="hydrated">
|
58
|
+
80 per page | 1-3/4 x 1/2
|
59
|
+
</calcite-option>
|
60
|
+
</calcite-select>
|
61
|
+
</mock:shadow-root>
|
62
|
+
</pdf-download>
|
63
|
+
`);
|
64
|
+
const layerView = new LayerView();
|
65
|
+
await element.setProperty("layerView", layerView);
|
66
|
+
await page.waitForChanges();
|
67
|
+
window.alert = jest.fn();
|
68
|
+
await element.callMethod("downloadPDF", [], true);
|
69
|
+
done();
|
70
|
+
});
|
71
|
+
});
|
@@ -0,0 +1,104 @@
|
|
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 * as PdfDownload from '../pdf-download';
|
19
|
+
import * as locale from "../../../utils/locale";
|
20
|
+
import * as translations from "../../../assets/t9n/pdf-download/resources.json";
|
21
|
+
import * as csvUtils from "../../../utils/csvUtils";
|
22
|
+
import { LayerView } from "../../../utils/test/mocks/jsApi";
|
23
|
+
jest.setTimeout(30000);
|
24
|
+
afterEach(() => {
|
25
|
+
jest.restoreAllMocks();
|
26
|
+
});
|
27
|
+
beforeEach(() => {
|
28
|
+
jest.spyOn(locale, "getLocaleComponentStrings").mockImplementation(() => [
|
29
|
+
translations
|
30
|
+
]);
|
31
|
+
});
|
32
|
+
describe('pdf-download', () => {
|
33
|
+
xit('renders', async () => {
|
34
|
+
const page = await newSpecPage({
|
35
|
+
components: [PdfDownload],
|
36
|
+
template: () => (h("pdf-download", null)),
|
37
|
+
});
|
38
|
+
expect(page.root).toEqualHtml(`
|
39
|
+
<pdf-download>
|
40
|
+
<mock:shadow-root>
|
41
|
+
<calcite-select disabled="" label="">
|
42
|
+
<calcite-option>
|
43
|
+
6 per page | 4 x 3-1/3
|
44
|
+
</calcite-option>
|
45
|
+
<calcite-option>
|
46
|
+
10 per page | 4 x 2
|
47
|
+
</calcite-option>
|
48
|
+
<calcite-option>
|
49
|
+
14 per page | 4 x 1-1/3
|
50
|
+
</calcite-option>
|
51
|
+
<calcite-option>
|
52
|
+
20 per page | 4 x 1
|
53
|
+
</calcite-option>
|
54
|
+
<calcite-option>
|
55
|
+
30 per page | 2-5/8 x 1
|
56
|
+
</calcite-option>
|
57
|
+
<calcite-option>
|
58
|
+
60 per page | 1-3/4 x 2/3
|
59
|
+
</calcite-option>
|
60
|
+
<calcite-option>
|
61
|
+
80 per page | 1-3/4 x 1/2
|
62
|
+
</calcite-option>
|
63
|
+
</calcite-select>
|
64
|
+
</mock:shadow-root>
|
65
|
+
</pdf-download>
|
66
|
+
`);
|
67
|
+
});
|
68
|
+
xit('downloads csv', async () => {
|
69
|
+
const exportCSVMock = jest.fn();
|
70
|
+
jest.spyOn(csvUtils, "exportCSV").mockImplementation(exportCSVMock);
|
71
|
+
const consoleLogMock = jest.fn();
|
72
|
+
jest.spyOn(console, "log").mockImplementation(consoleLogMock);
|
73
|
+
const layerView = new LayerView();
|
74
|
+
const page = await newSpecPage({
|
75
|
+
components: [PdfDownload],
|
76
|
+
template: () => (h("pdf-download", { layerView: layerView })),
|
77
|
+
});
|
78
|
+
await page.root.downloadCSV([], true);
|
79
|
+
expect(exportCSVMock).toBeCalledTimes(1);
|
80
|
+
expect(consoleLogMock).toBeCalledTimes(1);
|
81
|
+
expect(consoleLogMock).toBeCalledWith(true);
|
82
|
+
await page.root.downloadCSV([], false);
|
83
|
+
expect(exportCSVMock).toBeCalledTimes(2);
|
84
|
+
expect(consoleLogMock).toBeCalledTimes(2);
|
85
|
+
expect(consoleLogMock).toBeCalledWith(false);
|
86
|
+
});
|
87
|
+
// it('downloads pdf', async () => {
|
88
|
+
// const layerView = new LayerView() as unknown as any;
|
89
|
+
// const page = await newSpecPage({
|
90
|
+
// components: [PdfDownload],
|
91
|
+
// template: () => (<pdf-download layerView={layerView}></pdf-download>),
|
92
|
+
// supportsShadowDom: true,
|
93
|
+
// autoApplyChanges: true,
|
94
|
+
// });
|
95
|
+
// const sel = page.root.shadowRoot.querySelector("calcite-option");
|
96
|
+
// //.getElementsByTagName("calcite-option");
|
97
|
+
// sel[0].selected = true;
|
98
|
+
// //expect(sel.length).toEqual(0);
|
99
|
+
// const tempAlertMock = jest.fn();
|
100
|
+
// jest.spyOn(page.win, "alert").mockImplementation(tempAlertMock);
|
101
|
+
// await page.root.downloadPDF([], true);
|
102
|
+
// expect(tempAlertMock).toBeCalledTimes(1);
|
103
|
+
// });
|
104
|
+
});
|
@@ -0,0 +1,95 @@
|
|
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
|
+
import * as locale from "../../../utils/locale";
|
18
|
+
;
|
19
|
+
import * as translations from "../../../assets/t9n/public-notification/resources.json";
|
20
|
+
import * as queryUtils from "../../../utils/queryUtils";
|
21
|
+
import * as mapViewUtils from "../../../utils/mapViewUtils";
|
22
|
+
import * as publicNotificationUtils from "../../../utils/publicNotificationUtils";
|
23
|
+
jest.setTimeout(50000);
|
24
|
+
afterEach(() => {
|
25
|
+
jest.restoreAllMocks();
|
26
|
+
});
|
27
|
+
let mapView;
|
28
|
+
beforeEach(() => {
|
29
|
+
jest.spyOn(locale, "getLocaleComponentStrings").mockImplementation(() => [
|
30
|
+
translations
|
31
|
+
]);
|
32
|
+
jest.spyOn(mapViewUtils, "highlightFeatures").mockImplementation(jest.fn());
|
33
|
+
jest.spyOn(publicNotificationUtils, "getSelectionIds").mockImplementation(jest.fn());
|
34
|
+
jest.spyOn(console, 'warn').mockImplementation(() => { });
|
35
|
+
mapView = {
|
36
|
+
map: {
|
37
|
+
layers: {
|
38
|
+
add: () => { },
|
39
|
+
getItemAt: () => { return -1; },
|
40
|
+
findIndex: () => { return -1; }
|
41
|
+
}
|
42
|
+
}
|
43
|
+
};
|
44
|
+
});
|
45
|
+
// This keeps timing out every so often...will look more
|
46
|
+
xdescribe('public-notification', () => {
|
47
|
+
it('renders', async () => {
|
48
|
+
jest.useFakeTimers();
|
49
|
+
const getSelectionSetQueryMock = jest.fn();
|
50
|
+
jest.spyOn(queryUtils, "getSelectionSetQuery").mockImplementation(getSelectionSetQueryMock);
|
51
|
+
const page = await newE2EPage();
|
52
|
+
await page.setContent('<public-notification></public-notification>');
|
53
|
+
await page.waitForChanges();
|
54
|
+
const element = await page.find('public-notification');
|
55
|
+
expect(element).toHaveClass('hydrated');
|
56
|
+
// These cause errors to be thrown
|
57
|
+
// element.setProperty("addresseeLayer", new LayerView() as unknown as any);
|
58
|
+
// element.setProperty("mapView", mapView);
|
59
|
+
// await page.waitForChanges();
|
60
|
+
const infoMessage = await element.find(".info-message");
|
61
|
+
expect(infoMessage.innerHTML).toContain(translations.noNotifications);
|
62
|
+
const notice = await page.find("calcite-notice");
|
63
|
+
expect(notice.innerText).toContain(translations.selectLayerAndAdd);
|
64
|
+
const addBtn = await element.find("calcite-button");
|
65
|
+
expect(addBtn.innerText).toContain(translations.add);
|
66
|
+
// TODO understand why this causes failures in the test
|
67
|
+
// this is really the only way to change pageType
|
68
|
+
//await addBtn.click();
|
69
|
+
//await page.waitForChanges();
|
70
|
+
});
|
71
|
+
it('renders with selection set', async () => {
|
72
|
+
jest.useFakeTimers();
|
73
|
+
const getSelectionSetQueryMock = jest.fn();
|
74
|
+
jest.spyOn(queryUtils, "getSelectionSetQuery").mockImplementation(getSelectionSetQueryMock);
|
75
|
+
const page = await newE2EPage();
|
76
|
+
await page.setContent('<public-notification></public-notification>');
|
77
|
+
await page.waitForChanges();
|
78
|
+
const element = await page.find('public-notification');
|
79
|
+
expect(element).toHaveClass('hydrated');
|
80
|
+
// These cause errors to be thrown
|
81
|
+
// element.setProperty("addresseeLayer", new LayerView() as unknown as any);
|
82
|
+
// element.setProperty("mapView", mapView);
|
83
|
+
//await page.waitForChanges();
|
84
|
+
const infoMessage = await element.find(".info-message");
|
85
|
+
expect(infoMessage.innerHTML).toContain(translations.noNotifications);
|
86
|
+
const notice = await page.find("calcite-notice");
|
87
|
+
expect(notice.innerText).toContain(translations.selectLayerAndAdd);
|
88
|
+
const addBtn = await element.find("calcite-button");
|
89
|
+
expect(addBtn.innerText).toContain(translations.add);
|
90
|
+
// TODO understand why this causes failures in the test
|
91
|
+
// this is really the only way to change pageType
|
92
|
+
//await addBtn.click();
|
93
|
+
//await page.waitForChanges();
|
94
|
+
});
|
95
|
+
});
|
@@ -0,0 +1,149 @@
|
|
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 { PublicNotification } from '../public-notification';
|
19
|
+
import * as locale from "../../../utils/locale";
|
20
|
+
import * as translations from "../../../assets/t9n/map-draw-tools/resources.json";
|
21
|
+
import { LayerView } from "../../../utils/test/mocks/jsApi";
|
22
|
+
import * as queryUtils from "../../../utils/queryUtils";
|
23
|
+
import { EWorkflowType } from "../../../utils/interfaces";
|
24
|
+
jest.setTimeout(30000);
|
25
|
+
afterEach(() => {
|
26
|
+
jest.restoreAllMocks();
|
27
|
+
});
|
28
|
+
let mapView;
|
29
|
+
beforeEach(() => {
|
30
|
+
jest.spyOn(locale, "getLocaleComponentStrings").mockImplementation(() => [
|
31
|
+
translations
|
32
|
+
]);
|
33
|
+
jest.spyOn(console, 'warn').mockImplementation(() => { });
|
34
|
+
mapView = {
|
35
|
+
map: {
|
36
|
+
layers: {
|
37
|
+
add: () => { },
|
38
|
+
getItemAt: () => { return -1; },
|
39
|
+
findIndex: () => { return -1; }
|
40
|
+
}
|
41
|
+
}
|
42
|
+
};
|
43
|
+
});
|
44
|
+
xdescribe('public-notification', () => {
|
45
|
+
it('renders', async () => {
|
46
|
+
const getSelectionSetQueryMock = jest.fn();
|
47
|
+
jest.spyOn(queryUtils, "getSelectionSetQuery").mockImplementation(getSelectionSetQueryMock);
|
48
|
+
const page = await newSpecPage({
|
49
|
+
autoApplyChanges: true,
|
50
|
+
components: [PublicNotification],
|
51
|
+
template: () => (h("public-notification", { "show-refine-selection": "true" })),
|
52
|
+
});
|
53
|
+
//page.rootInstance.showRefineSelection = true;
|
54
|
+
expect(page.root).toEqualHtml(`
|
55
|
+
<public-notification show-refine-selection="true">
|
56
|
+
<calcite-shell>
|
57
|
+
<calcite-action-bar class="action-bar-size border-bottom-1" expand-disabled="" layout="horizontal" slot="header">
|
58
|
+
<calcite-action-group class="action-center w-1-4" layout="horizontal">
|
59
|
+
<calcite-action active="" alignment="center" class="height-full width-full" icon="list-check" id="list-check" text=""></calcite-action>
|
60
|
+
<calcite-tooltip label="" placement="bottom" reference-element="list-check">
|
61
|
+
<span></span>
|
62
|
+
</calcite-tooltip>
|
63
|
+
</calcite-action-group>
|
64
|
+
<calcite-action-group class="action-center w-1-4" layout="horizontal">
|
65
|
+
<calcite-action alignment="center" class="height-full width-full" disabled="" icon="test-data" id="test-data" text=""></calcite-action>
|
66
|
+
<calcite-tooltip label="" placement="bottom" reference-element="test-data">
|
67
|
+
<span></span>
|
68
|
+
</calcite-tooltip>
|
69
|
+
</calcite-action-group>
|
70
|
+
<calcite-action-group class="action-center w-1-4" layout="horizontal">
|
71
|
+
<calcite-action alignment="center" class="height-full width-full" disabled="" icon="file-pdf" id="file-pdf" text=""></calcite-action>
|
72
|
+
<calcite-tooltip label="" placement="bottom" reference-element="file-pdf">
|
73
|
+
<span></span>
|
74
|
+
</calcite-tooltip>
|
75
|
+
</calcite-action-group>
|
76
|
+
<calcite-action-group class="action-center w-1-4" layout="horizontal">
|
77
|
+
<calcite-action alignment="center" class="height-full width-full" disabled="" icon="file-csv" id="file-csv" text=""></calcite-action>
|
78
|
+
<calcite-tooltip label="" placement="bottom" reference-element="file-csv">
|
79
|
+
<span></span>
|
80
|
+
</calcite-tooltip>
|
81
|
+
</calcite-action-group>
|
82
|
+
</calcite-action-bar>
|
83
|
+
<calcite-panel>
|
84
|
+
<div class="padding-top-sides-1">
|
85
|
+
<calcite-label class="font-bold"></calcite-label>
|
86
|
+
</div>
|
87
|
+
<div class="padding-sides-1">
|
88
|
+
<calcite-label></calcite-label>
|
89
|
+
</div>
|
90
|
+
<div class="info-message padding-bottom-1">
|
91
|
+
<calcite-input-message active="" class="info-blue" scale="m"></calcite-input-message>
|
92
|
+
</div>
|
93
|
+
<calcite-notice active="" class="padding-bottom-1 padding-sides-1" color="green" icon="lightbulb">
|
94
|
+
<div slot="message"></div>
|
95
|
+
</calcite-notice>
|
96
|
+
<div class="display-flex padding-sides-1">
|
97
|
+
<calcite-label class="font-bold width-full">
|
98
|
+
<map-layer-picker selectionmode="single"></map-layer-picker>
|
99
|
+
</calcite-label>
|
100
|
+
</div>
|
101
|
+
<div class="display-flex padding-1">
|
102
|
+
<calcite-button width="full"></calcite-button>
|
103
|
+
</div>
|
104
|
+
</calcite-panel>
|
105
|
+
</calcite-shell>
|
106
|
+
</public-notification>
|
107
|
+
`);
|
108
|
+
});
|
109
|
+
it('handles selectionSetsWatchHandler', async () => {
|
110
|
+
const getSelectionSetQueryMock = jest.fn();
|
111
|
+
jest.spyOn(queryUtils, "getSelectionSetQuery").mockImplementation(getSelectionSetQueryMock);
|
112
|
+
const page = await newSpecPage({
|
113
|
+
autoApplyChanges: true,
|
114
|
+
components: [PublicNotification],
|
115
|
+
template: () => (h("public-notification", { addresseeLayer: new LayerView(), mapView: mapView })),
|
116
|
+
});
|
117
|
+
page.win.dispatchEvent(new CustomEvent("selectionSetsChanged", { detail: [] }));
|
118
|
+
page.win.dispatchEvent(new CustomEvent("selectionSetsChanged", { detail: [{
|
119
|
+
id: 123456789,
|
120
|
+
workflowType: EWorkflowType.SKETCH,
|
121
|
+
searchResult: undefined,
|
122
|
+
buffer: {},
|
123
|
+
distance: 100,
|
124
|
+
download: true,
|
125
|
+
unit: "meters",
|
126
|
+
label: "Sketch 100",
|
127
|
+
selectedIds: [],
|
128
|
+
layerView: new LayerView(),
|
129
|
+
geometries: [],
|
130
|
+
refineSelectLayers: [],
|
131
|
+
refineIds: undefined
|
132
|
+
}] }));
|
133
|
+
page.win.dispatchEvent(new CustomEvent("selectionSetsChanged", { detail: [{
|
134
|
+
id: 123456789,
|
135
|
+
workflowType: EWorkflowType.REFINE,
|
136
|
+
searchResult: undefined,
|
137
|
+
buffer: {},
|
138
|
+
distance: 100,
|
139
|
+
download: true,
|
140
|
+
unit: "meters",
|
141
|
+
label: "Sketch 100",
|
142
|
+
selectedIds: [],
|
143
|
+
layerView: new LayerView(),
|
144
|
+
geometries: [],
|
145
|
+
refineSelectLayers: [],
|
146
|
+
refineIds: undefined
|
147
|
+
}] }));
|
148
|
+
});
|
149
|
+
});
|
@@ -1,86 +1,86 @@
|
|
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
|
-
|
17
|
-
:host {
|
18
|
-
display: block;
|
19
|
-
}
|
20
|
-
|
21
|
-
.div-visible {
|
22
|
-
display: inherit;
|
23
|
-
}
|
24
|
-
|
25
|
-
.div-not-visible {
|
26
|
-
display: none !important;
|
27
|
-
}
|
28
|
-
|
29
|
-
.padding-top-1-2 {
|
30
|
-
padding-top: .5rem;
|
31
|
-
}
|
32
|
-
|
33
|
-
.main-label {
|
34
|
-
display: flex;
|
35
|
-
float: left;
|
36
|
-
}
|
37
|
-
|
38
|
-
html[dir="rtl"] .main-label {
|
39
|
-
display: flex;
|
40
|
-
float: right;
|
41
|
-
}
|
42
|
-
|
43
|
-
.border {
|
44
|
-
outline: 1px solid var(--calcite-ui-border-input);
|
45
|
-
}
|
46
|
-
|
47
|
-
.margin-top-1 {
|
48
|
-
margin-top: 1rem;
|
49
|
-
}
|
50
|
-
|
51
|
-
/* COPY FROM JS */
|
52
|
-
.esri-sketch {
|
53
|
-
display: flex;
|
54
|
-
flex-flow: column wrap;
|
55
|
-
}
|
56
|
-
|
57
|
-
.esri-widget {
|
58
|
-
box-sizing: border-box;
|
59
|
-
color: #323232;
|
60
|
-
font-size: 14px;
|
61
|
-
font-family: "Avenir Next","Helvetica Neue",Helvetica,Arial,sans-serif;
|
62
|
-
line-height: 1.3em;
|
63
|
-
background-color: var(--calcite-ui-foreground-1);
|
64
|
-
}
|
65
|
-
|
66
|
-
/* DIV CHILD */
|
67
|
-
.esri-sketch__panel {
|
68
|
-
align-items: center;
|
69
|
-
display: flex;
|
70
|
-
flex-flow: row nowrap;
|
71
|
-
padding: 0;
|
72
|
-
} */
|
73
|
-
|
74
|
-
/* DIV CHILD CHILD */
|
75
|
-
.esri-sketch__tool-section {
|
76
|
-
border-right: 1px solid rgba(110,110,110,.3);
|
77
|
-
}
|
78
|
-
|
79
|
-
.esri-sketch__section {
|
80
|
-
align-items: center;
|
81
|
-
display: flex;
|
82
|
-
flex-flow: row nowrap;
|
83
|
-
padding: 0 7px;
|
84
|
-
margin: 6px 0;
|
85
|
-
border-right: 1px solid rgba(110,110,110,.3);
|
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
|
+
|
17
|
+
:host {
|
18
|
+
display: block;
|
19
|
+
}
|
20
|
+
|
21
|
+
.div-visible {
|
22
|
+
display: inherit;
|
23
|
+
}
|
24
|
+
|
25
|
+
.div-not-visible {
|
26
|
+
display: none !important;
|
27
|
+
}
|
28
|
+
|
29
|
+
.padding-top-1-2 {
|
30
|
+
padding-top: .5rem;
|
31
|
+
}
|
32
|
+
|
33
|
+
.main-label {
|
34
|
+
display: flex;
|
35
|
+
float: left;
|
36
|
+
}
|
37
|
+
|
38
|
+
html[dir="rtl"] .main-label {
|
39
|
+
display: flex;
|
40
|
+
float: right;
|
41
|
+
}
|
42
|
+
|
43
|
+
.border {
|
44
|
+
outline: 1px solid var(--calcite-ui-border-input);
|
45
|
+
}
|
46
|
+
|
47
|
+
.margin-top-1 {
|
48
|
+
margin-top: 1rem;
|
49
|
+
}
|
50
|
+
|
51
|
+
/* COPY FROM JS */
|
52
|
+
.esri-sketch {
|
53
|
+
display: flex;
|
54
|
+
flex-flow: column wrap;
|
55
|
+
}
|
56
|
+
|
57
|
+
.esri-widget {
|
58
|
+
box-sizing: border-box;
|
59
|
+
color: #323232;
|
60
|
+
font-size: 14px;
|
61
|
+
font-family: "Avenir Next","Helvetica Neue",Helvetica,Arial,sans-serif;
|
62
|
+
line-height: 1.3em;
|
63
|
+
background-color: var(--calcite-ui-foreground-1);
|
64
|
+
}
|
65
|
+
|
66
|
+
/* DIV CHILD */
|
67
|
+
.esri-sketch__panel {
|
68
|
+
align-items: center;
|
69
|
+
display: flex;
|
70
|
+
flex-flow: row nowrap;
|
71
|
+
padding: 0;
|
72
|
+
} */
|
73
|
+
|
74
|
+
/* DIV CHILD CHILD */
|
75
|
+
.esri-sketch__tool-section {
|
76
|
+
border-right: 1px solid rgba(110,110,110,.3);
|
77
|
+
}
|
78
|
+
|
79
|
+
.esri-sketch__section {
|
80
|
+
align-items: center;
|
81
|
+
display: flex;
|
82
|
+
flex-flow: row nowrap;
|
83
|
+
padding: 0 7px;
|
84
|
+
margin: 6px 0;
|
85
|
+
border-right: 1px solid rgba(110,110,110,.3);
|
86
86
|
}
|
@@ -0,0 +1,31 @@
|
|
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
|
+
describe('solution-configuration', () => {
|
18
|
+
it('renders', async () => {
|
19
|
+
//TEST commented out for now.
|
20
|
+
// need to work out how we pass translations
|
21
|
+
// e2e tests don't seem to support a similar apporach to the unit tests where we can use template to load JSX
|
22
|
+
// could flatten the translations further so it would contain no sub groups
|
23
|
+
// could set default translations for each file
|
24
|
+
// and could still have a test to compare the default with the actual as a way to verify
|
25
|
+
expect("a").toEqual("a");
|
26
|
+
// const page = await newE2EPage();
|
27
|
+
// await page.setContent('<solution-configuration></solution-configuration>');
|
28
|
+
// const element = await page.find('solution-configuration');
|
29
|
+
// expect(element).toHaveClass('hydrated');
|
30
|
+
});
|
31
|
+
});
|