@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.
- package/CHANGELOG.md +1 -1
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/config/jest/mocks.js +21 -2
- package/docs/reference/components/core/Basic.md +28 -0
- package/docs/reference/components/core/CoverageMap.md +28 -0
- package/docs/reference/components/core/Editor.md +28 -0
- package/docs/reference/components/core/PhotoViewer.md +29 -0
- package/docs/reference/components/core/Viewer.md +28 -0
- package/docs/tutorials/migrate_v4.md +14 -1
- package/docs/tutorials/synced_coverage.md +1 -0
- package/package.json +1 -1
- package/scripts/doc.js +3 -1
- package/src/components/core/Basic.js +55 -0
- package/src/components/core/CoverageMap.js +6 -0
- package/src/components/core/Editor.js +4 -0
- package/src/components/core/PhotoViewer.js +21 -0
- package/src/components/core/Viewer.js +4 -0
- package/src/utils/PhotoAdapter.js +1 -0
- package/src/utils/URLHandler.js +1 -5
- package/tests/components/core/Basic.test.js +130 -0
- package/tests/components/core/BasicMock.js +20 -0
- package/tests/components/core/CoverageMap.test.js +20 -0
- package/tests/components/core/Editor.test.js +20 -0
- package/tests/components/core/PhotoViewer.test.js +20 -0
- package/tests/components/core/Viewer.test.js +20 -0
- package/tests/components/ui/CopyButton.test.js +1 -1
- package/tests/components/ui/Loader.test.js +1 -0
- package/tests/components/ui/Popup.test.js +2 -0
- package/tests/components/ui/QualityScore.test.js +1 -0
- package/tests/components/ui/SearchBar.test.js +3 -0
- 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.
|
|
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("");
|