@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
package/scripts/start.js
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// Do this as the first thing so that any code reading it knows the right env.
|
|
4
|
-
process.env.BABEL_ENV = 'development';
|
|
5
|
-
process.env.NODE_ENV = 'development';
|
|
6
|
-
|
|
7
|
-
// Makes the script crash on unhandled rejections instead of silently
|
|
8
|
-
// ignoring them. In the future, promise rejections that are not handled will
|
|
9
|
-
// terminate the Node.js process with a non-zero exit code.
|
|
10
|
-
process.on('unhandledRejection', err => {
|
|
11
|
-
throw err;
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
// Ensure environment variables are read.
|
|
15
|
-
require('../config/env');
|
|
16
|
-
|
|
17
|
-
const fs = require('fs');
|
|
18
|
-
const chalk = require('react-dev-utils/chalk');
|
|
19
|
-
const webpack = require('webpack');
|
|
20
|
-
const WebpackDevServer = require('webpack-dev-server');
|
|
21
|
-
const clearConsole = require('react-dev-utils/clearConsole');
|
|
22
|
-
const checkRequiredFiles = require('react-dev-utils/checkRequiredFiles');
|
|
23
|
-
const {
|
|
24
|
-
choosePort,
|
|
25
|
-
createCompiler,
|
|
26
|
-
prepareProxy,
|
|
27
|
-
prepareUrls,
|
|
28
|
-
} = require('react-dev-utils/WebpackDevServerUtils');
|
|
29
|
-
const openBrowser = require('react-dev-utils/openBrowser');
|
|
30
|
-
const semver = require('semver');
|
|
31
|
-
const paths = require('../config/paths');
|
|
32
|
-
const configFactory = require('../config/webpack.config');
|
|
33
|
-
const createDevServerConfig = require('../config/webpackDevServer.config');
|
|
34
|
-
const getClientEnvironment = require('../config/env');
|
|
35
|
-
const react = require(require.resolve('react', { paths: [paths.appPath] }));
|
|
36
|
-
|
|
37
|
-
const env = getClientEnvironment(paths.publicUrlOrPath.slice(0, -1));
|
|
38
|
-
const useYarn = fs.existsSync(paths.yarnLockFile);
|
|
39
|
-
const isInteractive = process.stdout.isTTY;
|
|
40
|
-
|
|
41
|
-
// Warn and crash if required files are missing
|
|
42
|
-
if (!checkRequiredFiles([paths.appHtml, paths.appHtmlMap])) {
|
|
43
|
-
process.exit(1);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Tools like Cloud9 rely on this.
|
|
47
|
-
const DEFAULT_PORT = parseInt(process.env.PORT, 10) || 3000;
|
|
48
|
-
const HOST = process.env.HOST || '0.0.0.0';
|
|
49
|
-
|
|
50
|
-
if (process.env.HOST) {
|
|
51
|
-
console.log(
|
|
52
|
-
chalk.cyan(
|
|
53
|
-
`Attempting to bind to HOST environment variable: ${chalk.yellow(
|
|
54
|
-
chalk.bold(process.env.HOST)
|
|
55
|
-
)}`
|
|
56
|
-
)
|
|
57
|
-
);
|
|
58
|
-
console.log(
|
|
59
|
-
`If this was unintentional, check that you haven't mistakenly set it in your shell.`
|
|
60
|
-
);
|
|
61
|
-
console.log(
|
|
62
|
-
`Learn more here: ${chalk.yellow('https://cra.link/advanced-config')}`
|
|
63
|
-
);
|
|
64
|
-
console.log();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// We require that you explicitly set browsers and do not fall back to
|
|
68
|
-
// browserslist defaults.
|
|
69
|
-
const { checkBrowsers } = require('react-dev-utils/browsersHelper');
|
|
70
|
-
checkBrowsers(paths.appPath, isInteractive)
|
|
71
|
-
.then(() => {
|
|
72
|
-
// We attempt to use the default port but if it is busy, we offer the user to
|
|
73
|
-
// run on a different port. `choosePort()` Promise resolves to the next free port.
|
|
74
|
-
return choosePort(HOST, DEFAULT_PORT);
|
|
75
|
-
})
|
|
76
|
-
.then(port => {
|
|
77
|
-
if (port == null) {
|
|
78
|
-
// We have not found a port.
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
const args = process.argv;
|
|
82
|
-
const testMode = args[2] === "--testMode";
|
|
83
|
-
const config = configFactory('development');
|
|
84
|
-
const protocol = process.env.HTTPS === 'true' ? 'https' : 'http';
|
|
85
|
-
const appName = require(paths.appPackageJson).name;
|
|
86
|
-
|
|
87
|
-
const useTypeScript = fs.existsSync(paths.appTsConfig);
|
|
88
|
-
const urls = prepareUrls(
|
|
89
|
-
protocol,
|
|
90
|
-
HOST,
|
|
91
|
-
port,
|
|
92
|
-
paths.publicUrlOrPath.slice(0, -1)
|
|
93
|
-
);
|
|
94
|
-
// Create a webpack compiler that is configured with custom messages.
|
|
95
|
-
const compiler = createCompiler({
|
|
96
|
-
appName,
|
|
97
|
-
config,
|
|
98
|
-
urls,
|
|
99
|
-
useYarn,
|
|
100
|
-
useTypeScript,
|
|
101
|
-
webpack,
|
|
102
|
-
});
|
|
103
|
-
// Load proxy config
|
|
104
|
-
const proxySetting = require(paths.appPackageJson).proxy;
|
|
105
|
-
const proxyConfig = prepareProxy(
|
|
106
|
-
proxySetting,
|
|
107
|
-
paths.appPublic,
|
|
108
|
-
paths.publicUrlOrPath
|
|
109
|
-
);
|
|
110
|
-
// Serve webpack assets generated by the compiler over a web server.
|
|
111
|
-
const serverConfig = {
|
|
112
|
-
...createDevServerConfig(proxyConfig, urls.lanUrlForConfig),
|
|
113
|
-
host: HOST,
|
|
114
|
-
port,
|
|
115
|
-
};
|
|
116
|
-
const devServer = new WebpackDevServer(serverConfig, compiler);
|
|
117
|
-
// Launch WebpackDevServer.
|
|
118
|
-
devServer.startCallback(() => {
|
|
119
|
-
if (isInteractive) {
|
|
120
|
-
clearConsole();
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (env.raw.FAST_REFRESH && semver.lt(react.version, '16.10.0')) {
|
|
124
|
-
console.log(
|
|
125
|
-
chalk.yellow(
|
|
126
|
-
`Fast Refresh requires React 16.10 or higher. You are using React ${react.version}.`
|
|
127
|
-
)
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
console.log(chalk.cyan('Starting the development server...\n'));
|
|
132
|
-
openBrowser(urls.localUrlForBrowser);
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Handle testMode
|
|
136
|
-
*/
|
|
137
|
-
if(testMode){
|
|
138
|
-
compiler.hooks.done.tap('done', (stats) => {
|
|
139
|
-
stats = stats.toJson();
|
|
140
|
-
|
|
141
|
-
if (stats.errors && stats.errors.length > 0) {
|
|
142
|
-
devServer.stopCallback(() => process.exit(1));
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
console.warn("App started in test mode. Closing in 5 seconds.");
|
|
146
|
-
let closeTimeout = setTimeout(() => {
|
|
147
|
-
clearTimeout(closeTimeout);
|
|
148
|
-
devServer.stopCallback(() => process.exit());
|
|
149
|
-
}, 5000);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
['SIGINT', 'SIGTERM'].forEach(function (sig) {
|
|
155
|
-
process.on(sig, function () {
|
|
156
|
-
devServer.stopCallback(() => process.exit());
|
|
157
|
-
});
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
if (process.env.CI !== 'true') {
|
|
161
|
-
// Gracefully exit when stdin ends
|
|
162
|
-
process.stdin.on('end', function () {
|
|
163
|
-
devServer.stopCallback(() => process.exit());
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
})
|
|
167
|
-
.catch(err => {
|
|
168
|
-
if (err && err.message) {
|
|
169
|
-
console.log(err.message);
|
|
170
|
-
}
|
|
171
|
-
process.exit(1);
|
|
172
|
-
});
|
package/scripts/test.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Do this as the first thing so that any code reading it knows the right env.
|
|
4
|
-
process.env.BABEL_ENV = 'test';
|
|
5
|
-
process.env.NODE_ENV = 'test';
|
|
6
|
-
process.env.PUBLIC_URL = '';
|
|
7
|
-
|
|
8
|
-
// Makes the script crash on unhandled rejections instead of silently
|
|
9
|
-
// ignoring them. In the future, promise rejections that are not handled will
|
|
10
|
-
// terminate the Node.js process with a non-zero exit code.
|
|
11
|
-
process.on('unhandledRejection', err => {
|
|
12
|
-
throw err;
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
// Ensure environment variables are read.
|
|
16
|
-
require('../config/env');
|
|
17
|
-
|
|
18
|
-
const jest = require('jest');
|
|
19
|
-
const execSync = require('child_process').execSync;
|
|
20
|
-
let argv = process.argv.slice(2);
|
|
21
|
-
|
|
22
|
-
function isInGitRepository() {
|
|
23
|
-
try {
|
|
24
|
-
execSync('git rev-parse --is-inside-work-tree', { stdio: 'ignore' });
|
|
25
|
-
return true;
|
|
26
|
-
} catch (e) {
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function isInMercurialRepository() {
|
|
32
|
-
try {
|
|
33
|
-
execSync('hg --cwd . root', { stdio: 'ignore' });
|
|
34
|
-
return true;
|
|
35
|
-
} catch (e) {
|
|
36
|
-
return false;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Watch unless on CI or explicitly running all tests
|
|
41
|
-
if (
|
|
42
|
-
!process.env.CI &&
|
|
43
|
-
argv.indexOf('--watchAll') === -1 &&
|
|
44
|
-
argv.indexOf('--watchAll=false') === -1
|
|
45
|
-
) {
|
|
46
|
-
// https://github.com/facebook/create-react-app/issues/5210
|
|
47
|
-
const hasSourceControl = isInGitRepository() || isInMercurialRepository();
|
|
48
|
-
argv.push(hasSourceControl ? '--watch' : '--watchAll');
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
jest.run(argv);
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Core graphical components
|
|
5
|
-
* @module Panoramax:components:core
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
export {default as Basic} from "./Basic";
|
|
9
|
-
export {default as CoverageMap} from "./CoverageMap";
|
|
10
|
-
export {default as Editor} from "./Editor";
|
|
11
|
-
export {default as Viewer} from "./Viewer";
|
|
12
|
-
export {default as PhotoViewer} from "./PhotoViewer";
|
package/src/components/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Graphical components
|
|
5
|
-
* @module Panoramax:components
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import * as core from "./core";
|
|
9
|
-
import * as layout from "./layout";
|
|
10
|
-
import * as menus from "./menus/index";
|
|
11
|
-
import * as ui from "./ui/index";
|
|
12
|
-
|
|
13
|
-
export {core, layout, menus, ui};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* General layout components
|
|
3
|
-
* @module Panoramax:components:layout
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export {default as BottomDrawer} from "./BottomDrawer";
|
|
7
|
-
export {default as CorneredGrid} from "./CorneredGrid";
|
|
8
|
-
export {default as Mini} from "./Mini";
|
|
9
|
-
export {default as Tabs} from "./Tabs";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Complex menus components
|
|
3
|
-
* @module Panoramax:components:menus
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export {default as LocationPrecisionDoc} from "./LocationPrecisionDoc";
|
|
7
|
-
export {default as MapBackground} from "./MapBackground";
|
|
8
|
-
export {default as MapFilters} from "./MapFilters";
|
|
9
|
-
export {default as MapLayers} from "./MapLayers";
|
|
10
|
-
export {default as MapLegend} from "./MapLegend";
|
|
11
|
-
export {default as MiniPictureLegend} from "./MiniPictureLegend";
|
|
12
|
-
export {default as PictureLegend} from "./PictureLegend";
|
|
13
|
-
export {default as PictureMetadata} from "./PictureMetadata";
|
|
14
|
-
export {default as PlayerOptions} from "./PlayerOptions";
|
|
15
|
-
export {default as QualityScoreDoc} from "./QualityScoreDoc";
|
|
16
|
-
export {default as ReportForm} from "./ReportForm";
|
|
17
|
-
export {default as SemanticsDoc} from "./SemanticsDoc";
|
|
18
|
-
export {default as SemanticsDownload} from "./SemanticsDownload";
|
|
19
|
-
export {default as SemanticsFilters} from "./SemanticsFilters";
|
|
20
|
-
export {default as SemanticsList} from "./SemanticsList";
|
|
21
|
-
export {default as SemanticsMetadata} from "./SemanticsMetadata";
|
|
22
|
-
export {default as Share} from "./Share";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
|
|
3
|
-
// Lightweight export for PhotoViewer
|
|
4
|
-
export {default as PictureLegend} from "./PictureLegend";
|
|
5
|
-
export {default as PictureMetadata} from "./PictureMetadata";
|
|
6
|
-
export {default as PlayerOptions} from "./PlayerOptions";
|
|
7
|
-
export {default as QualityScoreDoc} from "./QualityScoreDoc";
|
|
8
|
-
export {default as ReportForm} from "./ReportForm";
|
|
9
|
-
export {default as SemanticsDoc} from "./SemanticsDoc";
|
|
10
|
-
export {default as SemanticsDownload} from "./SemanticsDownload";
|
|
11
|
-
export {default as SemanticsList} from "./SemanticsList";
|
|
12
|
-
export {default as SemanticsMetadata} from "./SemanticsMetadata";
|
|
13
|
-
export {default as Share} from "./Share";
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Smaller UI pieces components
|
|
3
|
-
* @module Panoramax:components:ui
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export {default as AnnotationsSwitch} from "./AnnotationsSwitch";
|
|
7
|
-
export {default as ButtonGroup} from "./ButtonGroup";
|
|
8
|
-
export {default as Button} from "./Button";
|
|
9
|
-
export {default as CopyButton} from "./CopyButton";
|
|
10
|
-
export {default as Grade} from "./Grade";
|
|
11
|
-
export {default as GradeFilter} from "./GradeFilter";
|
|
12
|
-
export {default as IconSwitch} from "./IconSwitch";
|
|
13
|
-
export {default as LinkButton} from "./LinkButton";
|
|
14
|
-
export {default as ListGroup} from "./ListGroup";
|
|
15
|
-
export {default as ListItem} from "./ListItem";
|
|
16
|
-
export {default as Loader} from "./Loader";
|
|
17
|
-
export {default as Map} from "./Map";
|
|
18
|
-
export {default as MapMore} from "./MapMore";
|
|
19
|
-
export {default as Photo} from "./Photo";
|
|
20
|
-
export {default as Popup} from "./Popup";
|
|
21
|
-
export {default as ProgressBar} from "./ProgressBar";
|
|
22
|
-
export {default as QualityScore} from "./QualityScore";
|
|
23
|
-
export {default as SearchBar} from "./SearchBar";
|
|
24
|
-
export {default as SemanticsEditor} from "./SemanticsEditor";
|
|
25
|
-
export {default as SemanticsTable} from "./SemanticsTable";
|
|
26
|
-
export {default as Switch} from "./Switch";
|
|
27
|
-
export {default as TogglableGroup} from "./TogglableGroup";
|
|
28
|
-
import * as widgets from "./widgets/index";
|
|
29
|
-
export {widgets};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
|
|
3
|
-
// Lightweight export for PhotoViewer
|
|
4
|
-
export {default as ButtonGroup} from "./ButtonGroup";
|
|
5
|
-
export {default as Button} from "./Button";
|
|
6
|
-
export {default as CopyButton} from "./CopyButton";
|
|
7
|
-
export {default as Grade} from "./Grade";
|
|
8
|
-
export {default as AnnotationsSwitch} from "./AnnotationsSwitch";
|
|
9
|
-
export {default as LinkButton} from "./LinkButton";
|
|
10
|
-
export {default as ListGroup} from "./ListGroup";
|
|
11
|
-
export {default as ListItem} from "./ListItem";
|
|
12
|
-
export {default as Loader} from "./Loader";
|
|
13
|
-
export {default as Photo} from "./Photo";
|
|
14
|
-
export {default as Popup} from "./Popup";
|
|
15
|
-
export {default as ProgressBar} from "./ProgressBar";
|
|
16
|
-
export {default as QualityScore} from "./QualityScore";
|
|
17
|
-
export {default as SearchBar} from "./SearchBar";
|
|
18
|
-
export {default as SemanticsEditor} from "./SemanticsEditor";
|
|
19
|
-
export {default as SemanticsTable} from "./SemanticsTable";
|
|
20
|
-
export {default as Switch} from "./Switch";
|
|
21
|
-
export {default as TogglableGroup} from "./TogglableGroup";
|
|
22
|
-
import * as widgets from "./widgets/index_photoviewer";
|
|
23
|
-
export {widgets};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pre-assembled UI pieces components
|
|
3
|
-
* @module Panoramax:components:ui:widgets
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export {default as CopyCoordinates} from "./CopyCoordinates";
|
|
7
|
-
export {default as GeoSearch} from "./GeoSearch";
|
|
8
|
-
export {default as Legend} from "./Legend";
|
|
9
|
-
export {default as LevelSelect} from "./LevelSelect";
|
|
10
|
-
export {default as MapFiltersButton} from "./MapFiltersButton";
|
|
11
|
-
export {default as MapLayersButton} from "./MapLayersButton";
|
|
12
|
-
export {default as OSMEditors} from "./OSMEditors";
|
|
13
|
-
export {default as PictureLegendActions} from "./PictureLegendActions";
|
|
14
|
-
export {default as Player} from "./Player";
|
|
15
|
-
export {default as SemanticsFiltersButton} from "./SemanticsFiltersButton";
|
|
16
|
-
export {default as Zoom} from "./Zoom";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
|
|
3
|
-
// Lightweight export for PhotoViewer
|
|
4
|
-
export {default as CopyCoordinates} from "./CopyCoordinates";
|
|
5
|
-
export {default as Legend} from "./Legend";
|
|
6
|
-
export {default as OSMEditors} from "./OSMEditors";
|
|
7
|
-
export {default as PictureLegendActions} from "./PictureLegendActions";
|
|
8
|
-
export {default as Player} from "./Player";
|
|
9
|
-
export {default as Zoom} from "./Zoom";
|
package/src/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
|
|
3
|
-
export * as components from "./components/index";
|
|
4
|
-
export * as utils from "./utils/index";
|
|
5
|
-
export {default as Viewer} from "./components/core/Viewer";
|
|
6
|
-
export {default as CoverageMap} from "./components/core/CoverageMap";
|
|
7
|
-
export {default as Editor} from "./components/core/Editor";
|
|
8
|
-
export {default as PhotoViewer} from "./components/core/PhotoViewer";
|
package/src/index_photoviewer.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
|
|
3
|
-
// Lightweight export for PhotoViewer
|
|
4
|
-
export * as components from "./components/index_photoviewer";
|
|
5
|
-
export * as utils from "./utils/index_photoviewer";
|
|
6
|
-
export {default as PhotoViewer} from "./components/core/PhotoViewer";
|
package/src/utils/index.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as geocoder from "./geocoder";
|
|
2
|
-
import * as i18n from "./i18n";
|
|
3
|
-
import * as indoor from "./indoor";
|
|
4
|
-
import * as map from "./map";
|
|
5
|
-
import * as picture from "./picture";
|
|
6
|
-
import * as semantics from "./semantics";
|
|
7
|
-
import * as services from "./services";
|
|
8
|
-
import * as utils from "./utils";
|
|
9
|
-
import * as widgets from "./widgets";
|
|
10
|
-
|
|
11
|
-
export { geocoder, i18n, indoor, map, picture, semantics, services, utils, widgets };
|
|
12
|
-
export {default as API} from "./API";
|
|
13
|
-
export {default as InitParameters} from "./InitParameters";
|
|
14
|
-
export {default as MapStyleComposer} from "./MapStyleComposer";
|
|
15
|
-
export {default as PhotoAdapter} from "./PhotoAdapter";
|
|
16
|
-
export {default as PresetsManager} from "./PresetsManager";
|
|
17
|
-
export {default as URLHandler} from "./URLHandler";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/* eslint-disable import/no-unused-modules */
|
|
2
|
-
|
|
3
|
-
// Lightweight export for PhotoViewer
|
|
4
|
-
import * as i18n from "./i18n";
|
|
5
|
-
import * as picture from "./picture";
|
|
6
|
-
import * as semantics from "./semantics";
|
|
7
|
-
import * as services from "./services";
|
|
8
|
-
import * as utils from "./utils";
|
|
9
|
-
import * as widgets from "./widgets";
|
|
10
|
-
|
|
11
|
-
export { i18n, picture, semantics, services, utils, widgets };
|
|
12
|
-
export {default as API} from "./API";
|
|
13
|
-
export {default as InitParameters} from "./InitParameters";
|
|
14
|
-
export {default as PhotoAdapter} from "./PhotoAdapter";
|
|
15
|
-
export {default as PresetsManager} from "./PresetsManager";
|
|
16
|
-
export {default as URLHandler} from "./URLHandler";
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import Basic from "../../../src/components/core/Basic";
|
|
2
|
-
import API from "../../../src/utils/API";
|
|
3
|
-
|
|
4
|
-
jest.mock("../../../src/utils/API");
|
|
5
|
-
jest.mock("../../../src/utils/i18n");
|
|
6
|
-
jest.mock("../../../src/utils/widgets");
|
|
7
|
-
jest.mock("../../../src/utils/utils");
|
|
8
|
-
jest.mock("../../../package.json", () => ({ version: "1.0.0", repository: { url: "https://example.com" } }));
|
|
9
|
-
|
|
10
|
-
let basic;
|
|
11
|
-
global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
|
|
12
|
-
|
|
13
|
-
beforeEach(() => {
|
|
14
|
-
basic = new Basic(true);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
afterEach(() => {
|
|
18
|
-
jest.clearAllMocks();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
describe("constructor", () => {
|
|
22
|
-
it("should initialize with default values", () => {
|
|
23
|
-
expect(basic.picture).toBeNull();
|
|
24
|
-
expect(basic.sequence).toBeNull();
|
|
25
|
-
expect(basic["fetch-options"]).toBeUndefined();
|
|
26
|
-
expect(basic.lang).toBeNull();
|
|
27
|
-
expect(basic.endpoint).toBeNull();
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it("should log version info on initialization", () => {
|
|
31
|
-
new Basic(true);
|
|
32
|
-
expect(console.info).toHaveBeenCalledWith(expect.stringContaining("Panoramax Basic - Version 1.0.0"));
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("should set up API when endpoint is provided", async () => {
|
|
36
|
-
basic.endpoint = "https://api.example.com";
|
|
37
|
-
basic.attributeChangedCallback("endpoint", null, "https://api.example.com");
|
|
38
|
-
expect(API).toHaveBeenCalledWith("https://api.example.com", expect.any(Object));
|
|
39
|
-
});
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe("attributeChangedCallback", () => {
|
|
43
|
-
it("should dispatch select event when picture or sequence changes", () => {
|
|
44
|
-
const eventSpy = jest.spyOn(basic, "dispatchEvent");
|
|
45
|
-
basic.attributeChangedCallback("picture", null, "new-pic-id");
|
|
46
|
-
expect(eventSpy).toHaveBeenCalledWith(expect.any(CustomEvent));
|
|
47
|
-
eventSpy.mockRestore();
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
describe("getClassName", () => {
|
|
52
|
-
it("works", () => {
|
|
53
|
-
expect(basic.getClassName()).toBe("Basic");
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
describe("select", () => {
|
|
58
|
-
it("works", () => {
|
|
59
|
-
basic.select("new-seq-id", "new-pic-id");
|
|
60
|
-
expect(basic.picture).toBe("new-pic-id");
|
|
61
|
-
expect(basic.sequence).toBe("new-seq-id");
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
describe("isWidthSmall", () => {
|
|
66
|
-
it("works", () => {
|
|
67
|
-
basic.offsetWidth = 500;
|
|
68
|
-
expect(basic.isWidthSmall()).toBe(true);
|
|
69
|
-
basic.offsetWidth = 600;
|
|
70
|
-
expect(basic.isWidthSmall()).toBe(false);
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
describe("isHeightSmall", () => {
|
|
75
|
-
it("works", () => {
|
|
76
|
-
basic.offsetHeight = 300;
|
|
77
|
-
expect(basic.isHeightSmall()).toBe(true);
|
|
78
|
-
basic.offsetHeight = 500;
|
|
79
|
-
expect(basic.isHeightSmall()).toBe(false);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
describe("getSubComponentsNames", () => {
|
|
84
|
-
it("works", () => {
|
|
85
|
-
expect(basic.getSubComponentsNames()).toEqual(["loader", "api"]);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
describe("getAPI", () => {
|
|
90
|
-
it("works", () => {
|
|
91
|
-
basic.endpoint = "https://api.example.com";
|
|
92
|
-
basic.attributeChangedCallback("endpoint", null, "https://api.example.com");
|
|
93
|
-
expect(basic.getAPI()).toBe(basic.api);
|
|
94
|
-
});
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
describe("addEventListener", () => {
|
|
98
|
-
it("should add event listener for standard events", () => {
|
|
99
|
-
const listener = jest.fn();
|
|
100
|
-
basic.addEventListener("ready", listener);
|
|
101
|
-
basic.dispatchEvent(new CustomEvent("ready"));
|
|
102
|
-
expect(listener).toHaveBeenCalled();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("should add event listener with options", () => {
|
|
106
|
-
const listener = jest.fn();
|
|
107
|
-
basic.addEventListener("once-event", listener, { once: true });
|
|
108
|
-
basic.dispatchEvent(new CustomEvent("once-event"));
|
|
109
|
-
basic.dispatchEvent(new CustomEvent("once-event"));
|
|
110
|
-
expect(listener).toHaveBeenCalledTimes(1);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it("should wait for sub-component to be available", () => {
|
|
114
|
-
const listener = jest.fn();
|
|
115
|
-
global.setTimeout = jest.fn();
|
|
116
|
-
basic.getSubComponentsNames = () => ["loader", "api", "map"];
|
|
117
|
-
basic.map = null;
|
|
118
|
-
basic.addEventListener("map:move", listener);
|
|
119
|
-
expect(global.setTimeout).toHaveBeenCalled();
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it("adds listener to basic if no sub-component matches prefix", () => {
|
|
123
|
-
const listener = jest.fn();
|
|
124
|
-
basic.addEventListener("unknown:event", listener);
|
|
125
|
-
basic.dispatchEvent(new CustomEvent("unknown:event"));
|
|
126
|
-
expect(listener).toHaveBeenCalled();
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
describe("GetJSONConverter", () => {
|
|
131
|
-
const c = Basic.GetJSONConverter();
|
|
132
|
-
|
|
133
|
-
it("loads from empty attribute", () => {
|
|
134
|
-
expect(c.fromAttribute()).toBeNull();
|
|
135
|
-
expect(c.fromAttribute("")).toBeNull();
|
|
136
|
-
expect(c.fromAttribute(null)).toBeNull();
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it("loads from string", () => {
|
|
140
|
-
expect(c.fromAttribute("{coucou: \"hello\"}")).toEqual({coucou: "hello"});
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it("loads from array", () => {
|
|
144
|
-
expect(c.fromAttribute(["a", "b"])).toEqual(["a", "b"]);
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it("loads from object", () => {
|
|
148
|
-
expect(c.fromAttribute({coucou: "hello"})).toEqual({coucou: "hello"});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it("exports empty values", () => {
|
|
152
|
-
expect(c.toAttribute()).toBe("");
|
|
153
|
-
expect(c.toAttribute("")).toBe("");
|
|
154
|
-
expect(c.toAttribute(null)).toBe("");
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
it("exports strings", () => {
|
|
158
|
-
expect(c.toAttribute("{coucou: \"hello\"}")).toBe("{coucou: \"hello\"}");
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
it("exports arrays", () => {
|
|
162
|
-
expect(c.toAttribute(["a", "b"])).toBe("['a','b']");
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it("exports objects", () => {
|
|
166
|
-
expect(c.toAttribute({coucou: "hello"})).toBe("{coucou:'hello'}");
|
|
167
|
-
});
|
|
168
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
jest.mock("../../../src/components/core/Basic", () => (
|
|
2
|
-
class Basic extends EventTarget {
|
|
3
|
-
constructor() {
|
|
4
|
-
super();
|
|
5
|
-
this.loader = { setAttribute: jest.fn() };
|
|
6
|
-
this.api = {
|
|
7
|
-
getMapStyle: () => ({}),
|
|
8
|
-
_getMapRequestTransform: () => ({}),
|
|
9
|
-
_endpoints: {},
|
|
10
|
-
};
|
|
11
|
-
this._t = { maplibre: {}, psv: {} };
|
|
12
|
-
}
|
|
13
|
-
isWidthSmall() { return false; }
|
|
14
|
-
isHeightSmall() { return false; }
|
|
15
|
-
getSubComponentsNames() {
|
|
16
|
-
return ["loader", "api"];
|
|
17
|
-
}
|
|
18
|
-
onceAPIReady() {
|
|
19
|
-
return Promise.resolve();
|
|
20
|
-
}
|
|
21
|
-
static GetJSONConverter() {
|
|
22
|
-
return {};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
));
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import CoverageMap from "../../../src/components/core/CoverageMap";
|
|
2
|
-
import "./BasicMock";
|
|
3
|
-
|
|
4
|
-
let cm;
|
|
5
|
-
global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
|
|
6
|
-
|
|
7
|
-
beforeEach(() => cm = new CoverageMap());
|
|
8
|
-
afterEach(() => jest.clearAllMocks());
|
|
9
|
-
|
|
10
|
-
describe("getClassName", () => {
|
|
11
|
-
it("works", () => {
|
|
12
|
-
expect(cm.getClassName()).toBe("CoverageMap");
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe("getSubComponentsNames", () => {
|
|
17
|
-
it("works", () => {
|
|
18
|
-
expect(cm.getSubComponentsNames()).toEqual(["loader", "api", "map", "mapStyleComposer"]);
|
|
19
|
-
});
|
|
20
|
-
});
|