@panoramax/web-viewer 3.0.2-develop-a8ea8e60
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/.dockerignore +6 -0
- package/.gitlab-ci.yml +71 -0
- package/CHANGELOG.md +428 -0
- package/CODE_OF_CONDUCT.md +134 -0
- package/Dockerfile +14 -0
- package/LICENSE +21 -0
- package/README.md +39 -0
- package/build/editor.html +1 -0
- package/build/index.css +36 -0
- package/build/index.css.map +1 -0
- package/build/index.html +1 -0
- package/build/index.js +25 -0
- package/build/index.js.map +1 -0
- package/build/map.html +1 -0
- package/build/viewer.html +1 -0
- package/config/env.js +104 -0
- package/config/getHttpsConfig.js +66 -0
- package/config/getPackageJson.js +25 -0
- package/config/jest/babelTransform.js +29 -0
- package/config/jest/cssTransform.js +14 -0
- package/config/jest/fileTransform.js +40 -0
- package/config/modules.js +134 -0
- package/config/paths.js +72 -0
- package/config/pnpTs.js +35 -0
- package/config/webpack/persistentCache/createEnvironmentHash.js +9 -0
- package/config/webpack.config.js +885 -0
- package/config/webpackDevServer.config.js +127 -0
- package/docs/01_Start.md +149 -0
- package/docs/02_Usage.md +828 -0
- package/docs/03_URL_settings.md +140 -0
- package/docs/04_Advanced_examples.md +214 -0
- package/docs/05_Compatibility.md +85 -0
- package/docs/09_Develop.md +62 -0
- package/docs/90_Releases.md +27 -0
- package/docs/images/class_diagram.drawio +129 -0
- package/docs/images/class_diagram.jpg +0 -0
- package/docs/images/screenshot.jpg +0 -0
- package/mkdocs.yml +45 -0
- package/package.json +254 -0
- package/public/editor.html +54 -0
- package/public/favicon.ico +0 -0
- package/public/index.html +59 -0
- package/public/map.html +53 -0
- package/public/viewer.html +67 -0
- package/scripts/build.js +217 -0
- package/scripts/start.js +176 -0
- package/scripts/test.js +52 -0
- package/src/Editor.css +37 -0
- package/src/Editor.js +359 -0
- package/src/StandaloneMap.js +114 -0
- package/src/Viewer.css +203 -0
- package/src/Viewer.js +1186 -0
- package/src/components/CoreView.css +64 -0
- package/src/components/CoreView.js +159 -0
- package/src/components/Loader.css +56 -0
- package/src/components/Loader.js +111 -0
- package/src/components/Map.css +65 -0
- package/src/components/Map.js +841 -0
- package/src/components/Photo.css +36 -0
- package/src/components/Photo.js +687 -0
- package/src/img/arrow_360.svg +14 -0
- package/src/img/arrow_flat.svg +11 -0
- package/src/img/arrow_triangle.svg +10 -0
- package/src/img/arrow_turn.svg +9 -0
- package/src/img/bg_aerial.jpg +0 -0
- package/src/img/bg_streets.jpg +0 -0
- package/src/img/loader_base.jpg +0 -0
- package/src/img/loader_hd.jpg +0 -0
- package/src/img/logo_dead.svg +91 -0
- package/src/img/marker.svg +17 -0
- package/src/img/marker_blue.svg +20 -0
- package/src/img/switch_big.svg +44 -0
- package/src/img/switch_mini.svg +48 -0
- package/src/index.js +10 -0
- package/src/translations/de.json +163 -0
- package/src/translations/en.json +164 -0
- package/src/translations/eo.json +6 -0
- package/src/translations/es.json +164 -0
- package/src/translations/fi.json +1 -0
- package/src/translations/fr.json +164 -0
- package/src/translations/hu.json +133 -0
- package/src/translations/nl.json +1 -0
- package/src/translations/zh_Hant.json +136 -0
- package/src/utils/API.js +709 -0
- package/src/utils/Exif.js +198 -0
- package/src/utils/I18n.js +75 -0
- package/src/utils/Map.js +382 -0
- package/src/utils/PhotoAdapter.js +45 -0
- package/src/utils/Utils.js +568 -0
- package/src/utils/Widgets.js +477 -0
- package/src/viewer/URLHash.js +334 -0
- package/src/viewer/Widgets.css +711 -0
- package/src/viewer/Widgets.js +1196 -0
- package/tests/Editor.test.js +125 -0
- package/tests/StandaloneMap.test.js +44 -0
- package/tests/Viewer.test.js +363 -0
- package/tests/__snapshots__/Editor.test.js.snap +300 -0
- package/tests/__snapshots__/StandaloneMap.test.js.snap +30 -0
- package/tests/__snapshots__/Viewer.test.js.snap +195 -0
- package/tests/components/CoreView.test.js +91 -0
- package/tests/components/Loader.test.js +38 -0
- package/tests/components/Map.test.js +230 -0
- package/tests/components/Photo.test.js +335 -0
- package/tests/components/__snapshots__/Loader.test.js.snap +15 -0
- package/tests/components/__snapshots__/Map.test.js.snap +767 -0
- package/tests/components/__snapshots__/Photo.test.js.snap +205 -0
- package/tests/data/Map_geocoder_ban.json +36 -0
- package/tests/data/Map_geocoder_nominatim.json +56 -0
- package/tests/data/Viewer_pictures_1.json +148 -0
- package/tests/setupTests.js +5 -0
- package/tests/utils/API.test.js +906 -0
- package/tests/utils/Exif.test.js +124 -0
- package/tests/utils/I18n.test.js +28 -0
- package/tests/utils/Map.test.js +105 -0
- package/tests/utils/Utils.test.js +300 -0
- package/tests/utils/Widgets.test.js +107 -0
- package/tests/utils/__snapshots__/API.test.js.snap +132 -0
- package/tests/utils/__snapshots__/Exif.test.js.snap +43 -0
- package/tests/utils/__snapshots__/Map.test.js.snap +48 -0
- package/tests/utils/__snapshots__/Utils.test.js.snap +41 -0
- package/tests/utils/__snapshots__/Widgets.test.js.snap +44 -0
- package/tests/viewer/URLHash.test.js +537 -0
- package/tests/viewer/Widgets.test.js +127 -0
- package/tests/viewer/__snapshots__/URLHash.test.js.snap +98 -0
- package/tests/viewer/__snapshots__/Widgets.test.js.snap +393 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`_addMapBackgroundWidget works 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
<div
|
|
6
|
+
class="gvs-panel gvs-widget-bg gvs-input-group"
|
|
7
|
+
id="gvs-map-bg"
|
|
8
|
+
>
|
|
9
|
+
<input
|
|
10
|
+
id="gvs-map-bg-streets"
|
|
11
|
+
name="gvs-map-bg"
|
|
12
|
+
type="radio"
|
|
13
|
+
value="streets"
|
|
14
|
+
/>
|
|
15
|
+
<label
|
|
16
|
+
for="gvs-map-bg-streets"
|
|
17
|
+
>
|
|
18
|
+
<img
|
|
19
|
+
src="bg_streets.jpg"
|
|
20
|
+
/>
|
|
21
|
+
Streets
|
|
22
|
+
</label>
|
|
23
|
+
<input
|
|
24
|
+
id="gvs-map-bg-aerial"
|
|
25
|
+
name="gvs-map-bg"
|
|
26
|
+
type="radio"
|
|
27
|
+
value="aerial"
|
|
28
|
+
/>
|
|
29
|
+
<label
|
|
30
|
+
for="gvs-map-bg-aerial"
|
|
31
|
+
>
|
|
32
|
+
<img
|
|
33
|
+
src="bg_aerial.jpg"
|
|
34
|
+
/>
|
|
35
|
+
Aerial
|
|
36
|
+
</label>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
`;
|
|
40
|
+
|
|
41
|
+
exports[`_bindPicturesEvents works 1`] = `
|
|
42
|
+
Array [
|
|
43
|
+
Array [
|
|
44
|
+
"mousemove",
|
|
45
|
+
"geovisio_editor_pictures",
|
|
46
|
+
[Function],
|
|
47
|
+
],
|
|
48
|
+
Array [
|
|
49
|
+
"mouseleave",
|
|
50
|
+
"geovisio_editor_pictures",
|
|
51
|
+
[Function],
|
|
52
|
+
],
|
|
53
|
+
Array [
|
|
54
|
+
"click",
|
|
55
|
+
"geovisio_editor_pictures",
|
|
56
|
+
[Function],
|
|
57
|
+
],
|
|
58
|
+
]
|
|
59
|
+
`;
|
|
60
|
+
|
|
61
|
+
exports[`_createMapStyle works 1`] = `
|
|
62
|
+
Object {
|
|
63
|
+
"layers": Array [
|
|
64
|
+
Object {
|
|
65
|
+
"id": "geovisio_editor_sequences",
|
|
66
|
+
"layout": Object {
|
|
67
|
+
"line-cap": "square",
|
|
68
|
+
},
|
|
69
|
+
"paint": Object {
|
|
70
|
+
"line-width": Array [
|
|
71
|
+
"interpolate",
|
|
72
|
+
Array [
|
|
73
|
+
"linear",
|
|
74
|
+
],
|
|
75
|
+
Array [
|
|
76
|
+
"zoom",
|
|
77
|
+
],
|
|
78
|
+
0,
|
|
79
|
+
0.5,
|
|
80
|
+
10,
|
|
81
|
+
2,
|
|
82
|
+
14,
|
|
83
|
+
4,
|
|
84
|
+
16,
|
|
85
|
+
5,
|
|
86
|
+
22,
|
|
87
|
+
3,
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
"source": "geovisio_editor_sequences",
|
|
91
|
+
"type": "line",
|
|
92
|
+
},
|
|
93
|
+
Object {
|
|
94
|
+
"id": "geovisio_editor_pictures",
|
|
95
|
+
"layout": Object {},
|
|
96
|
+
"paint": Object {
|
|
97
|
+
"circle-opacity": Array [
|
|
98
|
+
"interpolate",
|
|
99
|
+
Array [
|
|
100
|
+
"linear",
|
|
101
|
+
],
|
|
102
|
+
Array [
|
|
103
|
+
"zoom",
|
|
104
|
+
],
|
|
105
|
+
15,
|
|
106
|
+
0,
|
|
107
|
+
16,
|
|
108
|
+
1,
|
|
109
|
+
],
|
|
110
|
+
"circle-radius": Array [
|
|
111
|
+
"interpolate",
|
|
112
|
+
Array [
|
|
113
|
+
"linear",
|
|
114
|
+
],
|
|
115
|
+
Array [
|
|
116
|
+
"zoom",
|
|
117
|
+
],
|
|
118
|
+
15,
|
|
119
|
+
4.5,
|
|
120
|
+
18,
|
|
121
|
+
6,
|
|
122
|
+
24,
|
|
123
|
+
12,
|
|
124
|
+
],
|
|
125
|
+
"circle-stroke-color": "#ffffff",
|
|
126
|
+
"circle-stroke-width": Array [
|
|
127
|
+
"interpolate",
|
|
128
|
+
Array [
|
|
129
|
+
"linear",
|
|
130
|
+
],
|
|
131
|
+
Array [
|
|
132
|
+
"zoom",
|
|
133
|
+
],
|
|
134
|
+
16,
|
|
135
|
+
0,
|
|
136
|
+
17,
|
|
137
|
+
1,
|
|
138
|
+
18,
|
|
139
|
+
1.5,
|
|
140
|
+
24,
|
|
141
|
+
3,
|
|
142
|
+
],
|
|
143
|
+
},
|
|
144
|
+
"source": "geovisio_editor_sequences",
|
|
145
|
+
"type": "circle",
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
"sources": Object {
|
|
149
|
+
"geovisio_editor_sequences": Object {
|
|
150
|
+
"data": Object {
|
|
151
|
+
"features": Array [],
|
|
152
|
+
"type": "FeatureCollection",
|
|
153
|
+
},
|
|
154
|
+
"type": "geojson",
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
}
|
|
158
|
+
`;
|
|
159
|
+
|
|
160
|
+
exports[`_getNode works 1`] = `
|
|
161
|
+
Object {
|
|
162
|
+
"caption": Object {},
|
|
163
|
+
"gps": Array [
|
|
164
|
+
0.1,
|
|
165
|
+
0.1,
|
|
166
|
+
],
|
|
167
|
+
"horizontalFov": 70,
|
|
168
|
+
"id": undefined,
|
|
169
|
+
"panorama": Object {
|
|
170
|
+
"basePanoData": [Function],
|
|
171
|
+
"baseUrl": "2.jpg",
|
|
172
|
+
"cols": 2,
|
|
173
|
+
"hdUrl": undefined,
|
|
174
|
+
"origBaseUrl": "2.jpg",
|
|
175
|
+
"rows": 1,
|
|
176
|
+
"thumbUrl": undefined,
|
|
177
|
+
"tileUrl": [Function],
|
|
178
|
+
"width": 2,
|
|
179
|
+
},
|
|
180
|
+
"properties": Object {
|
|
181
|
+
"id": "2",
|
|
182
|
+
},
|
|
183
|
+
"sequence": Object {
|
|
184
|
+
"id": undefined,
|
|
185
|
+
"nextPic": undefined,
|
|
186
|
+
"prevPic": undefined,
|
|
187
|
+
},
|
|
188
|
+
"sphereCorrection": Object {
|
|
189
|
+
"pan": 0,
|
|
190
|
+
"roll": 0,
|
|
191
|
+
"tilt": 0,
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
195
|
+
|
|
196
|
+
exports[`previewSequenceHeadingChange works when setting preview 1`] = `
|
|
197
|
+
Array [
|
|
198
|
+
Array [
|
|
199
|
+
Object {
|
|
200
|
+
"id": "sequence-headings",
|
|
201
|
+
"layout": Object {
|
|
202
|
+
"icon-image": "gvs-marker",
|
|
203
|
+
"icon-overlap": "always",
|
|
204
|
+
"icon-size": 0.8,
|
|
205
|
+
},
|
|
206
|
+
"source": "geovisio_editor_sequences",
|
|
207
|
+
"type": "symbol",
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
]
|
|
211
|
+
`;
|
|
212
|
+
|
|
213
|
+
exports[`previewSequenceHeadingChange works when setting preview 2`] = `
|
|
214
|
+
Array [
|
|
215
|
+
Array [
|
|
216
|
+
"sequence-headings",
|
|
217
|
+
"visibility",
|
|
218
|
+
"visible",
|
|
219
|
+
],
|
|
220
|
+
Array [
|
|
221
|
+
"sequence-headings",
|
|
222
|
+
"icon-rotate",
|
|
223
|
+
Array [
|
|
224
|
+
"+",
|
|
225
|
+
Array [
|
|
226
|
+
"get",
|
|
227
|
+
"view:azimuth",
|
|
228
|
+
],
|
|
229
|
+
-12,
|
|
230
|
+
10,
|
|
231
|
+
],
|
|
232
|
+
],
|
|
233
|
+
]
|
|
234
|
+
`;
|
|
235
|
+
|
|
236
|
+
exports[`previewSequenceHeadingChange works when setting preview 3`] = `
|
|
237
|
+
Array [
|
|
238
|
+
Array [
|
|
239
|
+
"sequence-headings",
|
|
240
|
+
Array [
|
|
241
|
+
"all",
|
|
242
|
+
Array [
|
|
243
|
+
"==",
|
|
244
|
+
Array [
|
|
245
|
+
"geometry-type",
|
|
246
|
+
],
|
|
247
|
+
"Point",
|
|
248
|
+
],
|
|
249
|
+
],
|
|
250
|
+
],
|
|
251
|
+
]
|
|
252
|
+
`;
|
|
253
|
+
|
|
254
|
+
exports[`previewSequenceHeadingChange works when unsetting 1`] = `Array []`;
|
|
255
|
+
|
|
256
|
+
exports[`previewSequenceHeadingChange works when unsetting 2`] = `
|
|
257
|
+
Array [
|
|
258
|
+
Array [
|
|
259
|
+
"sequence-headings",
|
|
260
|
+
"visibility",
|
|
261
|
+
"visible",
|
|
262
|
+
],
|
|
263
|
+
Array [
|
|
264
|
+
"sequence-headings",
|
|
265
|
+
"icon-rotate",
|
|
266
|
+
Array [
|
|
267
|
+
"+",
|
|
268
|
+
Array [
|
|
269
|
+
"get",
|
|
270
|
+
"view:azimuth",
|
|
271
|
+
],
|
|
272
|
+
-12,
|
|
273
|
+
10,
|
|
274
|
+
],
|
|
275
|
+
],
|
|
276
|
+
Array [
|
|
277
|
+
"sequence-headings",
|
|
278
|
+
"visibility",
|
|
279
|
+
"none",
|
|
280
|
+
],
|
|
281
|
+
]
|
|
282
|
+
`;
|
|
283
|
+
|
|
284
|
+
exports[`previewSequenceHeadingChange works when unsetting 3`] = `
|
|
285
|
+
Array [
|
|
286
|
+
Array [
|
|
287
|
+
"sequence-headings",
|
|
288
|
+
Array [
|
|
289
|
+
"all",
|
|
290
|
+
Array [
|
|
291
|
+
"==",
|
|
292
|
+
Array [
|
|
293
|
+
"geometry-type",
|
|
294
|
+
],
|
|
295
|
+
"Point",
|
|
296
|
+
],
|
|
297
|
+
],
|
|
298
|
+
],
|
|
299
|
+
]
|
|
300
|
+
`;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`_onSelect works 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Array [
|
|
6
|
+
Object {
|
|
7
|
+
"filter": Array [
|
|
8
|
+
"==",
|
|
9
|
+
Array [
|
|
10
|
+
"get",
|
|
11
|
+
"id",
|
|
12
|
+
],
|
|
13
|
+
"bla",
|
|
14
|
+
],
|
|
15
|
+
"layers": Array [
|
|
16
|
+
"geovisio_pictures",
|
|
17
|
+
"geovisio_toto_pictures",
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
]
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`_onSelect works 2`] = `Array []`;
|
|
25
|
+
|
|
26
|
+
exports[`destroy works 1`] = `
|
|
27
|
+
Array [
|
|
28
|
+
Array [],
|
|
29
|
+
]
|
|
30
|
+
`;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`setFilters works 1`] = `
|
|
4
|
+
Array [
|
|
5
|
+
Array [
|
|
6
|
+
CustomEvent {
|
|
7
|
+
"isTrusted": false,
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
Array [
|
|
11
|
+
CustomEvent {
|
|
12
|
+
"isTrusted": false,
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
]
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
exports[`setFilters works 2`] = `
|
|
19
|
+
Array [
|
|
20
|
+
Array [],
|
|
21
|
+
]
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
exports[`setFilters works 3`] = `
|
|
25
|
+
Array [
|
|
26
|
+
Array [
|
|
27
|
+
"sequences",
|
|
28
|
+
Array [
|
|
29
|
+
"step",
|
|
30
|
+
Array [
|
|
31
|
+
"zoom",
|
|
32
|
+
],
|
|
33
|
+
true,
|
|
34
|
+
7,
|
|
35
|
+
Array [
|
|
36
|
+
"all",
|
|
37
|
+
Array [
|
|
38
|
+
">=",
|
|
39
|
+
Array [
|
|
40
|
+
"get",
|
|
41
|
+
"date",
|
|
42
|
+
],
|
|
43
|
+
"2023-01-01",
|
|
44
|
+
],
|
|
45
|
+
Array [
|
|
46
|
+
"<=",
|
|
47
|
+
Array [
|
|
48
|
+
"get",
|
|
49
|
+
"date",
|
|
50
|
+
],
|
|
51
|
+
"2023-08-08",
|
|
52
|
+
],
|
|
53
|
+
Array [
|
|
54
|
+
"==",
|
|
55
|
+
Array [
|
|
56
|
+
"get",
|
|
57
|
+
"type",
|
|
58
|
+
],
|
|
59
|
+
"equirectangular",
|
|
60
|
+
],
|
|
61
|
+
Array [
|
|
62
|
+
">=",
|
|
63
|
+
Array [
|
|
64
|
+
"get",
|
|
65
|
+
"model",
|
|
66
|
+
],
|
|
67
|
+
"sony ",
|
|
68
|
+
Array [
|
|
69
|
+
"collator",
|
|
70
|
+
Object {
|
|
71
|
+
"case-sensitive": false,
|
|
72
|
+
"diacritic-sensitive": false,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
],
|
|
76
|
+
Array [
|
|
77
|
+
"<=",
|
|
78
|
+
Array [
|
|
79
|
+
"get",
|
|
80
|
+
"model",
|
|
81
|
+
],
|
|
82
|
+
"sonyzzzzzzzzzzzzzzzzzzzz",
|
|
83
|
+
Array [
|
|
84
|
+
"collator",
|
|
85
|
+
Object {
|
|
86
|
+
"case-sensitive": false,
|
|
87
|
+
"diacritic-sensitive": false,
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
],
|
|
91
|
+
],
|
|
92
|
+
],
|
|
93
|
+
],
|
|
94
|
+
Array [
|
|
95
|
+
"pictures",
|
|
96
|
+
Array [
|
|
97
|
+
"step",
|
|
98
|
+
Array [
|
|
99
|
+
"zoom",
|
|
100
|
+
],
|
|
101
|
+
true,
|
|
102
|
+
15,
|
|
103
|
+
Array [
|
|
104
|
+
"all",
|
|
105
|
+
Array [
|
|
106
|
+
">=",
|
|
107
|
+
Array [
|
|
108
|
+
"get",
|
|
109
|
+
"ts",
|
|
110
|
+
],
|
|
111
|
+
"2023-01-01",
|
|
112
|
+
],
|
|
113
|
+
Array [
|
|
114
|
+
"<=",
|
|
115
|
+
Array [
|
|
116
|
+
"get",
|
|
117
|
+
"ts",
|
|
118
|
+
],
|
|
119
|
+
"2023-08-09",
|
|
120
|
+
],
|
|
121
|
+
Array [
|
|
122
|
+
"==",
|
|
123
|
+
Array [
|
|
124
|
+
"get",
|
|
125
|
+
"type",
|
|
126
|
+
],
|
|
127
|
+
"equirectangular",
|
|
128
|
+
],
|
|
129
|
+
Array [
|
|
130
|
+
">=",
|
|
131
|
+
Array [
|
|
132
|
+
"get",
|
|
133
|
+
"model",
|
|
134
|
+
],
|
|
135
|
+
"sony ",
|
|
136
|
+
Array [
|
|
137
|
+
"collator",
|
|
138
|
+
Object {
|
|
139
|
+
"case-sensitive": false,
|
|
140
|
+
"diacritic-sensitive": false,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
],
|
|
144
|
+
Array [
|
|
145
|
+
"<=",
|
|
146
|
+
Array [
|
|
147
|
+
"get",
|
|
148
|
+
"model",
|
|
149
|
+
],
|
|
150
|
+
"sonyzzzzzzzzzzzzzzzzzzzz",
|
|
151
|
+
Array [
|
|
152
|
+
"collator",
|
|
153
|
+
Object {
|
|
154
|
+
"case-sensitive": false,
|
|
155
|
+
"diacritic-sensitive": false,
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
],
|
|
159
|
+
],
|
|
160
|
+
],
|
|
161
|
+
],
|
|
162
|
+
Array [
|
|
163
|
+
"sequences",
|
|
164
|
+
null,
|
|
165
|
+
],
|
|
166
|
+
Array [
|
|
167
|
+
"pictures",
|
|
168
|
+
null,
|
|
169
|
+
],
|
|
170
|
+
]
|
|
171
|
+
`;
|
|
172
|
+
|
|
173
|
+
exports[`setPicturesNavigation works 1`] = `
|
|
174
|
+
Array [
|
|
175
|
+
Array [
|
|
176
|
+
CustomEvent {
|
|
177
|
+
"isTrusted": false,
|
|
178
|
+
},
|
|
179
|
+
],
|
|
180
|
+
Array [
|
|
181
|
+
CustomEvent {
|
|
182
|
+
"isTrusted": false,
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
Array [
|
|
186
|
+
CustomEvent {
|
|
187
|
+
"isTrusted": false,
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
]
|
|
191
|
+
`;
|
|
192
|
+
|
|
193
|
+
exports[`setPopup opens 1`] = `"<div class=\\"gvs-popup-backdrop\\"></div><div class=\\"gvs-widget-bg\\"><button id=\\"gvs-popup-btn-close\\" class=\\"gvs-btn gvs-widget-bg\\"><svg aria-hidden=\\"true\\" focusable=\\"false\\" data-prefix=\\"fas\\" data-icon=\\"xmark\\" class=\\"svg-inline--fa fa-xmark\\" role=\\"img\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 384 512\\"><path fill=\\"currentColor\\" d=\\"M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z\\"></path></svg></button>BLABLABLA</div>"`;
|
|
194
|
+
|
|
195
|
+
exports[`setPopup reopens 1`] = `"<div class=\\"gvs-popup-backdrop\\"></div><div class=\\"gvs-widget-bg\\"><button id=\\"gvs-popup-btn-close\\" class=\\"gvs-btn gvs-widget-bg\\"><svg aria-hidden=\\"true\\" focusable=\\"false\\" data-prefix=\\"fas\\" data-icon=\\"xmark\\" class=\\"svg-inline--fa fa-xmark\\" role=\\"img\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 384 512\\"><path fill=\\"currentColor\\" d=\\"M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z\\"></path></svg></button>BLABLABLA</div>"`;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import Loader from "../../src/components/Loader";
|
|
2
|
+
import CoreView from "../../src/components/CoreView";
|
|
3
|
+
import API from "../../src/utils/API";
|
|
4
|
+
|
|
5
|
+
jest.mock("maplibre-gl", () => ({
|
|
6
|
+
addProtocol: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
global.console = { info: jest.fn() };
|
|
10
|
+
|
|
11
|
+
describe("constructor", () => {
|
|
12
|
+
it("works with JS element", () => {
|
|
13
|
+
const container = document.createElement("div");
|
|
14
|
+
const v = new CoreView(container, "https://geovisio.fr/api");
|
|
15
|
+
expect(v._t).toBeDefined();
|
|
16
|
+
expect(v._selectedPicId).toBeNull();
|
|
17
|
+
expect(v._selectedSeqId).toBeNull();
|
|
18
|
+
expect(v._api).toBeInstanceOf(API);
|
|
19
|
+
expect(v.container).toBe(container);
|
|
20
|
+
expect(v._loader).toBeInstanceOf(Loader);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("works with string ID", () => {
|
|
24
|
+
const container = document.createElement("div");
|
|
25
|
+
container.id = "coreview";
|
|
26
|
+
document.body.appendChild(container);
|
|
27
|
+
|
|
28
|
+
const v = new CoreView("coreview", "https://geovisio.fr/api");
|
|
29
|
+
expect(v._t).toBeDefined();
|
|
30
|
+
expect(v._selectedPicId).toBeNull();
|
|
31
|
+
expect(v._selectedSeqId).toBeNull();
|
|
32
|
+
expect(v._api).toBeInstanceOf(API);
|
|
33
|
+
expect(v.container).toBe(container);
|
|
34
|
+
expect(v._loader).toBeInstanceOf(Loader);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("fails on missing element", () => {
|
|
38
|
+
expect(() => new CoreView("geovisio", "https://geovisio.fr/api")).toThrow(new Error("Container is not a valid HTML element, does it exist in your page ?"));
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it("handle options", () => {
|
|
42
|
+
const opts = {
|
|
43
|
+
selectedSequence: "seq",
|
|
44
|
+
selectedPicture: "pic",
|
|
45
|
+
fetchOptions: { "bla": "bla" }
|
|
46
|
+
};
|
|
47
|
+
const container = document.createElement("div");
|
|
48
|
+
const v = new CoreView(container, "https://geovisio.fr/api", opts);
|
|
49
|
+
expect(v._selectedPicId).toBe("pic");
|
|
50
|
+
expect(v._selectedSeqId).toBe("seq");
|
|
51
|
+
expect(v._api._fetchOpts).toEqual({ "bla": "bla" });
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
describe("select", () => {
|
|
56
|
+
it("works", () => {
|
|
57
|
+
const container = document.createElement("div");
|
|
58
|
+
const v = new CoreView(container, "https://geovisio.fr/api");
|
|
59
|
+
const p = new Promise(resolve => {
|
|
60
|
+
v.addEventListener("select", e => {
|
|
61
|
+
expect(v._selectedPicId).toBe("pic");
|
|
62
|
+
expect(v._selectedSeqId).toBe("seq");
|
|
63
|
+
expect(e.detail.picId).toBe("pic");
|
|
64
|
+
expect(e.detail.seqId).toBe("seq");
|
|
65
|
+
resolve();
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
v.select("seq", "pic");
|
|
69
|
+
return p;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("unselects", () => {
|
|
73
|
+
const container = document.createElement("div");
|
|
74
|
+
const v = new CoreView(
|
|
75
|
+
container,
|
|
76
|
+
"https://geovisio.fr/api",
|
|
77
|
+
{ selectedSequence: "seq", selectedPicture: "pic" }
|
|
78
|
+
);
|
|
79
|
+
const p = new Promise(resolve => {
|
|
80
|
+
v.addEventListener("select", e => {
|
|
81
|
+
expect(v._selectedPicId).toBeNull();
|
|
82
|
+
expect(v._selectedSeqId).toBeNull();
|
|
83
|
+
expect(e.detail.picId).toBeNull();
|
|
84
|
+
expect(e.detail.seqId).toBeNull();
|
|
85
|
+
resolve();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
v.select();
|
|
89
|
+
return p;
|
|
90
|
+
});
|
|
91
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Loader from "../../src/components/Loader";
|
|
2
|
+
|
|
3
|
+
describe("constructor", () => {
|
|
4
|
+
it("works", () => {
|
|
5
|
+
const p = { _t: { gvs: { loading_labels_serious: ["Loading..."], loading_labels_fun: ["FUN..."] }, map: {} } };
|
|
6
|
+
const c = document.createElement("div");
|
|
7
|
+
const l = new Loader(p, c);
|
|
8
|
+
expect(l.container.className).toBe("gvs-loader gvs-loader-visible");
|
|
9
|
+
expect(l.container.innerHTML).toMatchSnapshot();
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
describe("dismiss", () => {
|
|
14
|
+
it("works when no error set", () => {
|
|
15
|
+
const p = {
|
|
16
|
+
_t: { gvs: { loading_labels_serious: ["Loading..."], loading_labels_fun: ["FUN..."] }, map: {} },
|
|
17
|
+
dispatchEvent: jest.fn()
|
|
18
|
+
};
|
|
19
|
+
const c = document.createElement("div");
|
|
20
|
+
const l = new Loader(p, c);
|
|
21
|
+
l.dismiss();
|
|
22
|
+
expect(c.className).toBe("gvs-loader");
|
|
23
|
+
expect(p.dispatchEvent.mock.calls).toMatchSnapshot();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it("works with error set", () => {
|
|
27
|
+
global.console = { error: jest.fn() };
|
|
28
|
+
const p = {
|
|
29
|
+
_t: { gvs: { loading_labels_serious: ["Loading..."], loading_labels_fun: ["FUN..."] }, map: {} },
|
|
30
|
+
dispatchEvent: jest.fn()
|
|
31
|
+
};
|
|
32
|
+
const c = document.createElement("div");
|
|
33
|
+
const l = new Loader(p, c);
|
|
34
|
+
expect(() => l.dismiss("Technical issue", "Oops it's broken")).toThrowError("Oops it's broken");
|
|
35
|
+
expect(c.className).toBe("gvs-loader gvs-loader-visible");
|
|
36
|
+
expect(c.innerHTML).toMatchSnapshot();
|
|
37
|
+
});
|
|
38
|
+
});
|