@panoramax/web-viewer 4.4.0-develop-3839b5a4 → 4.4.0-develop-f91f6758
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{src → build}/components/core/Basic.js +22 -16
- package/{src → build}/components/core/CoverageMap.js +19 -14
- package/{src → build}/components/core/Editor.js +16 -16
- package/{src → build}/components/core/PhotoViewer.js +30 -29
- package/{src → build}/components/core/Viewer.js +21 -20
- package/build/components/core/index.js +10 -0
- package/build/components/index.js +11 -0
- package/build/components/index_photoviewer.js +6 -0
- package/{src → build}/components/layout/BottomDrawer.js +4 -4
- package/{src → build}/components/layout/CorneredGrid.js +1 -1
- package/{src → build}/components/layout/Mini.js +5 -4
- package/{src → build}/components/layout/Tabs.js +1 -1
- package/build/components/layout/index.js +9 -0
- package/{src → build}/components/menus/LocationPrecisionDoc.js +4 -6
- package/{src → build}/components/menus/MapBackground.js +4 -6
- package/{src → build}/components/menus/MapFilters.js +16 -21
- package/{src → build}/components/menus/MapLayers.js +20 -24
- package/{src → build}/components/menus/MapLegend.js +3 -4
- package/{src → build}/components/menus/MiniPictureLegend.js +3 -4
- package/{src → build}/components/menus/PictureLegend.js +10 -15
- package/{src → build}/components/menus/PictureMetadata.js +12 -19
- package/{src → build}/components/menus/PlayerOptions.js +5 -7
- package/{src → build}/components/menus/QualityScoreDoc.js +3 -4
- package/{src → build}/components/menus/ReportForm.js +8 -9
- package/{src → build}/components/menus/SemanticsDoc.js +3 -4
- package/{src → build}/components/menus/SemanticsDownload.js +3 -3
- package/{src → build}/components/menus/SemanticsFilters.js +7 -8
- package/{src → build}/components/menus/SemanticsList.js +11 -18
- package/{src → build}/components/menus/SemanticsMetadata.js +8 -11
- package/{src → build}/components/menus/Share.js +6 -7
- package/build/components/menus/index.js +22 -0
- package/build/components/menus/index_photoviewer.js +11 -0
- package/{src → build}/components/styles.js +0 -2
- package/{src → build}/components/ui/AnnotationsSwitch.js +6 -8
- package/{src → build}/components/ui/Button.js +1 -1
- package/{src → build}/components/ui/ButtonGroup.js +2 -1
- package/{src → build}/components/ui/CopyButton.js +4 -6
- package/{src → build}/components/ui/Grade.js +5 -5
- package/{src → build}/components/ui/GradeFilter.js +3 -3
- package/{src → build}/components/ui/IconSwitch.js +1 -1
- package/{src → build}/components/ui/LinkButton.js +1 -1
- package/{src → build}/components/ui/ListGroup.js +3 -3
- package/{src → build}/components/ui/ListItem.js +1 -1
- package/{src → build}/components/ui/Loader.js +8 -7
- package/{src → build}/components/ui/Map.js +38 -26
- package/{src → build}/components/ui/MapMore.js +7 -7
- package/{src → build}/components/ui/Photo.js +29 -27
- package/{src → build}/components/ui/Popup.js +4 -4
- package/{src → build}/components/ui/QualityScore.js +4 -4
- package/{src → build}/components/ui/SearchBar.js +6 -7
- package/{src → build}/components/ui/SemanticsEditor.js +14 -15
- package/{src → build}/components/ui/SemanticsTable.js +4 -5
- package/{src → build}/components/ui/Switch.js +1 -1
- package/{src → build}/components/ui/TogglableGroup.js +4 -4
- package/build/components/ui/index.js +29 -0
- package/build/components/ui/index_photoviewer.js +21 -0
- package/{src → build}/components/ui/widgets/CopyCoordinates.js +5 -5
- package/{src → build}/components/ui/widgets/GeoSearch.js +10 -10
- package/{src → build}/components/ui/widgets/Legend.js +9 -8
- package/{src → build}/components/ui/widgets/LevelSelect.js +9 -7
- package/{src → build}/components/ui/widgets/MapFiltersButton.js +5 -5
- package/{src → build}/components/ui/widgets/MapLayersButton.js +5 -5
- package/{src → build}/components/ui/widgets/OSMEditors.js +8 -8
- package/{src → build}/components/ui/widgets/PictureLegendActions.js +4 -4
- package/{src → build}/components/ui/widgets/Player.js +6 -7
- package/{src → build}/components/ui/widgets/SemanticsFiltersButton.js +6 -7
- package/{src → build}/components/ui/widgets/Zoom.js +6 -6
- package/build/components/ui/widgets/index.js +16 -0
- package/build/components/ui/widgets/index_photoviewer.js +7 -0
- package/build/editor.html +94 -10
- package/{src → build}/img/arrow_triangle.svg +0 -1
- package/{src → build}/img/arrow_turn.svg +0 -1
- package/build/index.html +111 -1
- package/build/index.js +6 -95
- package/build/index_photoviewer.js +4 -0
- package/build/map.html +97 -1
- package/build/package.json +141 -0
- package/build/photo.html +85 -1
- package/build/servers.js +3 -4
- package/{src → build}/utils/API.js +33 -33
- package/{src → build}/utils/InitParameters.js +11 -9
- package/{src → build}/utils/MapStyleComposer.js +39 -37
- package/{src → build}/utils/PhotoAdapter.js +1 -0
- package/{src → build}/utils/PresetsManager.js +4 -4
- package/{src → build}/utils/SemanticsMapProtocol.js +3 -4
- package/{src → build}/utils/URLHandler.js +16 -14
- package/{src → build}/utils/geocoder.js +5 -5
- package/{src → build}/utils/i18n.js +21 -20
- package/build/utils/index.js +17 -0
- package/build/utils/index_photoviewer.js +14 -0
- package/{src → build}/utils/indoor.js +9 -5
- package/{src → build}/utils/map.js +15 -11
- package/{src → build}/utils/picture.js +22 -17
- package/{src → build}/utils/semantics.js +9 -5
- package/{src → build}/utils/utils.js +8 -4
- package/{src → build}/utils/widgets.js +2 -2
- package/build/viewer.html +120 -35
- package/build/viewer_indoor.html +90 -8
- package/build/widgets.html +410 -1
- package/package.json +81 -204
- package/.dockerignore +0 -7
- package/.gitlab-ci.yml +0 -78
- package/CHANGELOG.md +0 -853
- package/CODE_OF_CONDUCT.md +0 -134
- package/Dockerfile +0 -14
- package/build/index.css +0 -36
- package/build/index.css.map +0 -1
- package/build/index.js.map +0 -1
- package/build/photoviewer.css +0 -36
- package/build/photoviewer.css.map +0 -1
- package/build/photoviewer.js +0 -86
- package/build/photoviewer.js.map +0 -1
- package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-400-normal..woff2 +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff +0 -0
- package/build/static/media/atkinson-hyperlegible-next-latin-ext-400-normal..woff2 +0 -0
- package/config/env.js +0 -104
- package/config/getHttpsConfig.js +0 -69
- package/config/getPackageJson.js +0 -25
- package/config/jest/babelTransform.js +0 -29
- package/config/jest/cssTransform.js +0 -14
- package/config/jest/fileTransform.js +0 -40
- package/config/jest/mocks.js +0 -230
- package/config/modules.js +0 -134
- package/config/paths.js +0 -76
- package/config/pnpTs.js +0 -35
- package/config/webpack/persistentCache/createEnvironmentHash.js +0 -9
- package/config/webpack.config.js +0 -825
- package/config/webpackDevServer.config.js +0 -131
- package/docs/03_URL_settings.md +0 -218
- package/docs/05_Compatibility.md +0 -83
- package/docs/09_Develop.md +0 -141
- package/docs/90_Releases.md +0 -27
- package/docs/images/class_diagram.drawio +0 -144
- package/docs/images/class_diagram.jpg +0 -0
- package/docs/images/comparative_3drender.jpg +0 -0
- package/docs/images/indoor_level.png +0 -0
- package/docs/images/screenshot.jpg +0 -0
- package/docs/index.md +0 -159
- package/docs/reference/components/core/Basic.md +0 -211
- package/docs/reference/components/core/CoverageMap.md +0 -220
- package/docs/reference/components/core/Editor.md +0 -252
- package/docs/reference/components/core/PhotoViewer.md +0 -320
- package/docs/reference/components/core/Viewer.md +0 -398
- package/docs/reference/components/layout/BottomDrawer.md +0 -35
- package/docs/reference/components/layout/CorneredGrid.md +0 -29
- package/docs/reference/components/layout/Mini.md +0 -45
- package/docs/reference/components/layout/Tabs.md +0 -46
- package/docs/reference/components/menus/LocationPrecisionDoc.md +0 -15
- package/docs/reference/components/menus/MapBackground.md +0 -32
- package/docs/reference/components/menus/MapFilters.md +0 -37
- package/docs/reference/components/menus/MapLayers.md +0 -15
- package/docs/reference/components/menus/MapLegend.md +0 -32
- package/docs/reference/components/menus/MiniPictureLegend.md +0 -15
- package/docs/reference/components/menus/PictureLegend.md +0 -45
- package/docs/reference/components/menus/PictureMetadata.md +0 -32
- package/docs/reference/components/menus/PlayerOptions.md +0 -15
- package/docs/reference/components/menus/QualityScoreDoc.md +0 -15
- package/docs/reference/components/menus/ReportForm.md +0 -15
- package/docs/reference/components/menus/SemanticsDoc.md +0 -15
- package/docs/reference/components/menus/SemanticsDownload.md +0 -15
- package/docs/reference/components/menus/SemanticsFilters.md +0 -33
- package/docs/reference/components/menus/SemanticsList.md +0 -97
- package/docs/reference/components/menus/SemanticsMetadata.md +0 -15
- package/docs/reference/components/menus/ShareMenu.md +0 -32
- package/docs/reference/components/ui/AnnotationsSwitch.md +0 -32
- package/docs/reference/components/ui/Button.md +0 -40
- package/docs/reference/components/ui/ButtonGroup.md +0 -36
- package/docs/reference/components/ui/CopyButton.md +0 -41
- package/docs/reference/components/ui/Grade.md +0 -32
- package/docs/reference/components/ui/GradeFilter.md +0 -42
- package/docs/reference/components/ui/IconSwitch.md +0 -53
- package/docs/reference/components/ui/LinkButton.md +0 -45
- package/docs/reference/components/ui/ListGroup.md +0 -22
- package/docs/reference/components/ui/ListItem.md +0 -39
- package/docs/reference/components/ui/Loader.md +0 -56
- package/docs/reference/components/ui/Map.md +0 -150
- package/docs/reference/components/ui/MapMore.md +0 -150
- package/docs/reference/components/ui/Photo.md +0 -495
- package/docs/reference/components/ui/Popup.md +0 -56
- package/docs/reference/components/ui/ProgressBar.md +0 -32
- package/docs/reference/components/ui/QualityScore.md +0 -45
- package/docs/reference/components/ui/SearchBar.md +0 -63
- package/docs/reference/components/ui/SemanticsEditor.md +0 -113
- package/docs/reference/components/ui/SemanticsTable.md +0 -32
- package/docs/reference/components/ui/Switch.md +0 -49
- package/docs/reference/components/ui/TogglableGroup.md +0 -39
- package/docs/reference/components/ui/widgets/CopyCoordinates.md +0 -32
- package/docs/reference/components/ui/widgets/GeoSearch.md +0 -36
- package/docs/reference/components/ui/widgets/Legend.md +0 -58
- package/docs/reference/components/ui/widgets/LevelSelect.md +0 -16
- package/docs/reference/components/ui/widgets/MapFiltersButton.md +0 -37
- package/docs/reference/components/ui/widgets/MapLayersButton.md +0 -15
- package/docs/reference/components/ui/widgets/OSMEditors.md +0 -15
- package/docs/reference/components/ui/widgets/PictureLegendActions.md +0 -32
- package/docs/reference/components/ui/widgets/Player.md +0 -34
- package/docs/reference/components/ui/widgets/SemanticsFiltersButton.md +0 -15
- package/docs/reference/components/ui/widgets/Zoom.md +0 -15
- package/docs/reference/utils/API.md +0 -389
- package/docs/reference/utils/InitParameters.md +0 -68
- package/docs/reference/utils/MapStyleComposer.md +0 -408
- package/docs/reference/utils/PanoraMapProtocol.md +0 -28
- package/docs/reference/utils/PresetsManager.md +0 -43
- package/docs/reference/utils/SemanticsMapProtocol.md +0 -43
- package/docs/reference/utils/URLHandler.md +0 -114
- package/docs/reference.md +0 -99
- package/docs/shortcuts.md +0 -11
- package/docs/tutorials/aerial_imagery.md +0 -21
- package/docs/tutorials/authentication.md +0 -10
- package/docs/tutorials/custom_widgets.md +0 -59
- package/docs/tutorials/indoor_maps.md +0 -50
- package/docs/tutorials/map_style.md +0 -83
- package/docs/tutorials/migrate_v4.md +0 -153
- package/docs/tutorials/migrate_v5.md +0 -103
- package/docs/tutorials/semantics_overlays.md +0 -74
- package/docs/tutorials/synced_coverage.md +0 -43
- package/mkdocs.yml +0 -131
- package/public/editor.html +0 -53
- package/public/index.html +0 -70
- package/public/map.html +0 -55
- package/public/photo.html +0 -43
- package/public/servers.js +0 -15
- package/public/viewer.html +0 -79
- package/public/viewer_indoor.html +0 -48
- package/public/widgets.html +0 -366
- package/scripts/build.js +0 -217
- package/scripts/doc.js +0 -79
- package/scripts/start.js +0 -172
- package/scripts/test.js +0 -52
- package/src/components/core/index.js +0 -12
- package/src/components/index.js +0 -13
- package/src/components/index_photoviewer.js +0 -8
- package/src/components/layout/index.js +0 -9
- package/src/components/menus/index.js +0 -22
- package/src/components/menus/index_photoviewer.js +0 -13
- package/src/components/ui/index.js +0 -29
- package/src/components/ui/index_photoviewer.js +0 -23
- package/src/components/ui/widgets/index.js +0 -16
- package/src/components/ui/widgets/index_photoviewer.js +0 -9
- package/src/index.js +0 -8
- package/src/index_photoviewer.js +0 -6
- package/src/utils/index.js +0 -17
- package/src/utils/index_photoviewer.js +0 -16
- package/tests/components/core/Basic.test.js +0 -168
- package/tests/components/core/BasicMock.js +0 -25
- package/tests/components/core/CoverageMap.test.js +0 -20
- package/tests/components/core/Editor.test.js +0 -20
- package/tests/components/core/PhotoViewer.test.js +0 -57
- package/tests/components/core/Viewer.test.js +0 -85
- package/tests/components/core/__snapshots__/PhotoViewer.test.js.snap +0 -96
- package/tests/components/core/__snapshots__/Viewer.test.js.snap +0 -188
- package/tests/components/ui/CopyButton.test.js +0 -52
- package/tests/components/ui/Loader.test.js +0 -55
- package/tests/components/ui/Map.test.js +0 -145
- package/tests/components/ui/Photo.test.js +0 -437
- package/tests/components/ui/Popup.test.js +0 -26
- package/tests/components/ui/QualityScore.test.js +0 -18
- package/tests/components/ui/SearchBar.test.js +0 -110
- package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +0 -33
- package/tests/components/ui/__snapshots__/Loader.test.js.snap +0 -56
- package/tests/components/ui/__snapshots__/Map.test.js.snap +0 -16
- package/tests/components/ui/__snapshots__/Photo.test.js.snap +0 -263
- package/tests/components/ui/__snapshots__/Popup.test.js.snap +0 -29
- package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +0 -11
- package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +0 -65
- package/tests/data/Map_geocoder_ban.json +0 -36
- package/tests/data/Map_geocoder_nominatim.json +0 -41
- package/tests/data/Viewer_pictures_1.json +0 -148
- package/tests/setupTests.js +0 -5
- package/tests/utils/API.test.js +0 -752
- package/tests/utils/InitParameters.test.js +0 -599
- package/tests/utils/MapStyleComposer.test.js +0 -697
- package/tests/utils/PresetsManager.test.js +0 -123
- package/tests/utils/URLHandler.test.js +0 -587
- package/tests/utils/__snapshots__/API.test.js.snap +0 -40
- package/tests/utils/__snapshots__/MapStyleComposer.test.js.snap +0 -767
- package/tests/utils/__snapshots__/URLHandler.test.js.snap +0 -21
- package/tests/utils/__snapshots__/geocoder.test.js.snap +0 -37
- package/tests/utils/__snapshots__/map.test.js.snap +0 -1249
- package/tests/utils/__snapshots__/picture.test.js.snap +0 -327
- package/tests/utils/__snapshots__/widgets.test.js.snap +0 -19
- package/tests/utils/geocoder.test.js +0 -37
- package/tests/utils/i18n.test.js +0 -111
- package/tests/utils/map.test.js +0 -200
- package/tests/utils/picture.test.js +0 -745
- package/tests/utils/semantics.test.js +0 -174
- package/tests/utils/utils.test.js +0 -358
- package/tests/utils/widgets.test.js +0 -31
- /package/{src → build}/components/core/Basic.css +0 -0
- /package/{src → build}/components/core/CoverageMap.css +0 -0
- /package/{src → build}/components/core/Editor.css +0 -0
- /package/{src → build}/components/core/PhotoViewer.css +0 -0
- /package/{src → build}/components/core/Viewer.css +0 -0
- /package/{src → build}/components/ui/ButtonGroup.css +0 -0
- /package/{src → build}/components/ui/Map.css +0 -0
- /package/{src → build}/components/ui/Photo.css +0 -0
- /package/{src → build}/components/ui/ProgressBar.js +0 -0
- /package/{src → build}/components/ui/widgets/GeoSearch.css +0 -0
- /package/{src → build}/components/ui/widgets/LevelSelect.css +0 -0
- /package/{src → build}/components/ui/widgets/Player.css +0 -0
- /package/{public → build}/favicon.ico +0 -0
- /package/{src → build}/img/arrow_360.svg +0 -0
- /package/{src → build}/img/arrow_flat.svg +0 -0
- /package/{src → build}/img/bg_aerial.jpg +0 -0
- /package/{src → build}/img/bg_streets.jpg +0 -0
- /package/{src → build}/img/loader_base.jpg +0 -0
- /package/{src → build}/img/logo_dead.svg +0 -0
- /package/{src → build}/img/marker.svg +0 -0
- /package/{src → build}/img/marker_blue.svg +0 -0
- /package/{src → build}/img/osm.svg +0 -0
- /package/{src → build}/img/panoramax.svg +0 -0
- /package/{src → build}/img/switch_big.svg +0 -0
- /package/{src → build}/img/switch_mini.svg +0 -0
- /package/{src → build}/img/wd.svg +0 -0
- /package/{src → build}/translations/ar.json +0 -0
- /package/{src → build}/translations/be.json +0 -0
- /package/{src → build}/translations/br.json +0 -0
- /package/{src → build}/translations/cy.json +0 -0
- /package/{src → build}/translations/da.json +0 -0
- /package/{src → build}/translations/de.json +0 -0
- /package/{src → build}/translations/en.json +0 -0
- /package/{src → build}/translations/eo.json +0 -0
- /package/{src → build}/translations/es.json +0 -0
- /package/{src → build}/translations/fi.json +0 -0
- /package/{src → build}/translations/fr.json +0 -0
- /package/{src → build}/translations/hu.json +0 -0
- /package/{src → build}/translations/it.json +0 -0
- /package/{src → build}/translations/ja.json +0 -0
- /package/{src → build}/translations/ko.json +0 -0
- /package/{src → build}/translations/nl.json +0 -0
- /package/{src → build}/translations/nn.json +0 -0
- /package/{src → build}/translations/pl.json +0 -0
- /package/{src → build}/translations/pt.json +0 -0
- /package/{src → build}/translations/pt_BR.json +0 -0
- /package/{src → build}/translations/sv.json +0 -0
- /package/{src → build}/translations/ti.json +0 -0
- /package/{src → build}/translations/tr.json +0 -0
- /package/{src → build}/translations/uk.json +0 -0
- /package/{src → build}/translations/zh_Hant.json +0 -0
- /package/{src → build}/utils/PanoraMapProtocol.js +0 -0
- /package/{src → build}/utils/services.js +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import Editor from "../../../src/components/core/Editor";
|
|
2
|
-
import "./BasicMock";
|
|
3
|
-
|
|
4
|
-
let comp;
|
|
5
|
-
global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
|
|
6
|
-
|
|
7
|
-
beforeEach(() => comp = new Editor());
|
|
8
|
-
afterEach(() => jest.clearAllMocks());
|
|
9
|
-
|
|
10
|
-
describe("getClassName", () => {
|
|
11
|
-
it("works", () => {
|
|
12
|
-
expect(comp.getClassName()).toBe("Editor");
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe("getSubComponentsNames", () => {
|
|
17
|
-
it("works", () => {
|
|
18
|
-
expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "map", "psv", "grid", "mapStyleComposer"]);
|
|
19
|
-
});
|
|
20
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import PhotoViewer from "../../../src/components/core/PhotoViewer";
|
|
2
|
-
import "./BasicMock";
|
|
3
|
-
|
|
4
|
-
let comp;
|
|
5
|
-
global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
|
|
6
|
-
|
|
7
|
-
beforeEach(() => comp = new PhotoViewer());
|
|
8
|
-
afterEach(() => jest.clearAllMocks());
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
describe("_initWidgets", () => {
|
|
12
|
-
let initParamsMock;
|
|
13
|
-
|
|
14
|
-
beforeEach(() => {
|
|
15
|
-
comp.grid.appendChild = jest.fn();
|
|
16
|
-
|
|
17
|
-
// Mock the return value of getParentPostInit
|
|
18
|
-
initParamsMock = {
|
|
19
|
-
widgets: "true",
|
|
20
|
-
focus: "pic",
|
|
21
|
-
picture: "somePicture",
|
|
22
|
-
};
|
|
23
|
-
comp._createInitParamsHandler();
|
|
24
|
-
comp._initParams.getParentPostInit = jest.fn();
|
|
25
|
-
comp._initParams.getParentPostInit.mockReturnValue(initParamsMock);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("should not add widgets if widgets is false", () => {
|
|
29
|
-
initParamsMock.widgets = "false";
|
|
30
|
-
comp._initWidgets();
|
|
31
|
-
expect(comp.grid.appendChild).not.toHaveBeenCalled();
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it("should handle widgets if width is not small", () => {
|
|
35
|
-
comp.isWidthSmall = () => false;
|
|
36
|
-
comp._initWidgets();
|
|
37
|
-
expect(comp.grid.appendChild).toMatchSnapshot();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("should handle widgets if width is small", () => {
|
|
41
|
-
comp.isWidthSmall = () => true;
|
|
42
|
-
comp._initWidgets();
|
|
43
|
-
expect(comp.grid.appendChild).toMatchSnapshot();
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
describe("getClassName", () => {
|
|
48
|
-
it("works", () => {
|
|
49
|
-
expect(comp.getClassName()).toBe("PhotoViewer");
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe("getSubComponentsNames", () => {
|
|
54
|
-
it("works", () => {
|
|
55
|
-
expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "psv", "grid", "popup", "urlHandler"]);
|
|
56
|
-
});
|
|
57
|
-
});
|
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import Viewer from "../../../src/components/core/Viewer";
|
|
2
|
-
import "./BasicMock";
|
|
3
|
-
|
|
4
|
-
jest.mock("../../../src/components/core/PhotoViewer", () => (
|
|
5
|
-
class PhotoViewer extends EventTarget {
|
|
6
|
-
constructor() {
|
|
7
|
-
super();
|
|
8
|
-
this.loader = { setAttribute: jest.fn() };
|
|
9
|
-
this.api = {
|
|
10
|
-
getMapStyle: () => ({}),
|
|
11
|
-
_getMapRequestTransform: () => ({}),
|
|
12
|
-
_endpoints: {},
|
|
13
|
-
};
|
|
14
|
-
this._t = { maplibre: {}, psv: {} };
|
|
15
|
-
this.grid = { appendChild: jest.fn() };
|
|
16
|
-
}
|
|
17
|
-
getAttribute() { return null; }
|
|
18
|
-
isWidthSmall() { return false; }
|
|
19
|
-
isWidthMedium() { return false; }
|
|
20
|
-
isHeightSmall() { return false; }
|
|
21
|
-
getSubComponentsNames() {
|
|
22
|
-
return ["loader", "api", "psv", "grid", "popup", "urlHandler"];
|
|
23
|
-
}
|
|
24
|
-
onceAPIReady() {
|
|
25
|
-
return Promise.resolve();
|
|
26
|
-
}
|
|
27
|
-
static GetJSONConverter() {
|
|
28
|
-
return {};
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
));
|
|
32
|
-
|
|
33
|
-
let comp;
|
|
34
|
-
global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
|
|
35
|
-
|
|
36
|
-
beforeEach(() => comp = new Viewer());
|
|
37
|
-
afterEach(() => jest.clearAllMocks());
|
|
38
|
-
|
|
39
|
-
describe("_initWidgets", () => {
|
|
40
|
-
let initParamsMock;
|
|
41
|
-
|
|
42
|
-
beforeEach(() => {
|
|
43
|
-
comp.grid.appendChild = jest.fn();
|
|
44
|
-
|
|
45
|
-
// Mock the return value of getParentPostInit
|
|
46
|
-
initParamsMock = {
|
|
47
|
-
widgets: "true",
|
|
48
|
-
focus: "pic",
|
|
49
|
-
picture: "somePicture",
|
|
50
|
-
};
|
|
51
|
-
comp._createInitParamsHandler();
|
|
52
|
-
comp._initParams.getParentPostInit = jest.fn();
|
|
53
|
-
comp._initParams.getParentPostInit.mockReturnValue(initParamsMock);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it("should not add widgets if widgets is false", () => {
|
|
57
|
-
initParamsMock.widgets = "false";
|
|
58
|
-
comp._initWidgets();
|
|
59
|
-
expect(comp.grid.appendChild).not.toHaveBeenCalled();
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it("should handle widgets if width is not small", () => {
|
|
63
|
-
comp.isWidthSmall = () => false;
|
|
64
|
-
comp._initWidgets();
|
|
65
|
-
expect(comp.grid.appendChild).toMatchSnapshot();
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it("should handle widgets if width is small", () => {
|
|
69
|
-
comp.isWidthSmall = () => true;
|
|
70
|
-
comp._initWidgets();
|
|
71
|
-
expect(comp.grid.appendChild).toMatchSnapshot();
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe("getClassName", () => {
|
|
76
|
-
it("works", () => {
|
|
77
|
-
expect(comp.getClassName()).toBe("Viewer");
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
describe("getSubComponentsNames", () => {
|
|
82
|
-
it("works", () => {
|
|
83
|
-
expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "psv", "grid", "popup", "urlHandler", "mini", "map", "mapStyleComposer"]);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
4
|
-
[MockFunction] {
|
|
5
|
-
"calls": Array [
|
|
6
|
-
Array [
|
|
7
|
-
<pnx-widget-player
|
|
8
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
9
|
-
size="xl"
|
|
10
|
-
slot="top"
|
|
11
|
-
/>,
|
|
12
|
-
],
|
|
13
|
-
Array [
|
|
14
|
-
<pnx-annotations-switch
|
|
15
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
16
|
-
size="xl"
|
|
17
|
-
slot="top"
|
|
18
|
-
/>,
|
|
19
|
-
],
|
|
20
|
-
Array [
|
|
21
|
-
<pnx-widget-zoom
|
|
22
|
-
class="pnx-print-hidden"
|
|
23
|
-
slot="bottom-right"
|
|
24
|
-
/>,
|
|
25
|
-
],
|
|
26
|
-
Array [
|
|
27
|
-
<pnx-widget-legend
|
|
28
|
-
focus="pic"
|
|
29
|
-
picture="somePicture"
|
|
30
|
-
slot="top-left"
|
|
31
|
-
/>,
|
|
32
|
-
],
|
|
33
|
-
],
|
|
34
|
-
"results": Array [
|
|
35
|
-
Object {
|
|
36
|
-
"type": "return",
|
|
37
|
-
"value": undefined,
|
|
38
|
-
},
|
|
39
|
-
Object {
|
|
40
|
-
"type": "return",
|
|
41
|
-
"value": undefined,
|
|
42
|
-
},
|
|
43
|
-
Object {
|
|
44
|
-
"type": "return",
|
|
45
|
-
"value": undefined,
|
|
46
|
-
},
|
|
47
|
-
Object {
|
|
48
|
-
"type": "return",
|
|
49
|
-
"value": undefined,
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
}
|
|
53
|
-
`;
|
|
54
|
-
|
|
55
|
-
exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
56
|
-
[MockFunction] {
|
|
57
|
-
"calls": Array [
|
|
58
|
-
Array [
|
|
59
|
-
<pnx-widget-player
|
|
60
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
61
|
-
size="xl"
|
|
62
|
-
slot="top"
|
|
63
|
-
/>,
|
|
64
|
-
],
|
|
65
|
-
Array [
|
|
66
|
-
<pnx-annotations-switch
|
|
67
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
68
|
-
size="xl"
|
|
69
|
-
slot="top"
|
|
70
|
-
/>,
|
|
71
|
-
],
|
|
72
|
-
Array [
|
|
73
|
-
<pnx-bottom-drawer
|
|
74
|
-
class="pnx-hidden"
|
|
75
|
-
slot="bottom"
|
|
76
|
-
>
|
|
77
|
-
<pnx-picture-legend />
|
|
78
|
-
</pnx-bottom-drawer>,
|
|
79
|
-
],
|
|
80
|
-
],
|
|
81
|
-
"results": Array [
|
|
82
|
-
Object {
|
|
83
|
-
"type": "return",
|
|
84
|
-
"value": undefined,
|
|
85
|
-
},
|
|
86
|
-
Object {
|
|
87
|
-
"type": "return",
|
|
88
|
-
"value": undefined,
|
|
89
|
-
},
|
|
90
|
-
Object {
|
|
91
|
-
"type": "return",
|
|
92
|
-
"value": undefined,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
}
|
|
96
|
-
`;
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`_initWidgets should handle widgets if width is not small 1`] = `
|
|
4
|
-
[MockFunction] {
|
|
5
|
-
"calls": Array [
|
|
6
|
-
Array [
|
|
7
|
-
<pnx-widget-zoom
|
|
8
|
-
class="pnx-print-hidden"
|
|
9
|
-
slot="bottom-right"
|
|
10
|
-
/>,
|
|
11
|
-
],
|
|
12
|
-
Array [
|
|
13
|
-
<pnx-widget-legend
|
|
14
|
-
focus="pic"
|
|
15
|
-
picture="somePicture"
|
|
16
|
-
slot="top-left"
|
|
17
|
-
/>,
|
|
18
|
-
],
|
|
19
|
-
Array [
|
|
20
|
-
<pnx-widget-player
|
|
21
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
22
|
-
size="xl"
|
|
23
|
-
slot="top"
|
|
24
|
-
/>,
|
|
25
|
-
],
|
|
26
|
-
Array [
|
|
27
|
-
<pnx-annotations-switch
|
|
28
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
29
|
-
size="xl"
|
|
30
|
-
slot="top"
|
|
31
|
-
/>,
|
|
32
|
-
],
|
|
33
|
-
Array [
|
|
34
|
-
<pnx-widget-geosearch
|
|
35
|
-
class="pnx-only-map pnx-print-hidden"
|
|
36
|
-
slot="top-left"
|
|
37
|
-
/>,
|
|
38
|
-
],
|
|
39
|
-
Array [
|
|
40
|
-
<pnx-widget-mapfilters
|
|
41
|
-
class="pnx-only-map pnx-print-hidden"
|
|
42
|
-
slot="top-left"
|
|
43
|
-
user-search="true"
|
|
44
|
-
/>,
|
|
45
|
-
],
|
|
46
|
-
Array [
|
|
47
|
-
<pnx-widget-semantics-filters
|
|
48
|
-
class="pnx-only-map pnx-print-hidden"
|
|
49
|
-
slot="top-left"
|
|
50
|
-
/>,
|
|
51
|
-
],
|
|
52
|
-
Array [
|
|
53
|
-
<pnx-widget-maplayers
|
|
54
|
-
class="pnx-only-map pnx-print-hidden"
|
|
55
|
-
slot="top-right"
|
|
56
|
-
/>,
|
|
57
|
-
],
|
|
58
|
-
],
|
|
59
|
-
"results": Array [
|
|
60
|
-
Object {
|
|
61
|
-
"type": "return",
|
|
62
|
-
"value": undefined,
|
|
63
|
-
},
|
|
64
|
-
Object {
|
|
65
|
-
"type": "return",
|
|
66
|
-
"value": undefined,
|
|
67
|
-
},
|
|
68
|
-
Object {
|
|
69
|
-
"type": "return",
|
|
70
|
-
"value": undefined,
|
|
71
|
-
},
|
|
72
|
-
Object {
|
|
73
|
-
"type": "return",
|
|
74
|
-
"value": undefined,
|
|
75
|
-
},
|
|
76
|
-
Object {
|
|
77
|
-
"type": "return",
|
|
78
|
-
"value": undefined,
|
|
79
|
-
},
|
|
80
|
-
Object {
|
|
81
|
-
"type": "return",
|
|
82
|
-
"value": undefined,
|
|
83
|
-
},
|
|
84
|
-
Object {
|
|
85
|
-
"type": "return",
|
|
86
|
-
"value": undefined,
|
|
87
|
-
},
|
|
88
|
-
Object {
|
|
89
|
-
"type": "return",
|
|
90
|
-
"value": undefined,
|
|
91
|
-
},
|
|
92
|
-
],
|
|
93
|
-
}
|
|
94
|
-
`;
|
|
95
|
-
|
|
96
|
-
exports[`_initWidgets should handle widgets if width is small 1`] = `
|
|
97
|
-
[MockFunction] {
|
|
98
|
-
"calls": Array [
|
|
99
|
-
Array [
|
|
100
|
-
<pnx-widget-zoom
|
|
101
|
-
class="pnx-only-map pnx-print-hidden"
|
|
102
|
-
slot="top-left"
|
|
103
|
-
/>,
|
|
104
|
-
],
|
|
105
|
-
Array [
|
|
106
|
-
<pnx-bottom-drawer
|
|
107
|
-
class="pnx-hidden"
|
|
108
|
-
slot="bottom"
|
|
109
|
-
>
|
|
110
|
-
<pnx-picture-legend />
|
|
111
|
-
</pnx-bottom-drawer>,
|
|
112
|
-
],
|
|
113
|
-
Array [
|
|
114
|
-
<pnx-widget-player
|
|
115
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
116
|
-
size="xl"
|
|
117
|
-
slot="top"
|
|
118
|
-
/>,
|
|
119
|
-
],
|
|
120
|
-
Array [
|
|
121
|
-
<pnx-annotations-switch
|
|
122
|
-
class="pnx-only-psv pnx-print-hidden"
|
|
123
|
-
size="xl"
|
|
124
|
-
slot="top"
|
|
125
|
-
/>,
|
|
126
|
-
],
|
|
127
|
-
Array [
|
|
128
|
-
<pnx-widget-geosearch
|
|
129
|
-
class="pnx-only-map pnx-print-hidden"
|
|
130
|
-
slot="top-right"
|
|
131
|
-
/>,
|
|
132
|
-
],
|
|
133
|
-
Array [
|
|
134
|
-
<pnx-widget-mapfilters
|
|
135
|
-
class="pnx-only-map pnx-print-hidden"
|
|
136
|
-
slot="top-right"
|
|
137
|
-
user-search="true"
|
|
138
|
-
/>,
|
|
139
|
-
],
|
|
140
|
-
Array [
|
|
141
|
-
<pnx-widget-semantics-filters
|
|
142
|
-
class="pnx-only-map pnx-print-hidden"
|
|
143
|
-
slot="top-right"
|
|
144
|
-
/>,
|
|
145
|
-
],
|
|
146
|
-
Array [
|
|
147
|
-
<pnx-widget-maplayers
|
|
148
|
-
class="pnx-only-map pnx-print-hidden"
|
|
149
|
-
slot="top-right"
|
|
150
|
-
/>,
|
|
151
|
-
],
|
|
152
|
-
],
|
|
153
|
-
"results": Array [
|
|
154
|
-
Object {
|
|
155
|
-
"type": "return",
|
|
156
|
-
"value": undefined,
|
|
157
|
-
},
|
|
158
|
-
Object {
|
|
159
|
-
"type": "return",
|
|
160
|
-
"value": undefined,
|
|
161
|
-
},
|
|
162
|
-
Object {
|
|
163
|
-
"type": "return",
|
|
164
|
-
"value": undefined,
|
|
165
|
-
},
|
|
166
|
-
Object {
|
|
167
|
-
"type": "return",
|
|
168
|
-
"value": undefined,
|
|
169
|
-
},
|
|
170
|
-
Object {
|
|
171
|
-
"type": "return",
|
|
172
|
-
"value": undefined,
|
|
173
|
-
},
|
|
174
|
-
Object {
|
|
175
|
-
"type": "return",
|
|
176
|
-
"value": undefined,
|
|
177
|
-
},
|
|
178
|
-
Object {
|
|
179
|
-
"type": "return",
|
|
180
|
-
"value": undefined,
|
|
181
|
-
},
|
|
182
|
-
Object {
|
|
183
|
-
"type": "return",
|
|
184
|
-
"value": undefined,
|
|
185
|
-
},
|
|
186
|
-
],
|
|
187
|
-
}
|
|
188
|
-
`;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import CopyButton from "../../../src/components/ui/CopyButton";
|
|
2
|
-
|
|
3
|
-
window.navigator.clipboard = { writeText: jest.fn() };
|
|
4
|
-
|
|
5
|
-
describe("constructor", () => {
|
|
6
|
-
it("listens to click", () => {
|
|
7
|
-
const cb = new CopyButton();
|
|
8
|
-
expect(cb._handlers).toMatchSnapshot();
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
describe("_onClick", () => {
|
|
13
|
-
it("works with text", () => {
|
|
14
|
-
const cb = new CopyButton();
|
|
15
|
-
cb.text = "I am a copy text";
|
|
16
|
-
cb._onClick(new Event("click"));
|
|
17
|
-
expect(cb._active).toBe(true);
|
|
18
|
-
expect(global.navigator.clipboard.writeText.mock.calls).toMatchSnapshot();
|
|
19
|
-
return new Promise(resolve => setTimeout(() => {
|
|
20
|
-
expect(cb._active).toBe(false);
|
|
21
|
-
resolve();
|
|
22
|
-
}, 2000));
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("works with input", () => {
|
|
26
|
-
const i = document.createElement("input");
|
|
27
|
-
i.value = "copy me from input";
|
|
28
|
-
i.id = "input-to-copy";
|
|
29
|
-
document.body.appendChild(i);
|
|
30
|
-
|
|
31
|
-
const cb = new CopyButton();
|
|
32
|
-
cb.input = "input-to-copy";
|
|
33
|
-
cb._onClick(new Event("click"));
|
|
34
|
-
|
|
35
|
-
expect(cb._active).toBe(true);
|
|
36
|
-
expect(global.navigator.clipboard.writeText.mock.calls).toMatchSnapshot();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it("works with textarea", () => {
|
|
40
|
-
const i = document.createElement("textarea");
|
|
41
|
-
i.appendChild(document.createTextNode("copy me from textarea"));
|
|
42
|
-
i.id = "textarea-to-copy";
|
|
43
|
-
document.body.appendChild(i);
|
|
44
|
-
|
|
45
|
-
const cb = new CopyButton();
|
|
46
|
-
cb.input = "textarea-to-copy";
|
|
47
|
-
cb._onClick(new Event("click"));
|
|
48
|
-
|
|
49
|
-
expect(cb._active).toBe(true);
|
|
50
|
-
expect(global.navigator.clipboard.writeText.mock.calls).toMatchSnapshot();
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import Loader from "../../../src/components/ui/Loader";
|
|
2
|
-
|
|
3
|
-
describe("constructor", () => {
|
|
4
|
-
it("works", () => {
|
|
5
|
-
const l = new Loader();
|
|
6
|
-
expect(l.isVisible()).toBe(true);
|
|
7
|
-
});
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
describe("dismiss", () => {
|
|
11
|
-
it("works on success", () => {
|
|
12
|
-
const p = { dispatchEvent: jest.fn() };
|
|
13
|
-
const l = new Loader();
|
|
14
|
-
l._parent = p;
|
|
15
|
-
l.dismiss();
|
|
16
|
-
|
|
17
|
-
expect(l.isVisible()).toBe(false);
|
|
18
|
-
expect(p.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
it("works on success + next fct", () => {
|
|
22
|
-
const p = { dispatchEvent: jest.fn() };
|
|
23
|
-
const n = jest.fn();
|
|
24
|
-
const l = new Loader();
|
|
25
|
-
l._parent = p;
|
|
26
|
-
l.dismiss(null, null, n);
|
|
27
|
-
|
|
28
|
-
expect(l.isVisible()).toBe(false);
|
|
29
|
-
expect(p.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
30
|
-
expect(n.mock.calls).toMatchSnapshot();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it("works with error", () => {
|
|
34
|
-
const p = { dispatchEvent: jest.fn(), _t: { pnx: {} } };
|
|
35
|
-
const l = new Loader();
|
|
36
|
-
l._parent = p;
|
|
37
|
-
expect(() => l.dismiss(true, "an error")).toThrow(new Error("an error"))
|
|
38
|
-
|
|
39
|
-
expect(l.isVisible()).toBe(true);
|
|
40
|
-
expect(p.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it("works with error + next fct", () => {
|
|
44
|
-
const p = { dispatchEvent: jest.fn(), _t: { pnx: {} } };
|
|
45
|
-
const n = jest.fn();
|
|
46
|
-
const l = new Loader();
|
|
47
|
-
l.addEventListener = jest.fn();
|
|
48
|
-
l._parent = p;
|
|
49
|
-
expect(() => l.dismiss(true, "an error", n)).toThrow(new Error("an error"))
|
|
50
|
-
|
|
51
|
-
expect(l.isVisible()).toBe(true);
|
|
52
|
-
expect(p.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
53
|
-
expect(l.addEventListener.mock.calls).toMatchSnapshot();
|
|
54
|
-
});
|
|
55
|
-
});
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import Map from "../../../src/components/ui/Map";
|
|
2
|
-
|
|
3
|
-
const createParent = () => {
|
|
4
|
-
const p = {
|
|
5
|
-
addEventListener: jest.fn(),
|
|
6
|
-
dispatchEvent: jest.fn(),
|
|
7
|
-
isWidthSmall: jest.fn(),
|
|
8
|
-
onceReady: () => Promise.resolve(),
|
|
9
|
-
onceAPIReady: () => Promise.resolve(),
|
|
10
|
-
api: {
|
|
11
|
-
onceReady: () => Promise.resolve(),
|
|
12
|
-
getDataBbox: jest.fn(),
|
|
13
|
-
getPicturesTilesUrl: jest.fn(),
|
|
14
|
-
_getMapRequestTransform: jest.fn(),
|
|
15
|
-
},
|
|
16
|
-
mapStyleComposer: {
|
|
17
|
-
panoramax: "default",
|
|
18
|
-
getMapStyle: jest.fn(),
|
|
19
|
-
updateMapStyle: jest.fn(),
|
|
20
|
-
addEventListener: jest.fn(),
|
|
21
|
-
registerSource: jest.fn(),
|
|
22
|
-
registerLayer: jest.fn(),
|
|
23
|
-
layerRanges: {
|
|
24
|
-
basemaps: {},
|
|
25
|
-
dataUnderlays: {},
|
|
26
|
-
panoramax: {},
|
|
27
|
-
dataOverlays: {},
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
_t: {
|
|
31
|
-
maplibre: {},
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
p.getAPI = () => p.api;
|
|
36
|
-
|
|
37
|
-
return p;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
describe("_postLoad", () => {
|
|
42
|
-
it("send ready event", async () => {
|
|
43
|
-
const p = createParent();
|
|
44
|
-
const c = document.createElement("div");
|
|
45
|
-
const m = new Map(p, c);
|
|
46
|
-
const listener = jest.fn();
|
|
47
|
-
m.addEventListener("ready", listener, { once: true });
|
|
48
|
-
|
|
49
|
-
await m._postLoad();
|
|
50
|
-
|
|
51
|
-
expect(listener).toHaveBeenCalledTimes(1);
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
describe("destroy", () => {
|
|
56
|
-
it("works", () => {
|
|
57
|
-
const p = createParent();
|
|
58
|
-
const c = document.createElement("div");
|
|
59
|
-
const m = new Map(p, c);
|
|
60
|
-
m.remove = jest.fn();
|
|
61
|
-
m.destroy();
|
|
62
|
-
expect(m.remove.mock.calls.length).toBe(1);
|
|
63
|
-
[
|
|
64
|
-
"_semMapProtocol", "_parent", "_options", "_attribution", "_picMarker",
|
|
65
|
-
"_picMarkerPreview", "_picPreviewTimer", "_picPopup", "_picThumbUrl", "_seqPictures"
|
|
66
|
-
].forEach(prop => expect(m[prop]).toBeUndefined());
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
describe("addSource", () => {
|
|
71
|
-
it("works", () => {
|
|
72
|
-
const p = createParent();
|
|
73
|
-
const c = document.createElement("div");
|
|
74
|
-
const m = new Map(p, c);
|
|
75
|
-
m.addSource("test", {});
|
|
76
|
-
expect(p.mapStyleComposer.registerSource.mock.calls).toEqual([["test", {}]]);
|
|
77
|
-
});
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
describe("addLayer", () => {
|
|
81
|
-
it("works", () => {
|
|
82
|
-
const p = createParent();
|
|
83
|
-
const c = document.createElement("div");
|
|
84
|
-
const m = new Map(p, c);
|
|
85
|
-
m.addLayer({id: "test"}, "other");
|
|
86
|
-
expect(p.mapStyleComposer.registerLayer.mock.calls).toEqual([[{id: "test"}, "other"]]);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
describe("reloadVectorTiles", () => {
|
|
91
|
-
it("works", () => {
|
|
92
|
-
const p = createParent();
|
|
93
|
-
const c = document.createElement("div");
|
|
94
|
-
const m = new Map(p, c);
|
|
95
|
-
const setter = jest.fn();
|
|
96
|
-
m.getSource = (user) => ({ tiles: [`https://bla.xyz/${user}/x/y/z`], setTiles: setter });
|
|
97
|
-
m._userLayers = ["geovisio", "toto"];
|
|
98
|
-
p.mapStyleComposer.layerRanges.panoramax = {
|
|
99
|
-
default: { sources: { geovisio: {} } },
|
|
100
|
-
toto: { sources: { geovisio_toto: {} } },
|
|
101
|
-
};
|
|
102
|
-
m.reloadVectorTiles();
|
|
103
|
-
expect(setter.mock.calls).toMatchSnapshot();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
describe("addEventListener", () => {
|
|
108
|
-
let map;
|
|
109
|
-
beforeEach(() => {
|
|
110
|
-
const p = createParent();
|
|
111
|
-
const c = document.createElement("div");
|
|
112
|
-
map = new Map(p, c);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
it("should add an event listener", () => {
|
|
116
|
-
const listener = jest.fn();
|
|
117
|
-
map.addEventListener("ready", listener);
|
|
118
|
-
map.fire("ready");
|
|
119
|
-
expect(listener).toHaveBeenCalled();
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it("should add an event listener that only fires once", () => {
|
|
123
|
-
const listener = jest.fn();
|
|
124
|
-
map.addEventListener("ready", listener, { once: true });
|
|
125
|
-
map.fire("ready");
|
|
126
|
-
map.fire("ready");
|
|
127
|
-
expect(listener).toHaveBeenCalledTimes(1);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it("should not add an event listener if options.once is false", () => {
|
|
131
|
-
const listener = jest.fn();
|
|
132
|
-
map.addEventListener("ready", listener, { once: false });
|
|
133
|
-
map.fire("ready");
|
|
134
|
-
map.fire("ready");
|
|
135
|
-
expect(listener).toHaveBeenCalledTimes(2);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
it("should default options.once to false if not provided", () => {
|
|
139
|
-
const listener = jest.fn();
|
|
140
|
-
map.addEventListener("ready", listener);
|
|
141
|
-
map.fire("ready");
|
|
142
|
-
map.fire("ready");
|
|
143
|
-
expect(listener).toHaveBeenCalledTimes(2);
|
|
144
|
-
});
|
|
145
|
-
});
|