@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,437 +0,0 @@
|
|
|
1
|
-
import Photo from "../../../src/components/ui/Photo";
|
|
2
|
-
import fs from "fs";
|
|
3
|
-
import path from "path";
|
|
4
|
-
|
|
5
|
-
const createParent = () => {
|
|
6
|
-
const p = {
|
|
7
|
-
addEventListener: jest.fn(),
|
|
8
|
-
dispatchEvent: jest.fn(),
|
|
9
|
-
isWidthSmall: jest.fn(),
|
|
10
|
-
select: jest.fn(),
|
|
11
|
-
_t: { pnx: {} },
|
|
12
|
-
api: {
|
|
13
|
-
_getFetchOptions: jest.fn(),
|
|
14
|
-
_getPSVWithCredentials: () => false,
|
|
15
|
-
getPictureMetadataUrl: (picId, seqId) => `https://geovisio.fr/api/collections/${seqId}/items/${picId}`,
|
|
16
|
-
cleanResourceURL: u => u,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
p.getAPI = () => p.api;
|
|
21
|
-
|
|
22
|
-
return p;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
describe("constructor", () => {
|
|
27
|
-
it("works", () => {
|
|
28
|
-
const p = createParent();
|
|
29
|
-
const c = document.createElement("div");
|
|
30
|
-
const ph = new Photo(p, c);
|
|
31
|
-
expect(c.className).toBe("pnx-psv");
|
|
32
|
-
});
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
describe("_getNodeFromAPI", () => {
|
|
36
|
-
beforeEach(() => {
|
|
37
|
-
jest.clearAllMocks();
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("works", async () => {
|
|
41
|
-
const p = createParent();
|
|
42
|
-
const c = document.createElement("div");
|
|
43
|
-
const ph = new Photo(p, c);
|
|
44
|
-
global.fetch = jest.fn(() =>
|
|
45
|
-
Promise.resolve({
|
|
46
|
-
ok: true,
|
|
47
|
-
json: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "data", "Viewer_pictures_1.json")))),
|
|
48
|
-
})
|
|
49
|
-
);
|
|
50
|
-
global.Date = jest.fn(() => ({ toLocaleDateString: () => "June 3 2022" }));
|
|
51
|
-
const res = await ph._getNodeFromAPI("id");
|
|
52
|
-
expect(res).toMatchSnapshot();
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("works with nav filter", async () => {
|
|
56
|
-
const p = createParent();
|
|
57
|
-
const c = document.createElement("div");
|
|
58
|
-
const ph = new Photo(p, c);
|
|
59
|
-
p._picturesNavFilter = () => false;
|
|
60
|
-
global.fetch = jest.fn(() =>
|
|
61
|
-
Promise.resolve({
|
|
62
|
-
ok: true,
|
|
63
|
-
json: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "data", "Viewer_pictures_1.json")))),
|
|
64
|
-
})
|
|
65
|
-
);
|
|
66
|
-
global.Date = jest.fn(() => ({ toLocaleDateString: () => "June 3 2022" }));
|
|
67
|
-
const res = await ph._getNodeFromAPI("id");
|
|
68
|
-
expect(res).toMatchSnapshot();
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
describe("getPictureMetadata", () => {
|
|
73
|
-
it("works when pic is selected", () => {
|
|
74
|
-
const p = createParent();
|
|
75
|
-
const c = document.createElement("div");
|
|
76
|
-
const ph = new Photo(p, c);
|
|
77
|
-
ph._myVTour.state.currentNode = { id: "1234", bla: "bla" };
|
|
78
|
-
expect(ph.getPictureMetadata()).toStrictEqual({ id: "1234", bla: "bla" });
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it("nulls when no pic is selected", () => {
|
|
82
|
-
const p = createParent();
|
|
83
|
-
const c = document.createElement("div");
|
|
84
|
-
const ph = new Photo(p, c);
|
|
85
|
-
expect(ph.getPictureMetadata()).toBeNull();
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
describe("_onSelect", () => {
|
|
90
|
-
it("works", () => {
|
|
91
|
-
const p = createParent();
|
|
92
|
-
const c = document.createElement("div");
|
|
93
|
-
const ph = new Photo(p, c);
|
|
94
|
-
ph._myVTour = { setCurrentNode: jest.fn(() => Promise.resolve()), getCurrentNode: jest.fn() };
|
|
95
|
-
ph._onSelect({ detail: { picId: "id" } });
|
|
96
|
-
expect(ph._myVTour.setCurrentNode.mock.calls).toEqual([["id"]]);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it("works on pic ID already used", () => {
|
|
100
|
-
const p = createParent();
|
|
101
|
-
const c = document.createElement("div");
|
|
102
|
-
const ph = new Photo(p, c);
|
|
103
|
-
ph._myVTour = { setCurrentNode: jest.fn(() => Promise.resolve()), getCurrentNode: () => "id" };
|
|
104
|
-
ph._onSelect({ detail: { picId: "id" } });
|
|
105
|
-
expect(ph._myVTour.setCurrentNode.mock.calls).toEqual([["id"]]);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
describe("goToNextPicture", () => {
|
|
110
|
-
it("fails if no current picture", () => {
|
|
111
|
-
const p = createParent();
|
|
112
|
-
const c = document.createElement("div");
|
|
113
|
-
const ph = new Photo(p, c);
|
|
114
|
-
ph._myVTour = { state: { currentNode: undefined } };
|
|
115
|
-
expect(() => ph.goToNextPicture()).toThrow(new Error("No picture currently selected"));
|
|
116
|
-
});
|
|
117
|
-
|
|
118
|
-
it("works if next pic exists", () => {
|
|
119
|
-
const p = createParent();
|
|
120
|
-
const c = document.createElement("div");
|
|
121
|
-
const ph = new Photo(p, c);
|
|
122
|
-
ph._myVTour = { state: { currentNode: { id: "bla", sequence: { id: "seq", nextPic: "idnext" } } } };
|
|
123
|
-
ph.goToNextPicture();
|
|
124
|
-
expect(p.select.mock.calls).toEqual([["seq", "idnext"]]);
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("fails if no next picture", () => {
|
|
128
|
-
const p = createParent();
|
|
129
|
-
const c = document.createElement("div");
|
|
130
|
-
const ph = new Photo(p, c);
|
|
131
|
-
ph._myVTour = { state: { currentNode: { id: "bla", sequence: {} } } };
|
|
132
|
-
expect(() => ph.goToNextPicture()).toThrow(new Error("No next picture available"));
|
|
133
|
-
});
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
describe("goToPrevPicture", () => {
|
|
137
|
-
it("fails if no current picture", () => {
|
|
138
|
-
const p = createParent();
|
|
139
|
-
const c = document.createElement("div");
|
|
140
|
-
const ph = new Photo(p, c);
|
|
141
|
-
ph._myVTour = { state: { currentNode: undefined } };
|
|
142
|
-
expect(() => ph.goToPrevPicture()).toThrow(new Error("No picture currently selected"));
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
it("works if next pic exists", () => {
|
|
146
|
-
const p = createParent();
|
|
147
|
-
const c = document.createElement("div");
|
|
148
|
-
const ph = new Photo(p, c);
|
|
149
|
-
ph._myVTour = { state: { currentNode: { id: "bla", sequence: { id: "seq", prevPic: "idprev" } } } };
|
|
150
|
-
ph.goToPrevPicture();
|
|
151
|
-
expect(p.select.mock.calls).toEqual([["seq", "idprev"]]);
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it("fails if no next picture", () => {
|
|
155
|
-
const p = createParent();
|
|
156
|
-
const c = document.createElement("div");
|
|
157
|
-
const ph = new Photo(p, c);
|
|
158
|
-
ph._myVTour = { state: { currentNode: { id: "bla", sequence: {} } } };
|
|
159
|
-
expect(() => ph.goToPrevPicture()).toThrow(new Error("No previous picture available"));
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
describe("goToPosition", () => {
|
|
164
|
-
it("works", async () => {
|
|
165
|
-
const p = createParent();
|
|
166
|
-
const c = document.createElement("div");
|
|
167
|
-
const ph = new Photo(p, c);
|
|
168
|
-
p.api = {
|
|
169
|
-
getPicturesAroundCoordinates: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "data", "Viewer_pictures_1.json")))),
|
|
170
|
-
_getFetchOptions: jest.fn()
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
const res = await ph.goToPosition(48.7, -1.8);
|
|
174
|
-
|
|
175
|
-
expect(res).toEqual("0005086d-65eb-4a90-9764-86b3661aaa77");
|
|
176
|
-
expect(p.select.mock.calls).toEqual([["bb129602-5ac1-4512-bf67-9ec1fa23033f", "0005086d-65eb-4a90-9764-86b3661aaa77"]]);
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
it("handles empty result from API", () => {
|
|
180
|
-
const p = createParent();
|
|
181
|
-
const c = document.createElement("div");
|
|
182
|
-
const ph = new Photo(p, c);
|
|
183
|
-
p.api = {
|
|
184
|
-
getPicturesAroundCoordinates: () => Promise.resolve({ "features": [] }),
|
|
185
|
-
_getFetchOptions: jest.fn()
|
|
186
|
-
};
|
|
187
|
-
return expect(ph.goToPosition()).rejects.toStrictEqual(new Error("No picture found nearby given coordinates"));
|
|
188
|
-
});
|
|
189
|
-
});
|
|
190
|
-
|
|
191
|
-
describe("getXY", () => {
|
|
192
|
-
it("works", () => {
|
|
193
|
-
const p = createParent();
|
|
194
|
-
const c = document.createElement("div");
|
|
195
|
-
const ph = new Photo(p, c);
|
|
196
|
-
ph.getPosition = () => ({ yaw: 0.7853981634, pitch: -1.2217304764 });
|
|
197
|
-
expect(ph.getXY()).toEqual({ x: 45.0000000001462, y: -70.00000000022743 });
|
|
198
|
-
});
|
|
199
|
-
});
|
|
200
|
-
|
|
201
|
-
describe("getXYZ", () => {
|
|
202
|
-
it("works", () => {
|
|
203
|
-
const p = createParent();
|
|
204
|
-
const c = document.createElement("div");
|
|
205
|
-
const ph = new Photo(p, c);
|
|
206
|
-
ph.getPosition = () => ({ yaw: 0.7853981634, pitch: -1.2217304764 });
|
|
207
|
-
ph.getZoomLevel = () => 15;
|
|
208
|
-
expect(ph.getXYZ()).toEqual({ x: 45.0000000001462, y: -70.00000000022743, z: 15 });
|
|
209
|
-
});
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
describe("getPictureRelativeHeading", () => {
|
|
213
|
-
const p = createParent();
|
|
214
|
-
const c = document.createElement("div");
|
|
215
|
-
const ph = new Photo(p, c);
|
|
216
|
-
|
|
217
|
-
it("works with original 180, road 0", () => {
|
|
218
|
-
ph.getPictureOriginalHeading = () => 180;
|
|
219
|
-
ph.getRoadAbsoluteHeading = () => 0;
|
|
220
|
-
expect(ph.getPictureRelativeHeading()).toEqual(180);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it("works with original 0, road 180", () => {
|
|
224
|
-
ph.getPictureOriginalHeading = () => 180;
|
|
225
|
-
ph.getRoadAbsoluteHeading = () => 0;
|
|
226
|
-
expect(ph.getPictureRelativeHeading()).toEqual(180);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
it("works with original 90, road 180", () => {
|
|
230
|
-
ph.getPictureOriginalHeading = () => 90;
|
|
231
|
-
ph.getRoadAbsoluteHeading = () => 180;
|
|
232
|
-
expect(ph.getPictureRelativeHeading()).toEqual(-90);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
it("works with original 270, road 135", () => {
|
|
236
|
-
ph.getPictureOriginalHeading = () => 270;
|
|
237
|
-
ph.getRoadAbsoluteHeading = () => 135;
|
|
238
|
-
expect(ph.getPictureRelativeHeading()).toEqual(135);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it("works with original 135, road 270", () => {
|
|
242
|
-
ph.getPictureOriginalHeading = () => 135;
|
|
243
|
-
ph.getRoadAbsoluteHeading = () => 270;
|
|
244
|
-
expect(ph.getPictureRelativeHeading()).toEqual(-135);
|
|
245
|
-
});
|
|
246
|
-
|
|
247
|
-
it("works with original 359, road 1", () => {
|
|
248
|
-
ph.getPictureOriginalHeading = () => 359;
|
|
249
|
-
ph.getRoadAbsoluteHeading = () => 1;
|
|
250
|
-
expect(ph.getPictureRelativeHeading()).toEqual(-2);
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
it("works with original 1, road 359", () => {
|
|
254
|
-
ph.getPictureOriginalHeading = () => 1;
|
|
255
|
-
ph.getRoadAbsoluteHeading = () => 359;
|
|
256
|
-
expect(ph.getPictureRelativeHeading()).toEqual(2);
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
it("stays within expected range", () => {
|
|
260
|
-
for(let po = 0; po <= 360; po++) {
|
|
261
|
-
for(let ra = 0; ra <= 360; ra++) {
|
|
262
|
-
ph.getPictureOriginalHeading = () => po;
|
|
263
|
-
ph.getRoadAbsoluteHeading = () => ra;
|
|
264
|
-
const rel = ph.getPictureRelativeHeading();
|
|
265
|
-
expect(rel).toBeGreaterThanOrEqual(-180);
|
|
266
|
-
expect(rel).toBeLessThanOrEqual(180);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
})
|
|
270
|
-
});
|
|
271
|
-
|
|
272
|
-
describe("clearPictureMetadataCache", () => {
|
|
273
|
-
it("works when no pic is selected", async () => {
|
|
274
|
-
const p = createParent();
|
|
275
|
-
const c = document.createElement("div");
|
|
276
|
-
const ph = new Photo(p, c);
|
|
277
|
-
await ph.clearPictureMetadataCache();
|
|
278
|
-
expect(ph._myVTour.state.currentNode).toBeNull();
|
|
279
|
-
expect(ph._myVTour.state.datasource.nodes).toStrictEqual({});
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
it("works when a pic is selected", async () => {
|
|
283
|
-
const p = createParent();
|
|
284
|
-
const c = document.createElement("div");
|
|
285
|
-
const ph = new Photo(p, c);
|
|
286
|
-
ph._myVTour.state.currentNode = { id: "pic", sequence: { id: "seq" } };
|
|
287
|
-
await ph.clearPictureMetadataCache();
|
|
288
|
-
expect(p.select.mock.calls).toMatchSnapshot();
|
|
289
|
-
});
|
|
290
|
-
});
|
|
291
|
-
|
|
292
|
-
describe("setXYZ", () => {
|
|
293
|
-
it("works", () => {
|
|
294
|
-
const p = createParent();
|
|
295
|
-
const c = document.createElement("div");
|
|
296
|
-
const ph = new Photo(p, c);
|
|
297
|
-
ph.rotate = jest.fn();
|
|
298
|
-
ph.zoom = jest.fn();
|
|
299
|
-
ph.setXYZ(45, -45, 3);
|
|
300
|
-
expect(ph.zoom.mock.calls).toEqual([[3]]);
|
|
301
|
-
expect(ph.rotate.mock.calls).toEqual([[{ yaw: 0.7853981633974483, pitch: -0.7853981633974483 }]]);
|
|
302
|
-
});
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
describe("setHigherContrast", () => {
|
|
306
|
-
it("works on enable", () => {
|
|
307
|
-
const p = createParent();
|
|
308
|
-
const c = document.createElement("div");
|
|
309
|
-
const ph = new Photo(p, c);
|
|
310
|
-
ph.needsUpdate = jest.fn();
|
|
311
|
-
ph.setHigherContrast(true);
|
|
312
|
-
expect(ph.renderer.renderer.toneMapping).toBe(3);
|
|
313
|
-
expect(ph.renderer.renderer.toneMappingExposure).toBe(2);
|
|
314
|
-
expect(ph.needsUpdate.mock.calls.length).toBe(1);
|
|
315
|
-
});
|
|
316
|
-
|
|
317
|
-
it("works on disable", () => {
|
|
318
|
-
const p = createParent();
|
|
319
|
-
const c = document.createElement("div");
|
|
320
|
-
const ph = new Photo(p, c);
|
|
321
|
-
ph.needsUpdate = jest.fn();
|
|
322
|
-
ph.setHigherContrast(false);
|
|
323
|
-
expect(ph.renderer.renderer.toneMapping).toBe(0);
|
|
324
|
-
expect(ph.renderer.renderer.toneMappingExposure).toBe(1);
|
|
325
|
-
expect(ph.needsUpdate.mock.calls.length).toBe(1);
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
describe("getTransitionDuration", () => {
|
|
330
|
-
it("works", () => {
|
|
331
|
-
const p = createParent();
|
|
332
|
-
const c = document.createElement("div");
|
|
333
|
-
const ph = new Photo(p, c, { transitionDuration: 42 });
|
|
334
|
-
expect(ph.getTransitionDuration()).toBe(42);
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
describe("setTransitionDuration", () => {
|
|
339
|
-
it("works", () => {
|
|
340
|
-
const p = createParent();
|
|
341
|
-
const c = document.createElement("div");
|
|
342
|
-
const ph = new Photo(p, c);
|
|
343
|
-
ph.setTransitionDuration(1024);
|
|
344
|
-
expect(ph.getTransitionDuration()).toBe(1024);
|
|
345
|
-
expect(p.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
it("fails when value is invalid", () => {
|
|
349
|
-
const p = createParent();
|
|
350
|
-
const c = document.createElement("div");
|
|
351
|
-
const ph = new Photo(p, c);
|
|
352
|
-
expect(() => ph.setTransitionDuration(-1)).toThrowError("Invalid transition duration (should be between 100 and 3000)");
|
|
353
|
-
expect(() => ph.setTransitionDuration(3001)).toThrowError("Invalid transition duration (should be between 100 and 3000)");
|
|
354
|
-
});
|
|
355
|
-
});
|
|
356
|
-
|
|
357
|
-
describe("playSequence", () => {
|
|
358
|
-
it("sends event", () => {
|
|
359
|
-
const p = createParent();
|
|
360
|
-
const c = document.createElement("div");
|
|
361
|
-
const ph = new Photo(p, c);
|
|
362
|
-
return new Promise(resolve => {
|
|
363
|
-
ph.addEventListener("sequence-playing", resolve);
|
|
364
|
-
ph.playSequence();
|
|
365
|
-
});
|
|
366
|
-
});
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
describe("stopSequence", () => {
|
|
370
|
-
it("sends event", async () => {
|
|
371
|
-
const p = createParent();
|
|
372
|
-
const c = document.createElement("div");
|
|
373
|
-
const ph = new Photo(p, c);
|
|
374
|
-
return new Promise(resolve => {
|
|
375
|
-
ph.addEventListener("sequence-stopped", resolve);
|
|
376
|
-
ph.stopSequence();
|
|
377
|
-
});
|
|
378
|
-
});
|
|
379
|
-
});
|
|
380
|
-
|
|
381
|
-
describe("isSequencePlaying", () => {
|
|
382
|
-
it("is true when sequence is playing", () => {
|
|
383
|
-
const p = createParent();
|
|
384
|
-
const c = document.createElement("div");
|
|
385
|
-
const ph = new Photo(p, c);
|
|
386
|
-
ph.goToNextPicture = jest.fn();
|
|
387
|
-
ph.playSequence();
|
|
388
|
-
expect(ph.isSequencePlaying()).toBe(true);
|
|
389
|
-
});
|
|
390
|
-
|
|
391
|
-
it("is false when sequence never played", () => {
|
|
392
|
-
const p = createParent();
|
|
393
|
-
const c = document.createElement("div");
|
|
394
|
-
const ph = new Photo(p, c);
|
|
395
|
-
expect(ph.isSequencePlaying()).toBe(false);
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
it("is false when sequence stopped", () => {
|
|
399
|
-
const p = createParent();
|
|
400
|
-
const c = document.createElement("div");
|
|
401
|
-
const ph = new Photo(p, c);
|
|
402
|
-
ph.playSequence();
|
|
403
|
-
ph.stopSequence();
|
|
404
|
-
expect(ph.isSequencePlaying()).toBe(false);
|
|
405
|
-
});
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
describe("getPicturesNavigation", () => {
|
|
409
|
-
it("works", () => {
|
|
410
|
-
const p = createParent();
|
|
411
|
-
const c = document.createElement("div");
|
|
412
|
-
const ph = new Photo(p, c, {picturesNavigation: "pic"});
|
|
413
|
-
expect(ph.getPicturesNavigation()).toBe("pic");
|
|
414
|
-
ph._picturesNavigation = "seq";
|
|
415
|
-
expect(ph.getPicturesNavigation()).toBe("seq");
|
|
416
|
-
});
|
|
417
|
-
});
|
|
418
|
-
|
|
419
|
-
describe("setPicturesNavigation", () => {
|
|
420
|
-
it("works", () => {
|
|
421
|
-
const p = createParent();
|
|
422
|
-
const c = document.createElement("div");
|
|
423
|
-
const ph = new Photo(p, c);
|
|
424
|
-
const eventWatcher = jest.fn();
|
|
425
|
-
ph.addEventListener("pictures-navigation-changed", eventWatcher);
|
|
426
|
-
expect(ph.getPicturesNavigation()).toBe("any");
|
|
427
|
-
ph.setPicturesNavigation("pic");
|
|
428
|
-
expect(ph.getPicturesNavigation()).toBe("pic");
|
|
429
|
-
ph.setPicturesNavigation("seq");
|
|
430
|
-
expect(ph.getPicturesNavigation()).toBe("seq");
|
|
431
|
-
ph.setPicturesNavigation("any");
|
|
432
|
-
expect(ph.getPicturesNavigation()).toBe("any");
|
|
433
|
-
ph.setPicturesNavigation("none");
|
|
434
|
-
expect(ph.getPicturesNavigation()).toBe("pic");
|
|
435
|
-
expect(eventWatcher.mock.calls).toMatchSnapshot();
|
|
436
|
-
});
|
|
437
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import Popup from "../../../src/components/ui/Popup";
|
|
2
|
-
|
|
3
|
-
describe("constructor", () => {
|
|
4
|
-
it("works", () => {
|
|
5
|
-
document.addEventListener = jest.fn();
|
|
6
|
-
const p = new Popup();
|
|
7
|
-
p.addEventListener = jest.fn();
|
|
8
|
-
expect(p.visible).toBe(false);
|
|
9
|
-
|
|
10
|
-
p.connectedCallback();
|
|
11
|
-
expect(p.addEventListener.mock.calls).toMatchSnapshot();
|
|
12
|
-
expect(document.addEventListener.mock.calls).toMatchSnapshot();
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
describe("close", () => {
|
|
17
|
-
it("works", () => {
|
|
18
|
-
const p = new Popup();
|
|
19
|
-
p.dispatchEvent = jest.fn();
|
|
20
|
-
p.visible = true;
|
|
21
|
-
p.close();
|
|
22
|
-
|
|
23
|
-
expect(p.visible).toBe(false);
|
|
24
|
-
expect(p.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
25
|
-
});
|
|
26
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import QualityScore from "../../../src/components/ui/QualityScore";
|
|
2
|
-
|
|
3
|
-
describe("_onInput", () => {
|
|
4
|
-
it("works", () => {
|
|
5
|
-
const qs = new QualityScore();
|
|
6
|
-
qs.dispatchEvent = jest.fn();
|
|
7
|
-
qs.renderRoot.querySelectorAll.mockReturnValueOnce([
|
|
8
|
-
{ value: 5, checked: false },
|
|
9
|
-
{ value: 4, checked: true },
|
|
10
|
-
{ value: 3, checked: false },
|
|
11
|
-
{ value: 2, checked: true },
|
|
12
|
-
{ value: 1, checked: false },
|
|
13
|
-
])
|
|
14
|
-
qs._onInput();
|
|
15
|
-
expect(qs.grade).toEqual("4,2");
|
|
16
|
-
expect(qs.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
17
|
-
});
|
|
18
|
-
});
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import SearchBar from "../../../src/components/ui/SearchBar";
|
|
2
|
-
|
|
3
|
-
describe("_onIconClick", () => {
|
|
4
|
-
it("resets on error", () => {
|
|
5
|
-
const sb = new SearchBar();
|
|
6
|
-
sb.reset = jest.fn();
|
|
7
|
-
sb._icon = "warn";
|
|
8
|
-
sb._onIconClick();
|
|
9
|
-
expect(sb.reset.mock.calls).toMatchSnapshot();
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it("resets on clear", () => {
|
|
13
|
-
const sb = new SearchBar();
|
|
14
|
-
sb.reset = jest.fn();
|
|
15
|
-
sb._icon = "empty";
|
|
16
|
-
sb._onIconClick();
|
|
17
|
-
expect(sb.reset.mock.calls).toMatchSnapshot();
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it("reduces if reduceable & extended", () => {
|
|
21
|
-
const sb = new SearchBar();
|
|
22
|
-
sb.reduceable = true;
|
|
23
|
-
sb.reduced = false;
|
|
24
|
-
sb._onIconClick();
|
|
25
|
-
expect(sb.reduced).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it("expands if reduceable & reduced", () => {
|
|
29
|
-
const sb = new SearchBar();
|
|
30
|
-
sb.reduceable = true;
|
|
31
|
-
sb.reduced = true;
|
|
32
|
-
sb._onIconClick();
|
|
33
|
-
expect(sb.reduced).toBe(false);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
describe("_onResultClick", () => {
|
|
38
|
-
it("works on classic", () => {
|
|
39
|
-
const sb = new SearchBar();
|
|
40
|
-
sb.dispatchEvent = jest.fn();
|
|
41
|
-
sb._onResultClick({title: "res1", subtitle: "sub1", data: "coucou"});
|
|
42
|
-
expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
43
|
-
expect(sb.value).toEqual("res1");
|
|
44
|
-
expect(sb._icon).toEqual("empty");
|
|
45
|
-
expect(sb._results).toBe(null);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it("works on reduced", () => {
|
|
49
|
-
const sb = new SearchBar();
|
|
50
|
-
sb.dispatchEvent = jest.fn();
|
|
51
|
-
sb.reduceable = true;
|
|
52
|
-
sb._onResultClick({title: "res1", subtitle: "sub1", data: "coucou"});
|
|
53
|
-
expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
54
|
-
expect(sb.value).toEqual("");
|
|
55
|
-
expect(sb._icon).toEqual("search");
|
|
56
|
-
expect(sb._results).toBe(null);
|
|
57
|
-
expect(sb.reduced).toBe(true);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it("resets on null value", () => {
|
|
61
|
-
const sb = new SearchBar();
|
|
62
|
-
sb.dispatchEvent = jest.fn();
|
|
63
|
-
sb._onResultClick(null);
|
|
64
|
-
expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
65
|
-
expect(sb.value).toEqual("");
|
|
66
|
-
expect(sb._icon).toEqual("search");
|
|
67
|
-
expect(sb._results).toBe(null);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe("_search", () => {
|
|
72
|
-
it("skips if value is empty", () => {
|
|
73
|
-
const sb = new SearchBar();
|
|
74
|
-
sb.reset = jest.fn();
|
|
75
|
-
sb._search();
|
|
76
|
-
expect(sb.reset.mock.calls).toMatchSnapshot();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
it("skips if no searcher fct", () => {
|
|
80
|
-
global.console = { warn: jest.fn() };
|
|
81
|
-
|
|
82
|
-
const sb = new SearchBar();
|
|
83
|
-
sb.value = "test";
|
|
84
|
-
sb._search();
|
|
85
|
-
expect(global.console.warn.mock.calls).toMatchSnapshot();
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it("works with actual data", () => {
|
|
89
|
-
const sb = new SearchBar();
|
|
90
|
-
return new Promise(resolve => {
|
|
91
|
-
sb.searcher = value => {
|
|
92
|
-
expect(value).toEqual("my search");
|
|
93
|
-
expect(sb._icon).toEqual("loading");
|
|
94
|
-
expect(sb._results).toBe(null);
|
|
95
|
-
resolve();
|
|
96
|
-
};
|
|
97
|
-
sb.value = "my search";
|
|
98
|
-
sb._search();
|
|
99
|
-
});
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
describe("reset", () => {
|
|
104
|
-
it("works", () => {
|
|
105
|
-
const sb = new SearchBar();
|
|
106
|
-
sb._onResultClick = jest.fn();
|
|
107
|
-
sb.reset();
|
|
108
|
-
expect(sb._onResultClick.mock.calls).toMatchSnapshot();
|
|
109
|
-
});
|
|
110
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`_onClick works with input 1`] = `
|
|
4
|
-
Array [
|
|
5
|
-
Array [
|
|
6
|
-
"copy me from input",
|
|
7
|
-
],
|
|
8
|
-
]
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
exports[`_onClick works with text 1`] = `
|
|
12
|
-
Array [
|
|
13
|
-
Array [
|
|
14
|
-
"I am a copy text",
|
|
15
|
-
],
|
|
16
|
-
]
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
exports[`_onClick works with textarea 1`] = `
|
|
20
|
-
Array [
|
|
21
|
-
Array [
|
|
22
|
-
"copy me from textarea",
|
|
23
|
-
],
|
|
24
|
-
]
|
|
25
|
-
`;
|
|
26
|
-
|
|
27
|
-
exports[`constructor listens to click 1`] = `
|
|
28
|
-
Object {
|
|
29
|
-
"click": Array [
|
|
30
|
-
[Function],
|
|
31
|
-
],
|
|
32
|
-
}
|
|
33
|
-
`;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`dismiss works on success + next fct 1`] = `
|
|
4
|
-
Array [
|
|
5
|
-
Array [
|
|
6
|
-
CustomEvent {
|
|
7
|
-
"isTrusted": false,
|
|
8
|
-
},
|
|
9
|
-
],
|
|
10
|
-
]
|
|
11
|
-
`;
|
|
12
|
-
|
|
13
|
-
exports[`dismiss works on success + next fct 2`] = `
|
|
14
|
-
Array [
|
|
15
|
-
Array [],
|
|
16
|
-
]
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
exports[`dismiss works on success 1`] = `
|
|
20
|
-
Array [
|
|
21
|
-
Array [
|
|
22
|
-
CustomEvent {
|
|
23
|
-
"isTrusted": false,
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
]
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
exports[`dismiss works with error + next fct 1`] = `
|
|
30
|
-
Array [
|
|
31
|
-
Array [
|
|
32
|
-
CustomEvent {
|
|
33
|
-
"isTrusted": false,
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
]
|
|
37
|
-
`;
|
|
38
|
-
|
|
39
|
-
exports[`dismiss works with error + next fct 2`] = `
|
|
40
|
-
Array [
|
|
41
|
-
Array [
|
|
42
|
-
"click",
|
|
43
|
-
[MockFunction],
|
|
44
|
-
],
|
|
45
|
-
]
|
|
46
|
-
`;
|
|
47
|
-
|
|
48
|
-
exports[`dismiss works with error 1`] = `
|
|
49
|
-
Array [
|
|
50
|
-
Array [
|
|
51
|
-
CustomEvent {
|
|
52
|
-
"isTrusted": false,
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
]
|
|
56
|
-
`;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`reloadVectorTiles works 1`] = `
|
|
4
|
-
Array [
|
|
5
|
-
Array [
|
|
6
|
-
Array [
|
|
7
|
-
"https://bla.xyz/geovisio/x/y/z",
|
|
8
|
-
],
|
|
9
|
-
],
|
|
10
|
-
Array [
|
|
11
|
-
Array [
|
|
12
|
-
"https://bla.xyz/geovisio_toto/x/y/z",
|
|
13
|
-
],
|
|
14
|
-
],
|
|
15
|
-
]
|
|
16
|
-
`;
|