@panoramax/web-viewer 3.2.3-develop-3ea5b063 → 3.2.3-develop-83778bdd

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +1 -1
  2. package/build/index.js +2 -2
  3. package/build/index.js.map +1 -1
  4. package/config/jest/mocks.js +21 -2
  5. package/docs/reference/components/core/Basic.md +28 -0
  6. package/docs/reference/components/core/CoverageMap.md +28 -0
  7. package/docs/reference/components/core/Editor.md +28 -0
  8. package/docs/reference/components/core/PhotoViewer.md +29 -0
  9. package/docs/reference/components/core/Viewer.md +28 -0
  10. package/docs/tutorials/migrate_v4.md +14 -1
  11. package/docs/tutorials/synced_coverage.md +1 -0
  12. package/package.json +1 -1
  13. package/scripts/doc.js +3 -1
  14. package/src/components/core/Basic.js +55 -0
  15. package/src/components/core/CoverageMap.js +6 -0
  16. package/src/components/core/Editor.js +4 -0
  17. package/src/components/core/PhotoViewer.js +21 -0
  18. package/src/components/core/Viewer.js +4 -0
  19. package/src/utils/PhotoAdapter.js +1 -0
  20. package/src/utils/URLHandler.js +1 -5
  21. package/tests/components/core/Basic.test.js +130 -0
  22. package/tests/components/core/BasicMock.js +20 -0
  23. package/tests/components/core/CoverageMap.test.js +20 -0
  24. package/tests/components/core/Editor.test.js +20 -0
  25. package/tests/components/core/PhotoViewer.test.js +20 -0
  26. package/tests/components/core/Viewer.test.js +20 -0
  27. package/tests/components/ui/CopyButton.test.js +1 -1
  28. package/tests/components/ui/Loader.test.js +1 -0
  29. package/tests/components/ui/Popup.test.js +2 -0
  30. package/tests/components/ui/QualityScore.test.js +1 -0
  31. package/tests/components/ui/SearchBar.test.js +3 -0
  32. package/tests/components/ui/__snapshots__/CopyButton.test.js.snap +3 -4
@@ -0,0 +1,20 @@
1
+ import CoverageMap from "../../../src/components/core/CoverageMap";
2
+ import "./BasicMock";
3
+
4
+ let cm;
5
+ global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
6
+
7
+ beforeEach(() => cm = new CoverageMap());
8
+ afterEach(() => jest.clearAllMocks());
9
+
10
+ describe("getClassName", () => {
11
+ it("works", () => {
12
+ expect(cm.getClassName()).toBe("CoverageMap");
13
+ });
14
+ });
15
+
16
+ describe("getSubComponentsNames", () => {
17
+ it("works", () => {
18
+ expect(cm.getSubComponentsNames()).toEqual(["loader", "api", "map"]);
19
+ });
20
+ });
@@ -0,0 +1,20 @@
1
+ import Editor from "../../../src/components/core/Editor";
2
+ import "./BasicMock";
3
+
4
+ let comp;
5
+ global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
6
+
7
+ beforeEach(() => comp = new Editor());
8
+ afterEach(() => jest.clearAllMocks());
9
+
10
+ describe("getClassName", () => {
11
+ it("works", () => {
12
+ expect(comp.getClassName()).toBe("Editor");
13
+ });
14
+ });
15
+
16
+ describe("getSubComponentsNames", () => {
17
+ it("works", () => {
18
+ expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "map", "psv"]);
19
+ });
20
+ });
@@ -0,0 +1,20 @@
1
+ import PhotoViewer from "../../../src/components/core/PhotoViewer";
2
+ import "./BasicMock";
3
+
4
+ let comp;
5
+ global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
6
+
7
+ beforeEach(() => comp = new PhotoViewer());
8
+ afterEach(() => jest.clearAllMocks());
9
+
10
+ describe("getClassName", () => {
11
+ it("works", () => {
12
+ expect(comp.getClassName()).toBe("PhotoViewer");
13
+ });
14
+ });
15
+
16
+ describe("getSubComponentsNames", () => {
17
+ it("works", () => {
18
+ expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "psv", "grid", "popup", "urlHandler"]);
19
+ });
20
+ });
@@ -0,0 +1,20 @@
1
+ import Viewer from "../../../src/components/core/Viewer";
2
+ import "./BasicMock";
3
+
4
+ let comp;
5
+ global.console = { info: jest.fn(), error: jest.fn(), warn: jest.fn(), log: global.console.log };
6
+
7
+ beforeEach(() => comp = new Viewer());
8
+ afterEach(() => jest.clearAllMocks());
9
+
10
+ describe("getClassName", () => {
11
+ it("works", () => {
12
+ expect(comp.getClassName()).toBe("Viewer");
13
+ });
14
+ });
15
+
16
+ describe("getSubComponentsNames", () => {
17
+ it("works", () => {
18
+ expect(comp.getSubComponentsNames()).toEqual(["loader", "api", "psv", "grid", "popup", "urlHandler", "mini", "map"]);
19
+ });
20
+ });
@@ -5,7 +5,7 @@ window.navigator.clipboard = { writeText: jest.fn() };
5
5
  describe("constructor", () => {
6
6
  it("listens to click", () => {
7
7
  const cb = new CopyButton();
8
- expect(cb.addEventListener.mock.calls).toMatchSnapshot();
8
+ expect(cb._handlers).toMatchSnapshot();
9
9
  });
10
10
  });
11
11
 
@@ -44,6 +44,7 @@ describe("dismiss", () => {
44
44
  const p = { dispatchEvent: jest.fn(), _t: { pnx: {} } };
45
45
  const n = jest.fn();
46
46
  const l = new Loader();
47
+ l.addEventListener = jest.fn();
47
48
  l._parent = p;
48
49
  expect(() => l.dismiss(true, "an error", n)).toThrow(new Error("an error"))
49
50
 
@@ -4,6 +4,7 @@ describe("constructor", () => {
4
4
  it("works", () => {
5
5
  document.addEventListener = jest.fn();
6
6
  const p = new Popup();
7
+ p.addEventListener = jest.fn();
7
8
  expect(p.visible).toBe(false);
8
9
 
9
10
  p.connectedCallback();
@@ -15,6 +16,7 @@ describe("constructor", () => {
15
16
  describe("close", () => {
16
17
  it("works", () => {
17
18
  const p = new Popup();
19
+ p.dispatchEvent = jest.fn();
18
20
  p.visible = true;
19
21
  p.close();
20
22
 
@@ -3,6 +3,7 @@ import QualityScore from "../../../src/components/ui/QualityScore";
3
3
  describe("_onInput", () => {
4
4
  it("works", () => {
5
5
  const qs = new QualityScore();
6
+ qs.dispatchEvent = jest.fn();
6
7
  qs.renderRoot.querySelectorAll.mockReturnValueOnce([
7
8
  { value: 5, checked: false },
8
9
  { value: 4, checked: true },
@@ -37,6 +37,7 @@ describe("_onIconClick", () => {
37
37
  describe("_onResultClick", () => {
38
38
  it("works on classic", () => {
39
39
  const sb = new SearchBar();
40
+ sb.dispatchEvent = jest.fn();
40
41
  sb._onResultClick({title: "res1", subtitle: "sub1", data: "coucou"});
41
42
  expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
42
43
  expect(sb.value).toEqual("res1");
@@ -46,6 +47,7 @@ describe("_onResultClick", () => {
46
47
 
47
48
  it("works on reduced", () => {
48
49
  const sb = new SearchBar();
50
+ sb.dispatchEvent = jest.fn();
49
51
  sb.reduceable = true;
50
52
  sb._onResultClick({title: "res1", subtitle: "sub1", data: "coucou"});
51
53
  expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
@@ -57,6 +59,7 @@ describe("_onResultClick", () => {
57
59
 
58
60
  it("resets on null value", () => {
59
61
  const sb = new SearchBar();
62
+ sb.dispatchEvent = jest.fn();
60
63
  sb._onResultClick(null);
61
64
  expect(sb.dispatchEvent.mock.calls).toMatchSnapshot();
62
65
  expect(sb.value).toEqual("");
@@ -25,10 +25,9 @@ Array [
25
25
  `;
26
26
 
27
27
  exports[`constructor listens to click 1`] = `
28
- Array [
29
- Array [
30
- "click",
28
+ Object {
29
+ "click": Array [
31
30
  [Function],
32
31
  ],
33
- ]
32
+ }
34
33
  `;