@panoramax/web-viewer 3.2.3-develop-06e3ec22 → 3.2.3-develop-367cb599

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.
@@ -171,7 +171,7 @@ describe("nextURLString", () => {
171
171
  });
172
172
 
173
173
  describe("currentURLParams", () => {
174
- it("works if empty", () => {
174
+ it("works if empty + search", () => {
175
175
  delete window.location;
176
176
  window.location = { search: "" };
177
177
  const v = { addEventListener: jest.fn() };
@@ -179,20 +179,61 @@ describe("currentURLParams", () => {
179
179
  expect(uh.currentURLParams()).toStrictEqual({});
180
180
  });
181
181
 
182
- it("works with single param", () => {
182
+ it("works with single param + search", () => {
183
183
  delete window.location;
184
- window.location = { search: "?a=b" };
184
+ window.location = { search: "?nav=pic" };
185
+ const v = { addEventListener: jest.fn() };
186
+ const uh = new URLHandler(v);
187
+ expect(uh.currentURLParams()).toStrictEqual({"nav": "pic"});
188
+ });
189
+
190
+ it("works with multiple params + search", () => {
191
+ delete window.location;
192
+ window.location = { search: "?nav=pic&speed=42" };
193
+ const v = { addEventListener: jest.fn() };
194
+ const uh = new URLHandler(v);
195
+ expect(uh.currentURLParams()).toStrictEqual({"nav": "pic", "speed": "42"});
196
+ });
197
+
198
+ it("works if empty + hash", () => {
199
+ delete window.location;
200
+ window.location = { hash: "" };
201
+ const v = { addEventListener: jest.fn() };
202
+ const uh = new URLHandler(v);
203
+ expect(uh.currentURLParams(true)).toStrictEqual({});
204
+ });
205
+
206
+ it("works with single param + hash", () => {
207
+ delete window.location;
208
+ window.location = { hash: "#nav=pic" };
209
+ const v = { addEventListener: jest.fn() };
210
+ const uh = new URLHandler(v);
211
+ expect(uh.currentURLParams(true)).toStrictEqual({"nav": "pic"});
212
+ });
213
+
214
+ it("works with multiple params + hash", () => {
215
+ delete window.location;
216
+ window.location = { hash: "#nav=pic&speed=42" };
185
217
  const v = { addEventListener: jest.fn() };
186
218
  const uh = new URLHandler(v);
187
- expect(uh.currentURLParams()).toStrictEqual({"a": "b"});
219
+ expect(uh.currentURLParams(true)).toStrictEqual({"nav": "pic", "speed": "42"});
188
220
  });
189
221
 
190
- it("works with multiple params", () => {
222
+ it("works with search + hash", () => {
191
223
  delete window.location;
192
- window.location = { search: "?a=b&c=d" };
224
+ window.location = { hash: "#nav=pic&speed=42", search: "?pic=bla" };
193
225
  const v = { addEventListener: jest.fn() };
194
226
  const uh = new URLHandler(v);
195
- expect(uh.currentURLParams()).toStrictEqual({"a": "b", "c": "d"});
227
+ expect(uh.currentURLParams()).toStrictEqual({"pic": "bla"});
228
+ expect(uh.currentURLParams(true)).toStrictEqual({"nav": "pic", "speed": "42"});
229
+ });
230
+
231
+ it("skips unmanaged parameters", () => {
232
+ delete window.location;
233
+ window.location = { search: "?a=b" };
234
+ const v = { addEventListener: jest.fn() };
235
+ const uh = new URLHandler(v);
236
+ expect(uh.currentURLParams()).toStrictEqual({});
196
237
  });
197
238
  });
198
239
 
@@ -295,7 +336,7 @@ describe("_onParentChange", () => {
295
336
  delete window.location;
296
337
 
297
338
  window.history = { replaceState: jest.fn(), state: {} };
298
- window.location = { href: "http://localhost:5000/?nav=pic&speed=2", search: "?nav=pic&speed=2" };
339
+ window.location = { href: "http://localhost:5000/?nav=pic&speed=2", search: "?nav=pic&speed=2", hash: "" };
299
340
 
300
341
  const v = { addEventListener: jest.fn() };
301
342
  const uh = new URLHandler(v);
@@ -314,7 +355,7 @@ describe("_onParentChange", () => {
314
355
  delete window.location;
315
356
 
316
357
  window.history = { pushState: jest.fn(), state: {} };
317
- window.location = { href: "http://localhost:5000/?pic=bla", search: "?pic=bla" };
358
+ window.location = { href: "http://localhost:5000/?pic=bla", search: "?pic=bla", hash: "" };
318
359
 
319
360
  const v = { addEventListener: jest.fn() };
320
361
  const uh = new URLHandler(v);
@@ -333,7 +374,7 @@ describe("_onParentChange", () => {
333
374
  delete window.location;
334
375
 
335
376
  window.history = { replaceState: jest.fn(), state: {} };
336
- window.location = { href: "http://localhost:5000/?speed=1&nav=seq", search: "?speed=1&nav=seq" };
377
+ window.location = { href: "http://localhost:5000/?speed=1&nav=seq", search: "?speed=1&nav=seq", hash: "" };
337
378
 
338
379
  const v = { addEventListener: jest.fn() };
339
380
  const uh = new URLHandler(v);
Binary file