@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,599 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
default as InitParameters, getMapPositionFromString, xyzParamToPSVPosition, xywhParamToPSVPosition,
|
|
3
|
-
paramsToMapFilters, alterPSVState, alterMapState, alterViewerState,
|
|
4
|
-
} from "../../src/utils/InitParameters";
|
|
5
|
-
|
|
6
|
-
describe("InitParameters", () => {
|
|
7
|
-
let componentAttrs, urlParams, browserStorage;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
console.warn = jest.fn();
|
|
11
|
-
|
|
12
|
-
componentAttrs = {
|
|
13
|
-
"psv-options": { transitionDuration: 1000, picturesNavigation: "seq" },
|
|
14
|
-
"map-options": { theme: "age", background: "aerial", center: [0, 0], zoom: 10 },
|
|
15
|
-
focus: "pic",
|
|
16
|
-
picture: "pic1",
|
|
17
|
-
"endpoint-to-use": "user1",
|
|
18
|
-
geocoder: true,
|
|
19
|
-
widgets: true,
|
|
20
|
-
sequence: true,
|
|
21
|
-
"fetch-options": {},
|
|
22
|
-
style: {},
|
|
23
|
-
lang: "en",
|
|
24
|
-
endpoint: "https://panoramax.testapi.fr",
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
urlParams = {
|
|
28
|
-
map: "15/30/70",
|
|
29
|
-
focus: "map",
|
|
30
|
-
pic: "pic2",
|
|
31
|
-
users: "user3",
|
|
32
|
-
speed: 2000,
|
|
33
|
-
nav: "any",
|
|
34
|
-
theme: "default",
|
|
35
|
-
background: "streets",
|
|
36
|
-
xyz: "1/2/3",
|
|
37
|
-
date_from: "2023-01-01",
|
|
38
|
-
date_to: "2023-12-31",
|
|
39
|
-
pic_type: "type1",
|
|
40
|
-
camera: "cam1",
|
|
41
|
-
pic_score: "high",
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
browserStorage = {
|
|
45
|
-
map: { theme: "qualityscore", background: "aerial", center: [-10, -20], zoom: 19 },
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
afterEach(() => jest.clearAllMocks());
|
|
50
|
-
|
|
51
|
-
it("should initialize with componentAttrs and urlParams", () => {
|
|
52
|
-
const initParams = new InitParameters(componentAttrs, urlParams, browserStorage);
|
|
53
|
-
|
|
54
|
-
expect(initParams._parentInit).toEqual({
|
|
55
|
-
map: true,
|
|
56
|
-
fetchOptions: {},
|
|
57
|
-
style: {},
|
|
58
|
-
lang: "en",
|
|
59
|
-
endpoint: "https://panoramax.testapi.fr",
|
|
60
|
-
});
|
|
61
|
-
expect(initParams._parentPostInit).toEqual({
|
|
62
|
-
focus: "map",
|
|
63
|
-
picture: "pic2",
|
|
64
|
-
sequence: true,
|
|
65
|
-
geocoder: true,
|
|
66
|
-
widgets: true,
|
|
67
|
-
forceFocus: true,
|
|
68
|
-
keyboardShortcuts: true,
|
|
69
|
-
willLoadPicture: true,
|
|
70
|
-
skipTagsMenuOpening: false,
|
|
71
|
-
users: "user3",
|
|
72
|
-
});
|
|
73
|
-
expect(initParams._psvInit).toEqual({ displayAnnotations: false });
|
|
74
|
-
expect(initParams._psvAny).toEqual({
|
|
75
|
-
transitionDuration: 2000,
|
|
76
|
-
picturesNavigation: "any",
|
|
77
|
-
});
|
|
78
|
-
expect(initParams._psvPostInit).toEqual({ xyz: "1/2/3" });
|
|
79
|
-
expect(initParams._mapInit).toEqual({ raster: undefined });
|
|
80
|
-
expect(initParams._mapAny).toEqual({
|
|
81
|
-
theme: "default",
|
|
82
|
-
background: "streets",
|
|
83
|
-
center: [70, 30],
|
|
84
|
-
zoom: 15,
|
|
85
|
-
pitch: undefined,
|
|
86
|
-
bearing: undefined,
|
|
87
|
-
});
|
|
88
|
-
expect(initParams._mapPostInit).toEqual({
|
|
89
|
-
date_from: "2023-01-01",
|
|
90
|
-
date_to: "2023-12-31",
|
|
91
|
-
pic_type: "type1",
|
|
92
|
-
camera: "cam1",
|
|
93
|
-
pic_score: "high",
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("should skip URL parameters if disabled by component", () => {
|
|
98
|
-
componentAttrs["url-parameters"] = "false";
|
|
99
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
100
|
-
|
|
101
|
-
expect(initParams._parentInit).toEqual({
|
|
102
|
-
map: true,
|
|
103
|
-
fetchOptions: {},
|
|
104
|
-
style: {},
|
|
105
|
-
lang: "en",
|
|
106
|
-
endpoint: "https://panoramax.testapi.fr",
|
|
107
|
-
});
|
|
108
|
-
expect(initParams._parentPostInit).toEqual({
|
|
109
|
-
focus: "pic",
|
|
110
|
-
picture: "pic1",
|
|
111
|
-
sequence: true,
|
|
112
|
-
geocoder: true,
|
|
113
|
-
widgets: true,
|
|
114
|
-
forceFocus: true,
|
|
115
|
-
keyboardShortcuts: true,
|
|
116
|
-
willLoadPicture: true,
|
|
117
|
-
skipTagsMenuOpening: false,
|
|
118
|
-
users: "user1",
|
|
119
|
-
});
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it("uses browserStorage parameters if no URL parameter is available", () => {
|
|
123
|
-
// Override component attributes as well
|
|
124
|
-
componentAttrs["map-options"] = { raster: {} };
|
|
125
|
-
componentAttrs.picture = undefined;
|
|
126
|
-
const initParams = new InitParameters(componentAttrs, undefined, browserStorage);
|
|
127
|
-
expect(initParams._mapAny).toEqual({
|
|
128
|
-
theme: "qualityscore",
|
|
129
|
-
background: "aerial",
|
|
130
|
-
center: [-10,-20],
|
|
131
|
-
zoom: 19,
|
|
132
|
-
pitch: undefined,
|
|
133
|
-
bearing: undefined,
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
|
|
137
|
-
it("uses browserStorage parameters if no URL parameter is available, except map coords if picture is set", () => {
|
|
138
|
-
componentAttrs["map-options"] = { raster: {} };
|
|
139
|
-
const initParams = new InitParameters(componentAttrs, undefined, browserStorage);
|
|
140
|
-
expect(initParams._mapAny).toEqual({
|
|
141
|
-
theme: "qualityscore",
|
|
142
|
-
background: "aerial",
|
|
143
|
-
center: [0,0],
|
|
144
|
-
zoom: 19,
|
|
145
|
-
pitch: undefined,
|
|
146
|
-
bearing: undefined,
|
|
147
|
-
});
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
it("should sanitize objects correctly", () => {
|
|
151
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
152
|
-
const obj = { a: 1, b: undefined, c: 3 };
|
|
153
|
-
const sanitizedObj = initParams._sanitize(obj);
|
|
154
|
-
|
|
155
|
-
expect(sanitizedObj).toEqual({ a: 1, c: 3 });
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it("should get parent initialization parameters", () => {
|
|
159
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
160
|
-
const parentInit = initParams.getParentInit();
|
|
161
|
-
|
|
162
|
-
expect(parentInit).toEqual({
|
|
163
|
-
map: true,
|
|
164
|
-
fetchOptions: {},
|
|
165
|
-
style: {},
|
|
166
|
-
lang: "en",
|
|
167
|
-
endpoint: "https://panoramax.testapi.fr",
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
it("should get parent post-initialization parameters", () => {
|
|
172
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
173
|
-
const parentPostInit = initParams.getParentPostInit();
|
|
174
|
-
|
|
175
|
-
expect(parentPostInit).toEqual({
|
|
176
|
-
focus: "map",
|
|
177
|
-
picture: "pic2",
|
|
178
|
-
sequence: true,
|
|
179
|
-
geocoder: true,
|
|
180
|
-
widgets: true,
|
|
181
|
-
forceFocus: true,
|
|
182
|
-
keyboardShortcuts: true,
|
|
183
|
-
willLoadPicture: true,
|
|
184
|
-
skipTagsMenuOpening: false,
|
|
185
|
-
users: "user3",
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
it("should get PSV initialization parameters", () => {
|
|
190
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
191
|
-
const psvInit = initParams.getPSVInit();
|
|
192
|
-
|
|
193
|
-
expect(psvInit).toEqual({
|
|
194
|
-
displayAnnotations: false,
|
|
195
|
-
transitionDuration: 2000,
|
|
196
|
-
picturesNavigation: "any",
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
|
|
200
|
-
it("should get PSV post-initialization parameters", () => {
|
|
201
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
202
|
-
const psvPostInit = initParams.getPSVPostInit();
|
|
203
|
-
|
|
204
|
-
expect(psvPostInit).toEqual({
|
|
205
|
-
transitionDuration: 2000,
|
|
206
|
-
picturesNavigation: "any",
|
|
207
|
-
xyz: "1/2/3",
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
it("should get map initialization parameters", () => {
|
|
212
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
213
|
-
const mapInit = initParams.getMapInit();
|
|
214
|
-
|
|
215
|
-
expect(mapInit).toEqual({
|
|
216
|
-
theme: "default",
|
|
217
|
-
background: "streets",
|
|
218
|
-
center: [70, 30],
|
|
219
|
-
zoom: 15,
|
|
220
|
-
});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it("should get map post-initialization parameters", () => {
|
|
224
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
225
|
-
const mapPostInit = initParams.getMapPostInit();
|
|
226
|
-
|
|
227
|
-
expect(mapPostInit).toEqual({
|
|
228
|
-
theme: "default",
|
|
229
|
-
background: "streets",
|
|
230
|
-
center: [70, 30],
|
|
231
|
-
zoom: 15,
|
|
232
|
-
date_from: "2023-01-01",
|
|
233
|
-
date_to: "2023-12-31",
|
|
234
|
-
pic_type: "type1",
|
|
235
|
-
camera: "cam1",
|
|
236
|
-
pic_score: "high",
|
|
237
|
-
});
|
|
238
|
-
});
|
|
239
|
-
|
|
240
|
-
it("should handle invalid focus parameter", () => {
|
|
241
|
-
urlParams.focus = "invalid";
|
|
242
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
243
|
-
expect(initParams._parentPostInit.focus).toBe("pic");
|
|
244
|
-
expect(console.warn).toHaveBeenCalledWith("Invalid value for parameter focus:", "invalid");
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
it("should handle focus parameter when map is disabled", () => {
|
|
248
|
-
componentAttrs["map-options"] = "false";
|
|
249
|
-
urlParams.focus = "map";
|
|
250
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
251
|
-
expect(initParams._parentPostInit.focus).toBe("pic");
|
|
252
|
-
expect(console.warn).toHaveBeenCalledWith("Parameter focus can't be 'map' as map is disabled");
|
|
253
|
-
});
|
|
254
|
-
|
|
255
|
-
it("should handle background parameter when aerial imagery is not available", () => {
|
|
256
|
-
componentAttrs["map-options"].raster = false;
|
|
257
|
-
urlParams.background = "aerial";
|
|
258
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
259
|
-
expect(initParams._mapAny.background).toBe("streets");
|
|
260
|
-
expect(console.warn).toHaveBeenCalledWith("Parameter background can't be 'aerial' as no aerial imagery is available");
|
|
261
|
-
});
|
|
262
|
-
|
|
263
|
-
it("should handle keyboardShortcuts=false", () => {
|
|
264
|
-
componentAttrs["keyboard-shortcuts"] = "false";
|
|
265
|
-
const initParams = new InitParameters(componentAttrs, urlParams);
|
|
266
|
-
expect(initParams._mapInit.keyboard).toBe(false);
|
|
267
|
-
expect(initParams._parentPostInit.keyboardShortcuts).toBe(false);
|
|
268
|
-
expect(initParams._psvInit.keyboard).toBe(false);
|
|
269
|
-
expect(initParams._psvInit.keyboardActions).toEqual({});
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
describe("getMapPositionFromString", () => {
|
|
274
|
-
it("works without map", () => {
|
|
275
|
-
expect(getMapPositionFromString("18/-12.5/48.7")).toEqual({ center: [48.7, -12.5], zoom: 18, pitch: 0 });
|
|
276
|
-
});
|
|
277
|
-
|
|
278
|
-
it("works with map", () => {
|
|
279
|
-
const map = {
|
|
280
|
-
dragRotate: { isEnabled: () => true },
|
|
281
|
-
touchZoomRotate: { isEnabled: () => true },
|
|
282
|
-
};
|
|
283
|
-
expect(getMapPositionFromString("18/-12.5/48.7/15/12", map)).toEqual({ center: [48.7, -12.5], zoom: 18, pitch: 12, bearing: 15 });
|
|
284
|
-
});
|
|
285
|
-
|
|
286
|
-
it("nulls if string is invalid", () => {
|
|
287
|
-
expect(getMapPositionFromString("bla/bla/bla")).toBeNull();
|
|
288
|
-
});
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
describe("xyzParamToPSVPosition", () => {
|
|
292
|
-
it("works", () => {
|
|
293
|
-
expect(xyzParamToPSVPosition("18/-12.5/48.7")).toEqual({ x: 18, y: -12.5, z: 48.7 });
|
|
294
|
-
});
|
|
295
|
-
|
|
296
|
-
it("nulls if string is invalid", () => {
|
|
297
|
-
expect(xyzParamToPSVPosition("bla/bla/bla")).toBeNull();
|
|
298
|
-
});
|
|
299
|
-
});
|
|
300
|
-
|
|
301
|
-
describe("xywhParamToPSVPosition", () => {
|
|
302
|
-
it("works with obj basepanodata and no crop", () => {
|
|
303
|
-
const pm = {
|
|
304
|
-
panorama: { basePanoData: {
|
|
305
|
-
fullWidth: 1024,
|
|
306
|
-
fullHeight: 768
|
|
307
|
-
} },
|
|
308
|
-
properties: {
|
|
309
|
-
"pers:interior_orientation": {
|
|
310
|
-
sensor_array_dimensions: [1024, 768]
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
};
|
|
314
|
-
expect(xywhParamToPSVPosition("10,20,30,40", pm)).toStrictEqual({ yaw: -2.988194574801229, pitch: 1.4071717094204281, z: 95.93098958333334 });
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
it("works with fct basepanodata and no crop", () => {
|
|
318
|
-
const pm = {
|
|
319
|
-
panorama: { basePanoData: () => ({
|
|
320
|
-
fullWidth: 1024,
|
|
321
|
-
fullHeight: 768
|
|
322
|
-
}) },
|
|
323
|
-
properties: {
|
|
324
|
-
"pers:interior_orientation": {
|
|
325
|
-
sensor_array_dimensions: [1024, 768]
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
expect(xywhParamToPSVPosition("10,20,30,40", pm)).toStrictEqual({ yaw: -2.988194574801229, pitch: 1.4071717094204281, z: 95.93098958333334 });
|
|
330
|
-
});
|
|
331
|
-
|
|
332
|
-
it("works with obj basepanodata and crop", () => {
|
|
333
|
-
const pm = {
|
|
334
|
-
panorama: { basePanoData: {
|
|
335
|
-
fullWidth: 1024,
|
|
336
|
-
fullHeight: 768,
|
|
337
|
-
croppedX: 40,
|
|
338
|
-
croppedY: 70
|
|
339
|
-
} },
|
|
340
|
-
properties: {
|
|
341
|
-
"pers:interior_orientation": {
|
|
342
|
-
sensor_array_dimensions: [1024, 768]
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
expect(xywhParamToPSVPosition("10,20,30,40", pm)).toStrictEqual({ yaw: -2.742757648739526, pitch: 1.1208286290151084, z: 95.93098958333334 });
|
|
347
|
-
});
|
|
348
|
-
|
|
349
|
-
it("works with fct basepanodata and crop", () => {
|
|
350
|
-
const pm = {
|
|
351
|
-
panorama: { basePanoData: () => ({
|
|
352
|
-
fullWidth: 1024,
|
|
353
|
-
fullHeight: 768,
|
|
354
|
-
croppedX: 40,
|
|
355
|
-
croppedY: 70
|
|
356
|
-
}) },
|
|
357
|
-
properties: {
|
|
358
|
-
"pers:interior_orientation": {
|
|
359
|
-
sensor_array_dimensions: [1024, 768]
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
expect(xywhParamToPSVPosition("10,20,30,40", pm)).toStrictEqual({ yaw: -2.742757648739526, pitch: 1.1208286290151084, z: 95.93098958333334 });
|
|
364
|
-
});
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
describe("paramsToMapFilters", () => {
|
|
368
|
-
it("works", () => {
|
|
369
|
-
const vals = {
|
|
370
|
-
"date_from": "2023-01-01",
|
|
371
|
-
"date_to": "2023-05-05",
|
|
372
|
-
"pic_type": "equirectangular",
|
|
373
|
-
"camera": "sony",
|
|
374
|
-
"whatever": "whenever",
|
|
375
|
-
"theme": "type",
|
|
376
|
-
};
|
|
377
|
-
expect(paramsToMapFilters(vals)).toEqual({
|
|
378
|
-
"minDate": "2023-01-01",
|
|
379
|
-
"maxDate": "2023-05-05",
|
|
380
|
-
"pic_type": "equirectangular",
|
|
381
|
-
"camera": "sony",
|
|
382
|
-
"theme": "type",
|
|
383
|
-
});
|
|
384
|
-
});
|
|
385
|
-
});
|
|
386
|
-
|
|
387
|
-
describe("alterPSVState", () => {
|
|
388
|
-
let psv;
|
|
389
|
-
|
|
390
|
-
beforeEach(() => {
|
|
391
|
-
psv = {
|
|
392
|
-
addEventListener: jest.fn(),
|
|
393
|
-
setXYZ: jest.fn(),
|
|
394
|
-
setTransitionDuration: jest.fn(),
|
|
395
|
-
setPicturesNavigation: jest.fn(),
|
|
396
|
-
};
|
|
397
|
-
});
|
|
398
|
-
|
|
399
|
-
afterEach(() => jest.clearAllMocks());
|
|
400
|
-
|
|
401
|
-
it("should set XYZ position when xyz param is provided", () => {
|
|
402
|
-
const params = { xyz: "1/2/3" };
|
|
403
|
-
alterPSVState(psv, params);
|
|
404
|
-
|
|
405
|
-
expect(psv.addEventListener).toHaveBeenCalledWith("picture-loaded", expect.any(Function), { once: true });
|
|
406
|
-
const listener = psv.addEventListener.mock.calls[0][1];
|
|
407
|
-
listener();
|
|
408
|
-
expect(psv.setXYZ).toHaveBeenCalledWith(1, 2, 3);
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
it("should set transition duration when transitionDuration param is provided", () => {
|
|
412
|
-
const params = { transitionDuration: 1000 };
|
|
413
|
-
alterPSVState(psv, params);
|
|
414
|
-
expect(psv.setTransitionDuration).toHaveBeenCalledWith(1000);
|
|
415
|
-
});
|
|
416
|
-
|
|
417
|
-
it("should set pictures navigation mode when picturesNavigation param is provided", () => {
|
|
418
|
-
const params = { picturesNavigation: "pic" };
|
|
419
|
-
alterPSVState(psv, params);
|
|
420
|
-
expect(psv.setPicturesNavigation).toHaveBeenCalledWith("pic");
|
|
421
|
-
});
|
|
422
|
-
|
|
423
|
-
it("should set pictures navigation mode when picturesNavigation=none", () => {
|
|
424
|
-
const params = { picturesNavigation: "none" };
|
|
425
|
-
alterPSVState(psv, params);
|
|
426
|
-
expect(psv.setPicturesNavigation).toHaveBeenCalledWith("none");
|
|
427
|
-
});
|
|
428
|
-
|
|
429
|
-
it("should not set pictures navigation mode when picturesNavigation param is invalid", () => {
|
|
430
|
-
const params = { picturesNavigation: "invalid" };
|
|
431
|
-
alterPSVState(psv, params);
|
|
432
|
-
expect(psv.setPicturesNavigation).not.toHaveBeenCalled();
|
|
433
|
-
});
|
|
434
|
-
|
|
435
|
-
it("should handle multiple params correctly", () => {
|
|
436
|
-
const params = { xyz: "1/2/3", transitionDuration: 1000, picturesNavigation: "seq" };
|
|
437
|
-
alterPSVState(psv, params);
|
|
438
|
-
|
|
439
|
-
expect(psv.addEventListener).toHaveBeenCalledWith("picture-loaded", expect.any(Function), { once: true });
|
|
440
|
-
const listener = psv.addEventListener.mock.calls[0][1];
|
|
441
|
-
listener();
|
|
442
|
-
expect(psv.setXYZ).toHaveBeenCalledWith(1, 2, 3);
|
|
443
|
-
expect(psv.setTransitionDuration).toHaveBeenCalledWith(1000);
|
|
444
|
-
expect(psv.setPicturesNavigation).toHaveBeenCalledWith("seq");
|
|
445
|
-
});
|
|
446
|
-
});
|
|
447
|
-
|
|
448
|
-
describe("alterMapState", () => {
|
|
449
|
-
let map;
|
|
450
|
-
|
|
451
|
-
beforeEach(() => {
|
|
452
|
-
map = {
|
|
453
|
-
jumpTo: jest.fn(),
|
|
454
|
-
setFilters: jest.fn(),
|
|
455
|
-
getBearing: jest.fn(),
|
|
456
|
-
dragRotate: {
|
|
457
|
-
isEnabled: jest.fn(),
|
|
458
|
-
},
|
|
459
|
-
_parent: {
|
|
460
|
-
mapStyleComposer: {
|
|
461
|
-
switchPanoramaxEndpoint: jest.fn(),
|
|
462
|
-
switchBasemap: jest.fn(),
|
|
463
|
-
layerRanges: { basemaps: {
|
|
464
|
-
aerial: {},
|
|
465
|
-
streets: {},
|
|
466
|
-
} },
|
|
467
|
-
},
|
|
468
|
-
},
|
|
469
|
-
};
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
afterEach(() => jest.clearAllMocks());
|
|
473
|
-
|
|
474
|
-
it("should jump to map position when map param is provided", async () => {
|
|
475
|
-
const params = { map: "10/20/30" };
|
|
476
|
-
const mapOpts = { center: [30,20], zoom: 10, pitch: 0 };
|
|
477
|
-
|
|
478
|
-
await alterMapState(map, params);
|
|
479
|
-
expect(map.jumpTo).toHaveBeenCalledWith(mapOpts);
|
|
480
|
-
});
|
|
481
|
-
|
|
482
|
-
it("should set map filters when params are provided", async () => {
|
|
483
|
-
const params = { "date_from": "2024-01-01", "pic_score": "ABC" };
|
|
484
|
-
const filters = { "minDate": "2024-01-01", "qualityscore": [5,4,3] };
|
|
485
|
-
await alterMapState(map, params);
|
|
486
|
-
expect(map.setFilters).toHaveBeenCalledWith(filters);
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
it("should set map background when background param is valid", async () => {
|
|
490
|
-
const params = { background: "aerial" };
|
|
491
|
-
await alterMapState(map, params);
|
|
492
|
-
expect(map._parent.mapStyleComposer.switchBasemap).toHaveBeenCalledWith("aerial");
|
|
493
|
-
});
|
|
494
|
-
|
|
495
|
-
it("should not set map background when background param is invalid", async () => {
|
|
496
|
-
const params = { background: "invalid" };
|
|
497
|
-
await alterMapState(map, params);
|
|
498
|
-
expect(map._parent.mapStyleComposer.switchBasemap).not.toHaveBeenCalled();
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
it("should handle multiple params correctly", async () => {
|
|
502
|
-
const params = {
|
|
503
|
-
map: "15/7/6",
|
|
504
|
-
camera: "value1",
|
|
505
|
-
background: "streets",
|
|
506
|
-
};
|
|
507
|
-
const mapOpts = { center: [6, 7], zoom: 15, pitch: 0 };
|
|
508
|
-
const filters = { camera: "value1" };
|
|
509
|
-
|
|
510
|
-
await alterMapState(map, params);
|
|
511
|
-
expect(map.jumpTo).toHaveBeenCalledWith(mapOpts);
|
|
512
|
-
expect(map.setFilters).toHaveBeenCalledWith(filters);
|
|
513
|
-
expect(map._parent.mapStyleComposer.switchBasemap).toHaveBeenCalledWith("streets");
|
|
514
|
-
});
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
describe("alterViewerState", () => {
|
|
518
|
-
let viewer;
|
|
519
|
-
|
|
520
|
-
beforeEach(() => {
|
|
521
|
-
console.warn = jest.fn();
|
|
522
|
-
viewer = {
|
|
523
|
-
psv: {
|
|
524
|
-
addEventListener: jest.fn(),
|
|
525
|
-
},
|
|
526
|
-
select: jest.fn(),
|
|
527
|
-
setPopup: jest.fn(),
|
|
528
|
-
_setFocus: jest.fn(),
|
|
529
|
-
mini: {},
|
|
530
|
-
};
|
|
531
|
-
});
|
|
532
|
-
|
|
533
|
-
afterEach(() => jest.clearAllMocks());
|
|
534
|
-
|
|
535
|
-
it("should select the first picture ID when picture param is provided", () => {
|
|
536
|
-
const params = { picture: "pic1;pic2" };
|
|
537
|
-
alterViewerState(viewer, params);
|
|
538
|
-
expect(viewer.select).toHaveBeenCalledWith(null, "pic1", true);
|
|
539
|
-
expect(console.warn).toHaveBeenCalledWith("Multiple picture IDs passed in URL, only first one kept");
|
|
540
|
-
});
|
|
541
|
-
|
|
542
|
-
it("should select no picture when picture param is not provided", () => {
|
|
543
|
-
const params = {};
|
|
544
|
-
alterViewerState(viewer, params);
|
|
545
|
-
expect(viewer.select).toHaveBeenCalledWith();
|
|
546
|
-
});
|
|
547
|
-
|
|
548
|
-
it("should set focus to map when focus param is map and map exists", () => {
|
|
549
|
-
const params = { focus: "map", forceFocus: true };
|
|
550
|
-
viewer.map = {};
|
|
551
|
-
alterViewerState(viewer, params);
|
|
552
|
-
expect(viewer.setPopup).toHaveBeenCalledWith(false);
|
|
553
|
-
expect(viewer._setFocus).toHaveBeenCalledWith("map", null, true);
|
|
554
|
-
});
|
|
555
|
-
|
|
556
|
-
it("should set focus to pic when focus param is pic", () => {
|
|
557
|
-
const params = { focus: "pic", forceFocus: true };
|
|
558
|
-
alterViewerState(viewer, params);
|
|
559
|
-
expect(viewer.setPopup).toHaveBeenCalledWith(false);
|
|
560
|
-
expect(viewer._setFocus).toHaveBeenCalledWith("pic", null, true);
|
|
561
|
-
});
|
|
562
|
-
|
|
563
|
-
it("should set focus to pic when focus param is meta", () => {
|
|
564
|
-
const params = { focus: "meta", forceFocus: true };
|
|
565
|
-
alterViewerState(viewer, params);
|
|
566
|
-
expect(viewer._setFocus).toHaveBeenCalledWith("pic", null, true);
|
|
567
|
-
});
|
|
568
|
-
|
|
569
|
-
it("should not set focus when focus param is invalid", () => {
|
|
570
|
-
const params = { focus: "invalid", forceFocus: true };
|
|
571
|
-
alterViewerState(viewer, params);
|
|
572
|
-
expect(viewer._setFocus).not.toHaveBeenCalled();
|
|
573
|
-
});
|
|
574
|
-
|
|
575
|
-
it("should handle multiple params correctly", () => {
|
|
576
|
-
const params = { picture: "pic1", focus: "map", forceFocus: true };
|
|
577
|
-
viewer.map = {};
|
|
578
|
-
alterViewerState(viewer, params);
|
|
579
|
-
expect(viewer.select).toHaveBeenCalledWith(null, "pic1", true);
|
|
580
|
-
expect(viewer.setPopup).toHaveBeenCalledWith(false);
|
|
581
|
-
expect(viewer._setFocus).toHaveBeenCalledWith("map", null, true);
|
|
582
|
-
});
|
|
583
|
-
|
|
584
|
-
it("should set visible users when users param is provided", async () => {
|
|
585
|
-
const params = { users: "user1" };
|
|
586
|
-
viewer.mapStyleComposer = {
|
|
587
|
-
_createPanoramaxEndpointForUser: jest.fn(),
|
|
588
|
-
};
|
|
589
|
-
alterViewerState(viewer, params);
|
|
590
|
-
expect(viewer.mapStyleComposer._createPanoramaxEndpointForUser).toHaveBeenCalledWith("user1");
|
|
591
|
-
});
|
|
592
|
-
|
|
593
|
-
it("should set default visible user when users param is empty", async () => {
|
|
594
|
-
const params = { users: "" };
|
|
595
|
-
viewer.mapStyleComposer = { switchPanoramaxEndpoint: jest.fn() };
|
|
596
|
-
alterViewerState(viewer, params);
|
|
597
|
-
expect(viewer.mapStyleComposer.switchPanoramaxEndpoint).toHaveBeenCalledWith("");
|
|
598
|
-
});
|
|
599
|
-
});
|