@panoramax/web-viewer 3.2.3-develop-d7e5a16d → 3.2.3-develop-f9c0224b
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/.gitlab-ci.yml +5 -0
- package/CHANGELOG.md +19 -0
- package/CODE_OF_CONDUCT.md +1 -1
- package/README.md +1 -1
- package/build/editor.html +10 -1
- package/build/index.css +2 -2
- package/build/index.css.map +1 -1
- package/build/index.html +1 -1
- package/build/index.js +1682 -5
- package/build/index.js.map +1 -1
- package/build/map.html +1 -1
- package/build/viewer.html +10 -1
- package/build/widgets.html +1 -0
- package/config/jest/mocks.js +172 -0
- package/config/paths.js +1 -0
- package/config/webpack.config.js +26 -0
- package/docs/03_URL_settings.md +3 -11
- package/docs/05_Compatibility.md +59 -76
- package/docs/09_Develop.md +30 -11
- package/docs/90_Releases.md +2 -2
- package/docs/images/class_diagram.drawio +28 -28
- package/docs/images/class_diagram.jpg +0 -0
- package/docs/index.md +112 -0
- package/docs/reference/components/core/Basic.md +153 -0
- package/docs/reference/components/core/CoverageMap.md +160 -0
- package/docs/reference/components/core/Editor.md +172 -0
- package/docs/reference/components/core/Viewer.md +288 -0
- package/docs/reference/components/layout/CorneredGrid.md +29 -0
- package/docs/reference/components/layout/Mini.md +45 -0
- package/docs/reference/components/menus/MapBackground.md +32 -0
- package/docs/reference/components/menus/MapFilters.md +15 -0
- package/docs/reference/components/menus/MapLayers.md +15 -0
- package/docs/reference/components/menus/MapLegend.md +15 -0
- package/docs/reference/components/menus/PictureLegend.md +15 -0
- package/docs/reference/components/menus/PictureMetadata.md +15 -0
- package/docs/reference/components/menus/PlayerOptions.md +15 -0
- package/docs/reference/components/menus/QualityScoreDoc.md +15 -0
- package/docs/reference/components/menus/ReportForm.md +15 -0
- package/docs/reference/components/menus/ShareMenu.md +15 -0
- package/docs/reference/components/ui/Button.md +39 -0
- package/docs/reference/components/ui/ButtonGroup.md +36 -0
- package/docs/reference/components/ui/CopyButton.md +35 -0
- package/docs/reference/components/ui/Grade.md +32 -0
- package/docs/reference/components/ui/LinkButton.md +44 -0
- package/docs/reference/components/ui/Loader.md +54 -0
- package/docs/reference/components/ui/Map.md +214 -0
- package/docs/reference/components/ui/MapMore.md +233 -0
- package/docs/reference/components/ui/Photo.md +369 -0
- package/docs/reference/components/ui/Popup.md +56 -0
- package/docs/reference/components/ui/QualityScore.md +45 -0
- package/docs/reference/components/ui/SearchBar.md +63 -0
- package/docs/reference/components/ui/TogglableGroup.md +39 -0
- package/docs/reference/components/ui/widgets/GeoSearch.md +32 -0
- package/docs/reference/components/ui/widgets/Legend.md +32 -0
- package/docs/reference/components/ui/widgets/MapFiltersButton.md +33 -0
- package/docs/reference/components/ui/widgets/MapLayersButton.md +15 -0
- package/docs/reference/components/ui/widgets/Player.md +32 -0
- package/docs/reference/components/ui/widgets/Share.md +15 -0
- package/docs/reference/components/ui/widgets/Zoom.md +15 -0
- package/docs/reference/utils/API.md +311 -0
- package/docs/reference/utils/InitParameters.md +67 -0
- package/docs/reference/utils/URLHandler.md +102 -0
- package/docs/reference.md +73 -0
- package/docs/shortcuts.md +11 -0
- package/docs/tutorials/aerial_imagery.md +19 -0
- package/docs/tutorials/authentication.md +10 -0
- package/docs/tutorials/custom_widgets.md +64 -0
- package/docs/tutorials/map_style.md +27 -0
- package/docs/tutorials/migrate_v4.md +122 -0
- package/docs/tutorials/synced_coverage.md +42 -0
- package/mkdocs.yml +60 -5
- package/package.json +10 -7
- package/public/editor.html +21 -29
- package/public/index.html +3 -3
- package/public/map.html +19 -18
- package/public/viewer.html +18 -24
- package/public/widgets.html +265 -0
- package/scripts/doc.js +77 -0
- package/src/components/core/Basic.css +44 -0
- package/src/components/core/Basic.js +258 -0
- package/src/components/core/CoverageMap.css +9 -0
- package/src/components/core/CoverageMap.js +105 -0
- package/src/components/core/Editor.css +23 -0
- package/src/components/core/Editor.js +354 -0
- package/src/components/core/Viewer.css +109 -0
- package/src/components/core/Viewer.js +707 -0
- package/src/components/core/index.js +11 -0
- package/src/components/index.js +13 -0
- package/src/components/layout/CorneredGrid.js +109 -0
- package/src/components/layout/Mini.js +117 -0
- package/src/components/layout/index.js +7 -0
- package/src/components/menus/MapBackground.js +106 -0
- package/src/components/menus/MapFilters.js +386 -0
- package/src/components/menus/MapLayers.js +143 -0
- package/src/components/menus/MapLegend.js +54 -0
- package/src/components/menus/PictureLegend.js +103 -0
- package/src/components/menus/PictureMetadata.js +188 -0
- package/src/components/menus/PlayerOptions.js +96 -0
- package/src/components/menus/QualityScoreDoc.js +36 -0
- package/src/components/menus/ReportForm.js +133 -0
- package/src/components/menus/Share.js +228 -0
- package/src/components/menus/index.js +15 -0
- package/src/components/styles.js +365 -0
- package/src/components/ui/Button.js +75 -0
- package/src/components/ui/ButtonGroup.css +49 -0
- package/src/components/ui/ButtonGroup.js +68 -0
- package/src/components/ui/CopyButton.js +71 -0
- package/src/components/ui/Grade.js +54 -0
- package/src/components/ui/LinkButton.js +68 -0
- package/src/components/ui/Loader.js +188 -0
- package/src/components/{Map.css → ui/Map.css} +5 -17
- package/src/components/{Map.js → ui/Map.js} +114 -138
- package/src/components/ui/MapMore.js +324 -0
- package/src/components/{Photo.css → ui/Photo.css} +6 -6
- package/src/components/{Photo.js → ui/Photo.js} +279 -90
- package/src/components/ui/Popup.js +145 -0
- package/src/components/ui/QualityScore.js +152 -0
- package/src/components/ui/SearchBar.js +363 -0
- package/src/components/ui/TogglableGroup.js +162 -0
- package/src/components/ui/index.js +20 -0
- package/src/components/ui/widgets/GeoSearch.css +21 -0
- package/src/components/ui/widgets/GeoSearch.js +139 -0
- package/src/components/ui/widgets/Legend.js +51 -0
- package/src/components/ui/widgets/MapFiltersButton.js +104 -0
- package/src/components/ui/widgets/MapLayersButton.js +79 -0
- package/src/components/ui/widgets/Player.css +7 -0
- package/src/components/ui/widgets/Player.js +148 -0
- package/src/components/ui/widgets/Share.js +30 -0
- package/src/components/ui/widgets/Zoom.js +82 -0
- package/src/components/ui/widgets/index.js +12 -0
- package/src/img/panoramax.svg +13 -0
- package/src/img/switch_big.svg +20 -10
- package/src/index.js +6 -9
- package/src/translations/da.json +1 -1
- package/src/translations/de.json +1 -1
- package/src/translations/en.json +5 -3
- package/src/translations/eo.json +1 -1
- package/src/translations/es.json +1 -1
- package/src/translations/fr.json +5 -3
- package/src/translations/hu.json +1 -1
- package/src/translations/it.json +1 -1
- package/src/translations/ja.json +1 -1
- package/src/translations/nl.json +1 -1
- package/src/translations/pl.json +1 -1
- package/src/translations/sv.json +1 -1
- package/src/translations/zh_Hant.json +1 -1
- package/src/utils/API.js +74 -42
- package/src/utils/InitParameters.js +354 -0
- package/src/utils/URLHandler.js +364 -0
- package/src/utils/geocoder.js +116 -0
- package/src/utils/{I18n.js → i18n.js} +3 -1
- package/src/utils/index.js +11 -0
- package/src/utils/{Map.js → map.js} +216 -80
- package/src/utils/picture.js +433 -0
- package/src/utils/utils.js +315 -0
- package/src/utils/widgets.js +93 -0
- package/tests/components/ui/CopyButton.test.js +52 -0
- package/tests/components/ui/Loader.test.js +54 -0
- package/tests/components/{Map.test.js → ui/Map.test.js} +19 -61
- package/tests/components/{Photo.test.js → ui/Photo.test.js} +89 -57
- package/tests/components/ui/Popup.test.js +24 -0
- package/tests/components/ui/QualityScore.test.js +17 -0
- package/tests/components/ui/SearchBar.test.js +107 -0
- package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +34 -0
- package/tests/components/ui/__snapshots__/Loader.test.js.snap +56 -0
- package/tests/components/{__snapshots__ → ui/__snapshots__}/Map.test.js.snap +11 -38
- package/tests/components/{__snapshots__ → ui/__snapshots__}/Photo.test.js.snap +57 -4
- package/tests/components/ui/__snapshots__/Popup.test.js.snap +29 -0
- package/tests/components/ui/__snapshots__/QualityScore.test.js.snap +11 -0
- package/tests/components/ui/__snapshots__/SearchBar.test.js.snap +65 -0
- package/tests/utils/API.test.js +1 -14
- package/tests/utils/InitParameters.test.js +485 -0
- package/tests/utils/URLHandler.test.js +350 -0
- package/tests/utils/__snapshots__/URLHandler.test.js.snap +21 -0
- package/tests/utils/__snapshots__/picture.test.js.snap +315 -0
- package/tests/utils/__snapshots__/widgets.test.js.snap +19 -0
- package/tests/utils/geocoder.test.js +37 -0
- package/tests/utils/{I18n.test.js → i18n.test.js} +1 -1
- package/tests/utils/map.test.js +67 -0
- package/tests/utils/picture.test.js +745 -0
- package/tests/utils/utils.test.js +288 -0
- package/tests/utils/widgets.test.js +90 -0
- package/docs/01_Start.md +0 -149
- package/docs/02_Usage.md +0 -831
- package/docs/04_Advanced_examples.md +0 -216
- package/src/Editor.css +0 -37
- package/src/Editor.js +0 -361
- package/src/StandaloneMap.js +0 -114
- package/src/Viewer.css +0 -203
- package/src/Viewer.js +0 -1246
- package/src/components/CoreView.css +0 -70
- package/src/components/CoreView.js +0 -175
- package/src/components/Loader.css +0 -74
- package/src/components/Loader.js +0 -120
- package/src/utils/Exif.js +0 -193
- package/src/utils/Utils.js +0 -631
- package/src/utils/Widgets.js +0 -562
- package/src/viewer/URLHash.js +0 -469
- package/src/viewer/Widgets.css +0 -880
- package/src/viewer/Widgets.js +0 -1470
- package/tests/Editor.test.js +0 -126
- package/tests/StandaloneMap.test.js +0 -45
- package/tests/Viewer.test.js +0 -366
- package/tests/__snapshots__/Editor.test.js.snap +0 -298
- package/tests/__snapshots__/StandaloneMap.test.js.snap +0 -30
- package/tests/__snapshots__/Viewer.test.js.snap +0 -195
- package/tests/components/CoreView.test.js +0 -92
- package/tests/components/Loader.test.js +0 -38
- package/tests/components/__snapshots__/Loader.test.js.snap +0 -15
- package/tests/utils/Exif.test.js +0 -124
- package/tests/utils/Map.test.js +0 -113
- package/tests/utils/Utils.test.js +0 -300
- package/tests/utils/Widgets.test.js +0 -107
- package/tests/utils/__snapshots__/Exif.test.js.snap +0 -43
- package/tests/utils/__snapshots__/Utils.test.js.snap +0 -41
- package/tests/utils/__snapshots__/Widgets.test.js.snap +0 -44
- package/tests/viewer/URLHash.test.js +0 -559
- package/tests/viewer/Widgets.test.js +0 -127
- package/tests/viewer/__snapshots__/URLHash.test.js.snap +0 -108
- package/tests/viewer/__snapshots__/Widgets.test.js.snap +0 -403
- /package/tests/utils/__snapshots__/{Map.test.js.snap → geocoder.test.js.snap} +0 -0
|
@@ -1,62 +1,14 @@
|
|
|
1
|
-
import Photo from "
|
|
1
|
+
import Photo from "../../../src/components/ui/Photo";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
4
|
|
|
5
|
-
jest.mock("@photo-sphere-viewer/core", () => ({
|
|
6
|
-
Viewer: class {
|
|
7
|
-
constructor(opts) {
|
|
8
|
-
this._psvOpts = opts;
|
|
9
|
-
this.loader = {
|
|
10
|
-
canvas: { setAttribute: jest.fn() },
|
|
11
|
-
__updateContent: jest.fn(),
|
|
12
|
-
show: jest.fn(),
|
|
13
|
-
};
|
|
14
|
-
this.renderer = {
|
|
15
|
-
renderer: {
|
|
16
|
-
toneMapping: null,
|
|
17
|
-
toneMappingExposure: null,
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
addEventListener() {;}
|
|
22
|
-
getPlugin() {
|
|
23
|
-
return {
|
|
24
|
-
addEventListener: jest.fn(),
|
|
25
|
-
datasource: {
|
|
26
|
-
nodeResolver: jest.fn(),
|
|
27
|
-
},
|
|
28
|
-
arrowsRenderer: {
|
|
29
|
-
clear: jest.fn(),
|
|
30
|
-
},
|
|
31
|
-
state: {
|
|
32
|
-
currentNode: null,
|
|
33
|
-
datasource: { nodes: {} },
|
|
34
|
-
},
|
|
35
|
-
config: {
|
|
36
|
-
transitionOptions: jest.fn(),
|
|
37
|
-
},
|
|
38
|
-
__onEnterObject: jest.fn(),
|
|
39
|
-
__onLeaveObject: jest.fn(),
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
jest.mock("@photo-sphere-viewer/equirectangular-tiles-adapter", () => ({
|
|
46
|
-
EquirectangularTilesAdapter: jest.fn(),
|
|
47
|
-
}));
|
|
48
|
-
|
|
49
|
-
jest.mock("@photo-sphere-viewer/virtual-tour-plugin", () => ({
|
|
50
|
-
VirtualTourPlugin: jest.fn(),
|
|
51
|
-
}));
|
|
52
|
-
|
|
53
5
|
const createParent = () => ({
|
|
54
6
|
addEventListener: jest.fn(),
|
|
55
7
|
dispatchEvent: jest.fn(),
|
|
56
8
|
isWidthSmall: jest.fn(),
|
|
57
9
|
select: jest.fn(),
|
|
58
|
-
_t: {
|
|
59
|
-
|
|
10
|
+
_t: { pnx: {} },
|
|
11
|
+
api: {
|
|
60
12
|
_getFetchOptions: jest.fn(),
|
|
61
13
|
getPictureMetadataUrl: (picId, seqId) => `https://geovisio.fr/api/collections/${seqId}/items/${picId}`
|
|
62
14
|
},
|
|
@@ -68,7 +20,7 @@ describe("constructor", () => {
|
|
|
68
20
|
const p = createParent();
|
|
69
21
|
const c = document.createElement("div");
|
|
70
22
|
const ph = new Photo(p, c);
|
|
71
|
-
expect(c.className).toBe("
|
|
23
|
+
expect(c.className).toBe("pnx-psv");
|
|
72
24
|
});
|
|
73
25
|
});
|
|
74
26
|
|
|
@@ -84,7 +36,7 @@ describe("_getNodeFromAPI", () => {
|
|
|
84
36
|
global.fetch = jest.fn(() =>
|
|
85
37
|
Promise.resolve({
|
|
86
38
|
ok: true,
|
|
87
|
-
json: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "data", "Viewer_pictures_1.json")))),
|
|
39
|
+
json: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "data", "Viewer_pictures_1.json")))),
|
|
88
40
|
})
|
|
89
41
|
);
|
|
90
42
|
global.Date = jest.fn(() => ({ toLocaleDateString: () => "June 3 2022" }));
|
|
@@ -100,7 +52,7 @@ describe("_getNodeFromAPI", () => {
|
|
|
100
52
|
global.fetch = jest.fn(() =>
|
|
101
53
|
Promise.resolve({
|
|
102
54
|
ok: true,
|
|
103
|
-
json: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "data", "Viewer_pictures_1.json")))),
|
|
55
|
+
json: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "data", "Viewer_pictures_1.json")))),
|
|
104
56
|
})
|
|
105
57
|
);
|
|
106
58
|
global.Date = jest.fn(() => ({ toLocaleDateString: () => "June 3 2022" }));
|
|
@@ -205,8 +157,8 @@ describe("goToPosition", () => {
|
|
|
205
157
|
const p = createParent();
|
|
206
158
|
const c = document.createElement("div");
|
|
207
159
|
const ph = new Photo(p, c);
|
|
208
|
-
p.
|
|
209
|
-
getPicturesAroundCoordinates: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "data", "Viewer_pictures_1.json")))),
|
|
160
|
+
p.api = {
|
|
161
|
+
getPicturesAroundCoordinates: () => Promise.resolve(JSON.parse(fs.readFileSync(path.join(__dirname, "..", "..", "data", "Viewer_pictures_1.json")))),
|
|
210
162
|
_getFetchOptions: jest.fn()
|
|
211
163
|
};
|
|
212
164
|
|
|
@@ -220,7 +172,7 @@ describe("goToPosition", () => {
|
|
|
220
172
|
const p = createParent();
|
|
221
173
|
const c = document.createElement("div");
|
|
222
174
|
const ph = new Photo(p, c);
|
|
223
|
-
p.
|
|
175
|
+
p.api = {
|
|
224
176
|
getPicturesAroundCoordinates: () => Promise.resolve({ "features": [] }),
|
|
225
177
|
_getFetchOptions: jest.fn()
|
|
226
178
|
};
|
|
@@ -333,3 +285,83 @@ describe("setTransitionDuration", () => {
|
|
|
333
285
|
expect(() => ph.setTransitionDuration(3001)).toThrowError("Invalid transition duration (should be between 100 and 3000)");
|
|
334
286
|
});
|
|
335
287
|
});
|
|
288
|
+
|
|
289
|
+
describe("playSequence", () => {
|
|
290
|
+
it("sends event", () => {
|
|
291
|
+
const p = createParent();
|
|
292
|
+
const c = document.createElement("div");
|
|
293
|
+
const ph = new Photo(p, c);
|
|
294
|
+
return new Promise(resolve => {
|
|
295
|
+
ph.addEventListener("sequence-playing", resolve);
|
|
296
|
+
ph.playSequence();
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
describe("stopSequence", () => {
|
|
302
|
+
it("sends event", async () => {
|
|
303
|
+
const p = createParent();
|
|
304
|
+
const c = document.createElement("div");
|
|
305
|
+
const ph = new Photo(p, c);
|
|
306
|
+
return new Promise(resolve => {
|
|
307
|
+
ph.addEventListener("sequence-stopped", resolve);
|
|
308
|
+
ph.stopSequence();
|
|
309
|
+
});
|
|
310
|
+
});
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
describe("isSequencePlaying", () => {
|
|
314
|
+
it("is true when sequence is playing", () => {
|
|
315
|
+
const p = createParent();
|
|
316
|
+
const c = document.createElement("div");
|
|
317
|
+
const ph = new Photo(p, c);
|
|
318
|
+
ph.goToNextPicture = jest.fn();
|
|
319
|
+
ph.playSequence();
|
|
320
|
+
expect(ph.isSequencePlaying()).toBe(true);
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
it("is false when sequence never played", () => {
|
|
324
|
+
const p = createParent();
|
|
325
|
+
const c = document.createElement("div");
|
|
326
|
+
const ph = new Photo(p, c);
|
|
327
|
+
expect(ph.isSequencePlaying()).toBe(false);
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it("is false when sequence stopped", () => {
|
|
331
|
+
const p = createParent();
|
|
332
|
+
const c = document.createElement("div");
|
|
333
|
+
const ph = new Photo(p, c);
|
|
334
|
+
ph.playSequence();
|
|
335
|
+
ph.stopSequence();
|
|
336
|
+
expect(ph.isSequencePlaying()).toBe(false);
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
describe("getPicturesNavigation", () => {
|
|
341
|
+
it("works", () => {
|
|
342
|
+
const p = createParent();
|
|
343
|
+
const c = document.createElement("div");
|
|
344
|
+
const ph = new Photo(p, c, {picturesNavigation: "pic"});
|
|
345
|
+
expect(ph.getPicturesNavigation()).toBe("pic");
|
|
346
|
+
ph._picturesNavigation = "seq";
|
|
347
|
+
expect(ph.getPicturesNavigation()).toBe("seq");
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
describe("setPicturesNavigation", () => {
|
|
352
|
+
it("works", () => {
|
|
353
|
+
const p = createParent();
|
|
354
|
+
const c = document.createElement("div");
|
|
355
|
+
const ph = new Photo(p, c);
|
|
356
|
+
const eventWatcher = jest.fn();
|
|
357
|
+
ph.addEventListener("pictures-navigation-changed", eventWatcher);
|
|
358
|
+
expect(ph.getPicturesNavigation()).toBe("any");
|
|
359
|
+
ph.setPicturesNavigation("pic");
|
|
360
|
+
expect(ph.getPicturesNavigation()).toBe("pic");
|
|
361
|
+
ph.setPicturesNavigation("seq");
|
|
362
|
+
expect(ph.getPicturesNavigation()).toBe("seq");
|
|
363
|
+
ph.setPicturesNavigation("any");
|
|
364
|
+
expect(ph.getPicturesNavigation()).toBe("any");
|
|
365
|
+
expect(eventWatcher.mock.calls).toMatchSnapshot();
|
|
366
|
+
});
|
|
367
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
expect(p.visible).toBe(false);
|
|
8
|
+
|
|
9
|
+
p.connectedCallback();
|
|
10
|
+
expect(p.addEventListener.mock.calls).toMatchSnapshot();
|
|
11
|
+
expect(document.addEventListener.mock.calls).toMatchSnapshot();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
describe("close", () => {
|
|
16
|
+
it("works", () => {
|
|
17
|
+
const p = new Popup();
|
|
18
|
+
p.visible = true;
|
|
19
|
+
p.close();
|
|
20
|
+
|
|
21
|
+
expect(p.visible).toBe(false);
|
|
22
|
+
expect(p.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import QualityScore from "../../../src/components/ui/QualityScore";
|
|
2
|
+
|
|
3
|
+
describe("_onInput", () => {
|
|
4
|
+
it("works", () => {
|
|
5
|
+
const qs = new QualityScore();
|
|
6
|
+
qs.renderRoot.querySelectorAll.mockReturnValueOnce([
|
|
7
|
+
{ value: 5, checked: false },
|
|
8
|
+
{ value: 4, checked: true },
|
|
9
|
+
{ value: 3, checked: false },
|
|
10
|
+
{ value: 2, checked: true },
|
|
11
|
+
{ value: 1, checked: false },
|
|
12
|
+
])
|
|
13
|
+
qs._onInput();
|
|
14
|
+
expect(qs.grade).toEqual("4,2");
|
|
15
|
+
expect(qs.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,107 @@
|
|
|
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._onResultClick({title: "res1", subtitle: "sub1", data: "coucou"});
|
|
41
|
+
expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
42
|
+
expect(sb.value).toEqual("res1");
|
|
43
|
+
expect(sb._icon).toEqual("empty");
|
|
44
|
+
expect(sb._results).toBe(null);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("works on reduced", () => {
|
|
48
|
+
const sb = new SearchBar();
|
|
49
|
+
sb.reduceable = true;
|
|
50
|
+
sb._onResultClick({title: "res1", subtitle: "sub1", data: "coucou"});
|
|
51
|
+
expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
52
|
+
expect(sb.value).toEqual("");
|
|
53
|
+
expect(sb._icon).toEqual("search");
|
|
54
|
+
expect(sb._results).toBe(null);
|
|
55
|
+
expect(sb.reduced).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it("resets on null value", () => {
|
|
59
|
+
const sb = new SearchBar();
|
|
60
|
+
sb._onResultClick(null);
|
|
61
|
+
expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
62
|
+
expect(sb.value).toEqual("");
|
|
63
|
+
expect(sb._icon).toEqual("search");
|
|
64
|
+
expect(sb._results).toBe(null);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
describe("_search", () => {
|
|
69
|
+
it("skips if value is empty", () => {
|
|
70
|
+
const sb = new SearchBar();
|
|
71
|
+
sb.reset = jest.fn();
|
|
72
|
+
sb._search();
|
|
73
|
+
expect(sb.reset.mock.calls).toMatchSnapshot();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it("skips if no searcher fct", () => {
|
|
77
|
+
global.console = { warn: jest.fn() };
|
|
78
|
+
|
|
79
|
+
const sb = new SearchBar();
|
|
80
|
+
sb.value = "test";
|
|
81
|
+
sb._search();
|
|
82
|
+
expect(global.console.warn.mock.calls).toMatchSnapshot();
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
it("works with actual data", () => {
|
|
86
|
+
const sb = new SearchBar();
|
|
87
|
+
return new Promise(resolve => {
|
|
88
|
+
sb.searcher = value => {
|
|
89
|
+
expect(value).toEqual("my search");
|
|
90
|
+
expect(sb._icon).toEqual("loading");
|
|
91
|
+
expect(sb._results).toBe(null);
|
|
92
|
+
resolve();
|
|
93
|
+
};
|
|
94
|
+
sb.value = "my search";
|
|
95
|
+
sb._search();
|
|
96
|
+
});
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe("reset", () => {
|
|
101
|
+
it("works", () => {
|
|
102
|
+
const sb = new SearchBar();
|
|
103
|
+
sb._onResultClick = jest.fn();
|
|
104
|
+
sb.reset();
|
|
105
|
+
expect(sb._onResultClick.mock.calls).toMatchSnapshot();
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
Array [
|
|
29
|
+
Array [
|
|
30
|
+
"click",
|
|
31
|
+
[Function],
|
|
32
|
+
],
|
|
33
|
+
]
|
|
34
|
+
`;
|
|
@@ -0,0 +1,56 @@
|
|
|
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
|
+
`;
|
|
@@ -99,8 +99,8 @@ Array [
|
|
|
99
99
|
],
|
|
100
100
|
"equirectangular",
|
|
101
101
|
],
|
|
102
|
-
"
|
|
103
|
-
"
|
|
102
|
+
"pnx-arrow-360",
|
|
103
|
+
"pnx-arrow-flat",
|
|
104
104
|
],
|
|
105
105
|
],
|
|
106
106
|
Array [
|
|
@@ -142,8 +142,8 @@ Array [
|
|
|
142
142
|
],
|
|
143
143
|
"equirectangular",
|
|
144
144
|
],
|
|
145
|
-
"
|
|
146
|
-
"
|
|
145
|
+
"pnx-arrow-360",
|
|
146
|
+
"pnx-arrow-flat",
|
|
147
147
|
],
|
|
148
148
|
],
|
|
149
149
|
Array [
|
|
@@ -507,45 +507,18 @@ Array [
|
|
|
507
507
|
exports[`setBackground works if raster is enabled 1`] = `
|
|
508
508
|
Array [
|
|
509
509
|
Array [
|
|
510
|
-
"
|
|
510
|
+
"pnx-aerial",
|
|
511
511
|
"visibility",
|
|
512
512
|
"visible",
|
|
513
513
|
],
|
|
514
514
|
]
|
|
515
515
|
`;
|
|
516
516
|
|
|
517
|
-
exports[`setBackground works if raster is enabled 2`] = `
|
|
518
|
-
Array [
|
|
519
|
-
Array [
|
|
520
|
-
CustomEvent {
|
|
521
|
-
"isTrusted": false,
|
|
522
|
-
},
|
|
523
|
-
],
|
|
524
|
-
]
|
|
525
|
-
`;
|
|
526
|
-
|
|
527
517
|
exports[`setVisibleUsers works when no users exists 1`] = `Array []`;
|
|
528
518
|
|
|
529
|
-
exports[`setVisibleUsers works when no users exists 2`] = `
|
|
530
|
-
Array [
|
|
531
|
-
Array [
|
|
532
|
-
CustomEvent {
|
|
533
|
-
"isTrusted": false,
|
|
534
|
-
},
|
|
535
|
-
],
|
|
536
|
-
]
|
|
537
|
-
`;
|
|
519
|
+
exports[`setVisibleUsers works when no users exists 2`] = `Array []`;
|
|
538
520
|
|
|
539
|
-
exports[`setVisibleUsers works when user already exist but is hidden 1`] = `
|
|
540
|
-
Array [
|
|
541
|
-
CustomEvent {
|
|
542
|
-
"isTrusted": false,
|
|
543
|
-
},
|
|
544
|
-
CustomEvent {
|
|
545
|
-
"isTrusted": false,
|
|
546
|
-
},
|
|
547
|
-
]
|
|
548
|
-
`;
|
|
521
|
+
exports[`setVisibleUsers works when user already exist but is hidden 1`] = `Array []`;
|
|
549
522
|
|
|
550
523
|
exports[`setVisibleUsers works when user already exist but is hidden 2`] = `
|
|
551
524
|
Array [
|
|
@@ -605,8 +578,8 @@ Array [
|
|
|
605
578
|
],
|
|
606
579
|
"equirectangular",
|
|
607
580
|
],
|
|
608
|
-
"
|
|
609
|
-
"
|
|
581
|
+
"pnx-arrow-360",
|
|
582
|
+
"pnx-arrow-flat",
|
|
610
583
|
],
|
|
611
584
|
],
|
|
612
585
|
Array [
|
|
@@ -648,8 +621,8 @@ Array [
|
|
|
648
621
|
],
|
|
649
622
|
"equirectangular",
|
|
650
623
|
],
|
|
651
|
-
"
|
|
652
|
-
"
|
|
624
|
+
"pnx-arrow-360",
|
|
625
|
+
"pnx-arrow-flat",
|
|
653
626
|
],
|
|
654
627
|
],
|
|
655
628
|
Array [
|
|
@@ -125,7 +125,48 @@ Object {
|
|
|
125
125
|
],
|
|
126
126
|
"horizontalFov": 360,
|
|
127
127
|
"id": "0005086d-65eb-4a90-9764-86b3661aaa77",
|
|
128
|
-
"links": Array [
|
|
128
|
+
"links": Array [
|
|
129
|
+
Object {
|
|
130
|
+
"arrowStyle": Object {
|
|
131
|
+
"element": <img
|
|
132
|
+
alt=""
|
|
133
|
+
src="arrow_triangle.svg"
|
|
134
|
+
/>,
|
|
135
|
+
"size": Object {
|
|
136
|
+
"height": 75,
|
|
137
|
+
"width": 75,
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
"gps": Array [
|
|
141
|
+
2.1822633,
|
|
142
|
+
48.9811134,
|
|
143
|
+
],
|
|
144
|
+
"linkOffset": Object {
|
|
145
|
+
"yaw": -0,
|
|
146
|
+
},
|
|
147
|
+
"nodeId": "ccf5f468-38b8-4b42-8d79-b97f5391e0a3",
|
|
148
|
+
},
|
|
149
|
+
Object {
|
|
150
|
+
"arrowStyle": Object {
|
|
151
|
+
"element": <img
|
|
152
|
+
alt=""
|
|
153
|
+
src="arrow_triangle.svg"
|
|
154
|
+
/>,
|
|
155
|
+
"size": Object {
|
|
156
|
+
"height": 75,
|
|
157
|
+
"width": 75,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
"gps": Array [
|
|
161
|
+
2.1823272,
|
|
162
|
+
48.9810024,
|
|
163
|
+
],
|
|
164
|
+
"linkOffset": Object {
|
|
165
|
+
"yaw": -0,
|
|
166
|
+
},
|
|
167
|
+
"nodeId": "127d9282-d082-46ca-bc09-4b0d8569dd2c",
|
|
168
|
+
},
|
|
169
|
+
],
|
|
129
170
|
"panorama": Object {
|
|
130
171
|
"basePanoData": [Function],
|
|
131
172
|
"baseUrl": "https://geovisio.fr/api/pictures/0005086d-65eb-4a90-9764-86b3661aaa77/sd.webp",
|
|
@@ -188,12 +229,24 @@ Array [
|
|
|
188
229
|
]
|
|
189
230
|
`;
|
|
190
231
|
|
|
191
|
-
exports[`
|
|
232
|
+
exports[`setPicturesNavigation works 1`] = `
|
|
192
233
|
Array [
|
|
193
234
|
Array [
|
|
194
|
-
|
|
195
|
-
"
|
|
235
|
+
Object {
|
|
236
|
+
"value": "pic",
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
Array [
|
|
240
|
+
Object {
|
|
241
|
+
"value": "seq",
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
Array [
|
|
245
|
+
Object {
|
|
246
|
+
"value": "any",
|
|
196
247
|
},
|
|
197
248
|
],
|
|
198
249
|
]
|
|
199
250
|
`;
|
|
251
|
+
|
|
252
|
+
exports[`setTransitionDuration works 1`] = `Array []`;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`close works 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Array [
|
|
6
|
+
Event {
|
|
7
|
+
"isTrusted": false,
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
]
|
|
11
|
+
`;
|
|
12
|
+
|
|
13
|
+
exports[`constructor works 1`] = `
|
|
14
|
+
Array [
|
|
15
|
+
Array [
|
|
16
|
+
"click",
|
|
17
|
+
[Function],
|
|
18
|
+
],
|
|
19
|
+
]
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
exports[`constructor works 2`] = `
|
|
23
|
+
Array [
|
|
24
|
+
Array [
|
|
25
|
+
"keyup",
|
|
26
|
+
[Function],
|
|
27
|
+
],
|
|
28
|
+
]
|
|
29
|
+
`;
|