@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,327 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`apiFeatureToPSVNode works 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"caption": Object {
|
|
6
|
-
"date": mockConstructor {},
|
|
7
|
-
"license": "<a href=\\"https://spdx.org/licenses/CC-BY-SA-4.0.html\\" title=\\"\\" target=\\"_blank\\">CC-BY-SA-4.0</a>",
|
|
8
|
-
"producer": Array [
|
|
9
|
-
"Hopen111",
|
|
10
|
-
],
|
|
11
|
-
"tz": "+00:00",
|
|
12
|
-
},
|
|
13
|
-
"gps": Array [
|
|
14
|
-
-92.70188245,
|
|
15
|
-
41.322064692,
|
|
16
|
-
],
|
|
17
|
-
"horizontalFov": 360,
|
|
18
|
-
"id": "00000000-76a0-4bec-b19e-a56f51ef997d",
|
|
19
|
-
"links": Array [
|
|
20
|
-
Object {
|
|
21
|
-
"arrowStyle": Object {
|
|
22
|
-
"element": <img
|
|
23
|
-
alt=""
|
|
24
|
-
src="arrow_triangle.svg"
|
|
25
|
-
/>,
|
|
26
|
-
"size": Object {
|
|
27
|
-
"height": 75,
|
|
28
|
-
"width": 75,
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
"gps": Array [
|
|
32
|
-
-92.701854443,
|
|
33
|
-
41.322047796,
|
|
34
|
-
],
|
|
35
|
-
"linkOffset": Object {
|
|
36
|
-
"yaw": -5.3930673886624785,
|
|
37
|
-
},
|
|
38
|
-
"nodeId": "66ea29cd-941c-4201-977f-efb87bd5465e",
|
|
39
|
-
},
|
|
40
|
-
Object {
|
|
41
|
-
"arrowStyle": Object {
|
|
42
|
-
"element": <img
|
|
43
|
-
alt=""
|
|
44
|
-
src="arrow_triangle.svg"
|
|
45
|
-
/>,
|
|
46
|
-
"size": Object {
|
|
47
|
-
"height": 75,
|
|
48
|
-
"width": 75,
|
|
49
|
-
},
|
|
50
|
-
},
|
|
51
|
-
"gps": Array [
|
|
52
|
-
-92.701910458,
|
|
53
|
-
41.322081588,
|
|
54
|
-
],
|
|
55
|
-
"linkOffset": Object {
|
|
56
|
-
"yaw": -5.3930673886624785,
|
|
57
|
-
},
|
|
58
|
-
"nodeId": "5fb8e767-6fe3-4bcb-b19f-7031d9a64fc8",
|
|
59
|
-
},
|
|
60
|
-
],
|
|
61
|
-
"origInstance": undefined,
|
|
62
|
-
"panorama": Object {
|
|
63
|
-
"basePanoData": [Function],
|
|
64
|
-
"baseUrl": "https://panoramax.openstreetmap.fr/api/pictures/00000000-76a0-4bec-b19e-a56f51ef997d/sd.jpg",
|
|
65
|
-
"cols": 8,
|
|
66
|
-
"hdUrl": "https://panoramax.openstreetmap.fr/api/pictures/00000000-76a0-4bec-b19e-a56f51ef997d/hd.jpg",
|
|
67
|
-
"origBaseUrl": "https://panoramax.openstreetmap.fr/api/pictures/00000000-76a0-4bec-b19e-a56f51ef997d/sd.jpg",
|
|
68
|
-
"rows": 4,
|
|
69
|
-
"thumbUrl": "https://panoramax.openstreetmap.fr/api/pictures/00000000-76a0-4bec-b19e-a56f51ef997d/thumb.jpg",
|
|
70
|
-
"tileUrl": [Function],
|
|
71
|
-
"width": 5376,
|
|
72
|
-
},
|
|
73
|
-
"properties": Object {
|
|
74
|
-
"created": "2024-09-04T02:40:11.836165+00:00",
|
|
75
|
-
"datetime": "2024-09-01T23:35:37.797105+00:00",
|
|
76
|
-
"datetimetz": "2024-09-01T23:35:37.797105+00:00",
|
|
77
|
-
"exif": Object {
|
|
78
|
-
"Xmp.GPano.CroppedAreaImageHeightPixels": "2688",
|
|
79
|
-
"Xmp.GPano.CroppedAreaImageWidthPixels": "5376",
|
|
80
|
-
"Xmp.GPano.CroppedAreaLeftPixels": "0",
|
|
81
|
-
"Xmp.GPano.CroppedAreaTopPixels": "0",
|
|
82
|
-
"Xmp.GPano.FullPanoHeightPixels": "2688",
|
|
83
|
-
"Xmp.GPano.FullPanoWidthPixels": "5376",
|
|
84
|
-
"Xmp.GPano.ProjectionType": "equirectangular",
|
|
85
|
-
"Xmp.GPano.UsePanoramaViewer": "True",
|
|
86
|
-
},
|
|
87
|
-
"geovisio:image": "https://panoramax.openstreetmap.fr/api/pictures/00000000-76a0-4bec-b19e-a56f51ef997d/hd.jpg",
|
|
88
|
-
"geovisio:producer": "Hopen111",
|
|
89
|
-
"geovisio:thumbnail": "https://panoramax.openstreetmap.fr/api/pictures/00000000-76a0-4bec-b19e-a56f51ef997d/thumb.jpg",
|
|
90
|
-
"license": "CC-BY-SA-4.0",
|
|
91
|
-
"original_file:name": "GS010837-003545.jpg",
|
|
92
|
-
"original_file:size": 788436,
|
|
93
|
-
"panoramax:horizontal_pixel_density": 15,
|
|
94
|
-
"pers:interior_orientation": Object {
|
|
95
|
-
"field_of_view": 360,
|
|
96
|
-
"sensor_array_dimensions": Array [
|
|
97
|
-
5376,
|
|
98
|
-
2688,
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
"tiles:tile_matrix_sets": Object {
|
|
102
|
-
"geovisio": Object {
|
|
103
|
-
"identifier": "geovisio-00000000-76a0-4bec-b19e-a56f51ef997d",
|
|
104
|
-
"tileMatrix": Array [
|
|
105
|
-
Object {
|
|
106
|
-
"identifier": "0",
|
|
107
|
-
"matrixHeight": 4,
|
|
108
|
-
"matrixWidth": 8,
|
|
109
|
-
"scaleDenominator": 1,
|
|
110
|
-
"tileHeight": 672,
|
|
111
|
-
"tileWidth": 672,
|
|
112
|
-
"topLeftCorner": Array [
|
|
113
|
-
0,
|
|
114
|
-
0,
|
|
115
|
-
],
|
|
116
|
-
"type": "TileMatrixType",
|
|
117
|
-
},
|
|
118
|
-
],
|
|
119
|
-
"title": "GeoVisio tile matrix for picture 00000000-76a0-4bec-b19e-a56f51ef997d",
|
|
120
|
-
"type": "TileMatrixSetType",
|
|
121
|
-
},
|
|
122
|
-
},
|
|
123
|
-
"view:azimuth": 309,
|
|
124
|
-
},
|
|
125
|
-
"sequence": Object {
|
|
126
|
-
"id": "ec31c324-b43a-425e-a24c-3de56d7914c1",
|
|
127
|
-
"nextPic": "5fb8e767-6fe3-4bcb-b19f-7031d9a64fc8",
|
|
128
|
-
"prevPic": "66ea29cd-941c-4201-977f-efb87bd5465e",
|
|
129
|
-
},
|
|
130
|
-
"sphereCorrection": Object {},
|
|
131
|
-
}
|
|
132
|
-
`;
|
|
133
|
-
|
|
134
|
-
exports[`filterRelatedPicsLinks works 1`] = `
|
|
135
|
-
Array [
|
|
136
|
-
Object {
|
|
137
|
-
"arrowStyle": Object {
|
|
138
|
-
"element": <img
|
|
139
|
-
alt=""
|
|
140
|
-
src="arrow_turn.svg"
|
|
141
|
-
/>,
|
|
142
|
-
"size": Object {
|
|
143
|
-
"height": 128,
|
|
144
|
-
"width": 42.666666666666664,
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
"gps": Array [
|
|
148
|
-
4.840134667,
|
|
149
|
-
45.756240466,
|
|
150
|
-
],
|
|
151
|
-
"linkOffset": Object {
|
|
152
|
-
"yaw": -1.8849555921538759,
|
|
153
|
-
},
|
|
154
|
-
"nodeId": "aaa1ae2f-b48a-4291-972e-030fcd44760b",
|
|
155
|
-
},
|
|
156
|
-
Object {
|
|
157
|
-
"arrowStyle": Object {
|
|
158
|
-
"element": <img
|
|
159
|
-
alt=""
|
|
160
|
-
src="arrow_triangle.svg"
|
|
161
|
-
/>,
|
|
162
|
-
"size": Object {
|
|
163
|
-
"height": 75,
|
|
164
|
-
"width": 75,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
"gps": Array [
|
|
168
|
-
4.8401792,
|
|
169
|
-
45.7562024,
|
|
170
|
-
],
|
|
171
|
-
"linkOffset": Object {
|
|
172
|
-
"yaw": -1.8849555921538759,
|
|
173
|
-
},
|
|
174
|
-
"nodeId": "38abdc16-b878-4762-a433-33e52e62ae9b",
|
|
175
|
-
},
|
|
176
|
-
Object {
|
|
177
|
-
"arrowStyle": Object {
|
|
178
|
-
"element": <img
|
|
179
|
-
alt=""
|
|
180
|
-
src="arrow_turn.svg"
|
|
181
|
-
/>,
|
|
182
|
-
"size": Object {
|
|
183
|
-
"height": 128,
|
|
184
|
-
"width": 42.666666666666664,
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
"gps": Array [
|
|
188
|
-
4.8401379,
|
|
189
|
-
45.7561616,
|
|
190
|
-
],
|
|
191
|
-
"linkOffset": Object {
|
|
192
|
-
"yaw": -1.8849555921538759,
|
|
193
|
-
},
|
|
194
|
-
"nodeId": "5e1d8461-fe5d-4d57-9c87-f2403baff37d",
|
|
195
|
-
},
|
|
196
|
-
Object {
|
|
197
|
-
"arrowStyle": Object {
|
|
198
|
-
"element": <img
|
|
199
|
-
alt=""
|
|
200
|
-
src="arrow_turn.svg"
|
|
201
|
-
/>,
|
|
202
|
-
"size": Object {
|
|
203
|
-
"height": 128,
|
|
204
|
-
"width": 42.666666666666664,
|
|
205
|
-
},
|
|
206
|
-
},
|
|
207
|
-
"gps": Array [
|
|
208
|
-
4.8400918,
|
|
209
|
-
45.7561938,
|
|
210
|
-
],
|
|
211
|
-
"linkOffset": Object {
|
|
212
|
-
"yaw": -1.8849555921538759,
|
|
213
|
-
},
|
|
214
|
-
"nodeId": "abff42de-2862-4b15-8c2a-dca22ed2deaf",
|
|
215
|
-
},
|
|
216
|
-
Object {
|
|
217
|
-
"arrowStyle": Object {
|
|
218
|
-
"element": <img
|
|
219
|
-
alt=""
|
|
220
|
-
src="arrow_triangle.svg"
|
|
221
|
-
/>,
|
|
222
|
-
"size": Object {
|
|
223
|
-
"height": 75,
|
|
224
|
-
"width": 75,
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
"gps": Array [
|
|
228
|
-
4.8400633,
|
|
229
|
-
45.7562389,
|
|
230
|
-
],
|
|
231
|
-
"linkOffset": Object {
|
|
232
|
-
"yaw": -1.8849555921538759,
|
|
233
|
-
},
|
|
234
|
-
"nodeId": "1c5025ed-3e03-4cf0-8879-7ed9091a9e33",
|
|
235
|
-
},
|
|
236
|
-
]
|
|
237
|
-
`;
|
|
238
|
-
|
|
239
|
-
exports[`getCroppedPanoData works with API props 1`] = `
|
|
240
|
-
Object {
|
|
241
|
-
"croppedHeight": 2606,
|
|
242
|
-
"croppedWidth": 15872,
|
|
243
|
-
"croppedX": 0,
|
|
244
|
-
"croppedY": 2538,
|
|
245
|
-
"fullHeight": 7936,
|
|
246
|
-
"fullWidth": 15872,
|
|
247
|
-
}
|
|
248
|
-
`;
|
|
249
|
-
|
|
250
|
-
exports[`getCroppedPanoData works with API props and unneeded 1`] = `Object {}`;
|
|
251
|
-
|
|
252
|
-
exports[`getCroppedPanoData works with exif tags 1`] = `
|
|
253
|
-
Object {
|
|
254
|
-
"croppedHeight": 2606,
|
|
255
|
-
"croppedWidth": 15872,
|
|
256
|
-
"croppedX": 0,
|
|
257
|
-
"croppedY": 2538,
|
|
258
|
-
"fullHeight": 7936,
|
|
259
|
-
"fullWidth": 15872,
|
|
260
|
-
}
|
|
261
|
-
`;
|
|
262
|
-
|
|
263
|
-
exports[`getCroppedPanoData works with exif tags and unneeded 1`] = `Object {}`;
|
|
264
|
-
|
|
265
|
-
exports[`getNodeCaption works with date + 2 producers 1`] = `
|
|
266
|
-
Object {
|
|
267
|
-
"date": Object {
|
|
268
|
-
"toLocaleDateString": [Function],
|
|
269
|
-
},
|
|
270
|
-
"producer": Array [
|
|
271
|
-
"GeoVisio Corp.",
|
|
272
|
-
"PanierAvide",
|
|
273
|
-
],
|
|
274
|
-
}
|
|
275
|
-
`;
|
|
276
|
-
|
|
277
|
-
exports[`getNodeCaption works with date + producer 1`] = `
|
|
278
|
-
Object {
|
|
279
|
-
"date": Object {
|
|
280
|
-
"toLocaleDateString": [Function],
|
|
281
|
-
},
|
|
282
|
-
"producer": Array [
|
|
283
|
-
"PanierAvide",
|
|
284
|
-
],
|
|
285
|
-
}
|
|
286
|
-
`;
|
|
287
|
-
|
|
288
|
-
exports[`getNodeCaption works with date 1`] = `
|
|
289
|
-
Object {
|
|
290
|
-
"date": Object {
|
|
291
|
-
"toLocaleDateString": [Function],
|
|
292
|
-
},
|
|
293
|
-
}
|
|
294
|
-
`;
|
|
295
|
-
|
|
296
|
-
exports[`getNodeCaption works with date+tz 1`] = `
|
|
297
|
-
Object {
|
|
298
|
-
"date": Object {
|
|
299
|
-
"toLocaleDateString": [Function],
|
|
300
|
-
},
|
|
301
|
-
"tz": "-03:00",
|
|
302
|
-
}
|
|
303
|
-
`;
|
|
304
|
-
|
|
305
|
-
exports[`getNodeCaption works with producer 1`] = `
|
|
306
|
-
Object {
|
|
307
|
-
"producer": Array [
|
|
308
|
-
"PanierAvide",
|
|
309
|
-
],
|
|
310
|
-
}
|
|
311
|
-
`;
|
|
312
|
-
|
|
313
|
-
exports[`getSphereCorrection works with API props 1`] = `
|
|
314
|
-
Object {
|
|
315
|
-
"pan": 0.7330382858376184,
|
|
316
|
-
"roll": 1.260127719939906,
|
|
317
|
-
"tilt": 0.5235987755982988,
|
|
318
|
-
}
|
|
319
|
-
`;
|
|
320
|
-
|
|
321
|
-
exports[`getSphereCorrection works with exif tags 1`] = `
|
|
322
|
-
Object {
|
|
323
|
-
"pan": 0.7330382858376184,
|
|
324
|
-
"roll": 1.260127719939906,
|
|
325
|
-
"tilt": 0.5235987755982988,
|
|
326
|
-
}
|
|
327
|
-
`;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`fa works 1`] = `
|
|
4
|
-
<svg
|
|
5
|
-
aria-hidden="true"
|
|
6
|
-
class="svg-inline--fa fa-chevron-down"
|
|
7
|
-
data-icon="chevron-down"
|
|
8
|
-
data-prefix="fas"
|
|
9
|
-
focusable="false"
|
|
10
|
-
role="img"
|
|
11
|
-
viewBox="0 0 512 512"
|
|
12
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
13
|
-
>
|
|
14
|
-
<path
|
|
15
|
-
d="M233.4 406.6c12.5 12.5 32.8 12.5 45.3 0l192-192c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L256 338.7 86.6 169.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l192 192z"
|
|
16
|
-
fill="currentColor"
|
|
17
|
-
/>
|
|
18
|
-
</svg>
|
|
19
|
-
`;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as geocoder from "../../src/utils/geocoder";
|
|
2
|
-
import GEOCODER_NOMINATIM from "../data/Map_geocoder_nominatim.json";
|
|
3
|
-
import GEOCODER_BAN from "../data/Map_geocoder_ban.json";
|
|
4
|
-
|
|
5
|
-
describe("forwardGeocodingNominatim", () => {
|
|
6
|
-
it("works", () => {
|
|
7
|
-
// Mock API search
|
|
8
|
-
global.fetch = jest.fn(() => Promise.resolve({
|
|
9
|
-
json: () => GEOCODER_NOMINATIM
|
|
10
|
-
}));
|
|
11
|
-
|
|
12
|
-
// Search config
|
|
13
|
-
const cfg = { query: "bla", limit: 5, bbox: "17.7,-45.2,17.8,-45.1" };
|
|
14
|
-
|
|
15
|
-
return geocoder.forwardGeocodingNominatim(cfg).then(res => {
|
|
16
|
-
expect(global.fetch.mock.calls).toEqual([["https://nominatim.openstreetmap.org/search?q=bla&limit=5&viewbox=17.7%2C-45.2%2C17.8%2C-45.1&format=geocodejson&addressdetails=1"]]);
|
|
17
|
-
expect(res).toMatchSnapshot();
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe("forwardGeocodingBAN", () => {
|
|
23
|
-
it("works", () => {
|
|
24
|
-
// Mock API search
|
|
25
|
-
global.fetch = jest.fn(() => Promise.resolve({
|
|
26
|
-
json: () => GEOCODER_BAN
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
// Search config
|
|
30
|
-
const cfg = { query: "bla", limit: 5, proximity: "17.7,-45.2" };
|
|
31
|
-
|
|
32
|
-
return geocoder.forwardGeocodingBAN(cfg).then(res => {
|
|
33
|
-
expect(global.fetch.mock.calls).toEqual([["https://data.geopf.fr/geocodage/search/?q=bla&limit=5&lat=17.7&lon=-45.2"]]);
|
|
34
|
-
expect(res).toMatchSnapshot();
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
});
|
package/tests/utils/i18n.test.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import { autoDetectLocale, getTranslations } from "../../src/utils/i18n";
|
|
2
|
-
|
|
3
|
-
describe("autoDetectLocale", () => {
|
|
4
|
-
// Mock the window.navigator.languages
|
|
5
|
-
const originalNavigatorLanguages = window.navigator.languages;
|
|
6
|
-
|
|
7
|
-
afterEach(() => {
|
|
8
|
-
// Reset window.navigator.languages after each test
|
|
9
|
-
Object.defineProperty(window.navigator, "languages", {
|
|
10
|
-
value: originalNavigatorLanguages,
|
|
11
|
-
configurable: true
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it("returns matched language from supportedTranslations", () => {
|
|
16
|
-
Object.defineProperty(window.navigator, "languages", {
|
|
17
|
-
value: ["fr-FR", "en-US"],
|
|
18
|
-
configurable: true
|
|
19
|
-
});
|
|
20
|
-
const supportedTranslations = ["en", "fr", "es"];
|
|
21
|
-
const fallback = "en";
|
|
22
|
-
expect(autoDetectLocale(supportedTranslations, fallback)).toBe("fr");
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it("returns fallback when no match is found", () => {
|
|
26
|
-
Object.defineProperty(window.navigator, "languages", {
|
|
27
|
-
value: ["de-DE", "it-IT"],
|
|
28
|
-
configurable: true
|
|
29
|
-
});
|
|
30
|
-
const supportedTranslations = ["en", "fr", "es"];
|
|
31
|
-
const fallback = "en";
|
|
32
|
-
expect(autoDetectLocale(supportedTranslations, fallback)).toBe("en");
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("returns zh-Hant for Chinese Traditional locales", () => {
|
|
36
|
-
Object.defineProperty(window.navigator, "languages", {
|
|
37
|
-
value: ["zh-TW"],
|
|
38
|
-
configurable: true
|
|
39
|
-
});
|
|
40
|
-
const supportedTranslations = ["zh-Hant", "zh-Hans", "en"];
|
|
41
|
-
const fallback = "en";
|
|
42
|
-
expect(autoDetectLocale(supportedTranslations, fallback)).toBe("zh-hant");
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it("returns zh-Hans for Chinese Simplified locales", () => {
|
|
46
|
-
Object.defineProperty(window.navigator, "languages", {
|
|
47
|
-
value: ["zh-CN"],
|
|
48
|
-
configurable: true
|
|
49
|
-
});
|
|
50
|
-
const supportedTranslations = ["zh-hant", "zh-hans", "en"];
|
|
51
|
-
const fallback = "en";
|
|
52
|
-
expect(autoDetectLocale(supportedTranslations, fallback)).toBe("zh-hans");
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("returns first matched language even when navigator language has region", () => {
|
|
56
|
-
Object.defineProperty(window.navigator, "languages", {
|
|
57
|
-
value: ["fr-CA", "en-US"],
|
|
58
|
-
configurable: true
|
|
59
|
-
});
|
|
60
|
-
const supportedTranslations = ["fr", "en"];
|
|
61
|
-
const fallback = "en";
|
|
62
|
-
expect(autoDetectLocale(supportedTranslations, fallback)).toBe("fr");
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("returns fallback when supportedTranslations is empty", () => {
|
|
66
|
-
Object.defineProperty(window.navigator, "languages", {
|
|
67
|
-
value: ["fr-FR"],
|
|
68
|
-
configurable: true
|
|
69
|
-
});
|
|
70
|
-
const supportedTranslations = [];
|
|
71
|
-
const fallback = "en";
|
|
72
|
-
expect(autoDetectLocale(supportedTranslations, fallback)).toBe("en");
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it("handles language codes with more than two characters", () => {
|
|
76
|
-
Object.defineProperty(window.navigator, "languages", {
|
|
77
|
-
value: ["pt-BR", "en-US"],
|
|
78
|
-
configurable: true
|
|
79
|
-
});
|
|
80
|
-
const supportedTranslations = ["pt", "en"];
|
|
81
|
-
const fallback = "en";
|
|
82
|
-
expect(autoDetectLocale(supportedTranslations, fallback)).toBe("pt");
|
|
83
|
-
});
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
describe("getTranslations", () => {
|
|
87
|
-
it("works with default lang", () => {
|
|
88
|
-
const res = getTranslations("en");
|
|
89
|
-
expect(res.map.loading).toBe("Loading…");
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("works with existing lang", () => {
|
|
93
|
-
const res = getTranslations("fr");
|
|
94
|
-
expect(res.map.loading).toBe("Chargement…");
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it("fallbacks to English if lang not found", () => {
|
|
98
|
-
const res = getTranslations("xn");
|
|
99
|
-
expect(res.map.loading).toBe("Loading…");
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
it("fallbacks to English if lang is undefined", () => {
|
|
103
|
-
const res = getTranslations();
|
|
104
|
-
expect(res.map.loading).toBe("Loading…");
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
it("works when primary lang code exists", () => {
|
|
108
|
-
const res = getTranslations("fr-FR");
|
|
109
|
-
expect(res.map.loading).toBe("Chargement…");
|
|
110
|
-
});
|
|
111
|
-
});
|
package/tests/utils/map.test.js
DELETED
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import * as map from "../../src/utils/map";
|
|
2
|
-
|
|
3
|
-
describe("getThumbGif", () => {
|
|
4
|
-
it("works", () => {
|
|
5
|
-
const lang = { loading: "Loading..." };
|
|
6
|
-
const res = map.getThumbGif(lang);
|
|
7
|
-
expect(res).toBeDefined();
|
|
8
|
-
expect(res.tagName).toBe("IMG");
|
|
9
|
-
expect(res.alt).toBe(lang.loading);
|
|
10
|
-
expect(res.title).toBe(lang.loading);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
describe("isNullCoordinates", () => {
|
|
15
|
-
it.each([
|
|
16
|
-
[undefined, true],
|
|
17
|
-
[null, true],
|
|
18
|
-
[[0,0], true],
|
|
19
|
-
[[48.7, -1.5], false],
|
|
20
|
-
[[], true],
|
|
21
|
-
])("works with %s", (input, expected) => {
|
|
22
|
-
expect(map.isNullCoordinates(input)).toBe(expected);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
describe("isLabelLayer", () => {
|
|
27
|
-
it("works with just text-field", () => {
|
|
28
|
-
const layer = { type: "symbol", layout: { "text-field": "Label" } };
|
|
29
|
-
expect(map.isLabelLayer(layer)).toBe(true);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
it("works with text-field + minzoom < 15", () => {
|
|
33
|
-
const layer = { type: "symbol", layout: { "text-field": "Label" }, minzoom: 10 };
|
|
34
|
-
expect(map.isLabelLayer(layer)).toBe(true);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it("works with text-field + minzoom >= 15", () => {
|
|
38
|
-
const layer = { type: "symbol", layout: { "text-field": "Label" }, minzoom: 15 };
|
|
39
|
-
expect(map.isLabelLayer(layer)).toBe(false);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it("works with non-symbol layer", () => {
|
|
43
|
-
const layer = { type: "fill", layout: { "text-field": "Label" } };
|
|
44
|
-
expect(map.isLabelLayer(layer)).toBe(false);
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it("works without text-field", () => {
|
|
48
|
-
const layer = { type: "symbol", layout: {} };
|
|
49
|
-
expect(map.isLabelLayer(layer)).toBe(false);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe("hasStyleLoggedGridStats", () => {
|
|
54
|
-
it("works when style has logged grid stats", () => {
|
|
55
|
-
const res = map.hasStyleLoggedGridStats({
|
|
56
|
-
metadata: {
|
|
57
|
-
"panoramax:fields": {
|
|
58
|
-
grid: ["logged_coef_360_pictures", "logged_coef_flat_pictures", "logged_coef"]
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
expect(res).toBe(true);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it("works when no panoramax fields is set", () => {
|
|
66
|
-
const res = map.hasStyleLoggedGridStats({});
|
|
67
|
-
expect(res).toBe(false);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe("getPanoramaxLayers", () => {
|
|
72
|
-
it("works with no grid and vector", () => {
|
|
73
|
-
const s = {
|
|
74
|
-
sources: { geovisio: { type: "vector" } }
|
|
75
|
-
};
|
|
76
|
-
expect(map.getPanoramaxLayers(s)).toMatchSnapshot();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("works with no grid and geojson", () => {
|
|
80
|
-
const s = {
|
|
81
|
-
sources: { geovisio: { type: "geojson" } }
|
|
82
|
-
};
|
|
83
|
-
expect(map.getPanoramaxLayers(s)).toMatchSnapshot();
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
it("works with grid and vector", () => {
|
|
87
|
-
const s = {
|
|
88
|
-
sources: { geovisio: { type: "vector" } },
|
|
89
|
-
metadata: {
|
|
90
|
-
"panoramax:fields": {
|
|
91
|
-
grid: []
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
expect(map.getPanoramaxLayers(s)).toMatchSnapshot();
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
it("works with grid and geojson", () => {
|
|
99
|
-
const s = {
|
|
100
|
-
sources: { geovisio: { type: "geojson" } },
|
|
101
|
-
metadata: {
|
|
102
|
-
"panoramax:fields": {
|
|
103
|
-
grid: []
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
expect(map.getPanoramaxLayers(s)).toMatchSnapshot();
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
describe("isPanoramaxEndpointSingleUser", () => {
|
|
112
|
-
it("works with null-like", () => {
|
|
113
|
-
expect(map.isPanoramaxEndpointSingleUser()).toBe(false);
|
|
114
|
-
expect(map.isPanoramaxEndpointSingleUser(null)).toBe(false);
|
|
115
|
-
expect(map.isPanoramaxEndpointSingleUser(undefined)).toBe(false);
|
|
116
|
-
expect(map.isPanoramaxEndpointSingleUser("")).toBe(false);
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
it("works with general endpoints", () => {
|
|
120
|
-
expect(map.isPanoramaxEndpointSingleUser("default")).toBe(false);
|
|
121
|
-
expect(map.isPanoramaxEndpointSingleUser("metacatalog")).toBe(false);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it("works with user-specific endpoint", () => {
|
|
125
|
-
expect(map.isPanoramaxEndpointSingleUser("1234-4567-8910-1112")).toBe(true);
|
|
126
|
-
expect(map.isPanoramaxEndpointSingleUser("metacatalog_1234-4567-8910-1112")).toBe(true);
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe("switchCoefValue", () => {
|
|
131
|
-
it("works", () => {
|
|
132
|
-
const l = {id: "bla", paint: { "circle-radius": ["bla", ["get", "coef"]]}, layout: {"circle-sort": "coef"}};
|
|
133
|
-
const res = map.switchCoefValue(l, "coef_360");
|
|
134
|
-
expect(res).toEqual({id: "bla", paint: { "circle-radius": ["bla", ["get", "coef_360"]]}, layout: {"circle-sort": "coef_360"}})
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
Object.defineProperty(window, "localStorage", { value: {
|
|
140
|
-
setItem: jest.fn(),
|
|
141
|
-
getItem: jest.fn(),
|
|
142
|
-
} });
|
|
143
|
-
|
|
144
|
-
describe("getMapParamsFromLocalStorage", () => {
|
|
145
|
-
it("should return an empty object if no params are stored", () => {
|
|
146
|
-
localStorage.getItem.mockReturnValue(null);
|
|
147
|
-
const result = map.getMapParamsFromLocalStorage();
|
|
148
|
-
expect(result).toEqual({});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it("should return parsed params if they exist in localStorage", () => {
|
|
152
|
-
const params = { center: { lat: "48.8566000", lng: "2.3522000" }, zoom: "10.0", background: "aerial", theme: "age" };
|
|
153
|
-
localStorage.getItem.mockReturnValue(JSON.stringify(params));
|
|
154
|
-
const result = map.getMapParamsFromLocalStorage();
|
|
155
|
-
expect(localStorage.getItem.mock.calls).toMatchSnapshot();
|
|
156
|
-
expect(result).toEqual(params);
|
|
157
|
-
});
|
|
158
|
-
|
|
159
|
-
it("should return an empty object if JSON parsing fails", () => {
|
|
160
|
-
console.warn = jest.fn();
|
|
161
|
-
localStorage.getItem.mockReturnValue("invalid-json");
|
|
162
|
-
const result = map.getMapParamsFromLocalStorage();
|
|
163
|
-
expect(result).toEqual({});
|
|
164
|
-
expect(console.warn.mock.calls[0][0]).toEqual("Can't read map parameters stored in localStorage");
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
describe("saveMapParamsToLocalStorage", () => {
|
|
169
|
-
const mockMap = {
|
|
170
|
-
getCenter: jest.fn().mockReturnValue({ lat: 48.8566, lng: 2.3522 }),
|
|
171
|
-
getZoom: jest.fn().mockReturnValue(10),
|
|
172
|
-
_mapFilters: { theme: "qualityscore" },
|
|
173
|
-
on: jest.fn(),
|
|
174
|
-
_parent: {
|
|
175
|
-
mapStyleComposer: {
|
|
176
|
-
addEventListener: jest.fn(),
|
|
177
|
-
},
|
|
178
|
-
},
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
beforeEach(() => {
|
|
182
|
-
jest.clearAllMocks();
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
it("should add event listeners to the map", () => {
|
|
186
|
-
map.saveMapParamsToLocalStorage(mockMap);
|
|
187
|
-
expect(mockMap.on).toHaveBeenCalledWith("moveend", expect.any(Function));
|
|
188
|
-
expect(mockMap.on).toHaveBeenCalledWith("zoomend", expect.any(Function));
|
|
189
|
-
expect(mockMap.on).toHaveBeenCalledWith("dragend", expect.any(Function));
|
|
190
|
-
expect(mockMap.on).toHaveBeenCalledWith("boxzoomend", expect.any(Function));
|
|
191
|
-
expect(mockMap._parent.mapStyleComposer.addEventListener).toHaveBeenCalledWith("basemap-changed", expect.any(Function));
|
|
192
|
-
expect(mockMap._parent.mapStyleComposer.addEventListener).toHaveBeenCalledWith("theme-changed", expect.any(Function));
|
|
193
|
-
expect(mockMap._parent.mapStyleComposer.addEventListener).toHaveBeenCalledWith("filters-changed", expect.any(Function));
|
|
194
|
-
});
|
|
195
|
-
|
|
196
|
-
it("should save map parameters to localStorage", () => {
|
|
197
|
-
map.saveMapParamsToLocalStorage(mockMap);
|
|
198
|
-
expect(localStorage.setItem.mock.calls).toMatchSnapshot();
|
|
199
|
-
});
|
|
200
|
-
});
|