Skip to content

Commit 3ab68ac

Browse files
committed
test: 💍 added the test cases drafts
1 parent 4afb583 commit 3ab68ac

20 files changed

Lines changed: 514 additions & 10 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
describe("Base [Interactions]", () => {
2+
describe("When clicking in nested button", () => {
3+
it("should allow to trigger button callback", async () => {
4+
// TODO: Implement test
5+
expect(true).toBe(true);
6+
});
7+
});
8+
});
Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,54 @@
11
import { renderApp } from "../../utils/render-app";
22

3-
describe("Example view", () => {
3+
describe("Base [Rendering]", () => {
44
describe("When example view has been rendered", () => {
5-
test("it renders entire example without errors", () => {
5+
it("should render entire example without errors", () => {
66
const { wrapper } = renderApp();
77

88
expect(wrapper).toBeDefined();
99
});
10-
test("it renders center in button without errors", () => {
10+
it("should render center in button without errors", () => {
1111
const { centerBtn } = renderApp();
1212

1313
expect(centerBtn).toBeDefined();
1414
});
15-
test("it renders zoom in button without errors", () => {
15+
it("should render zoom in button without errors", () => {
1616
const { zoomInBtn } = renderApp();
1717

1818
expect(zoomInBtn).toBeDefined();
1919
});
20-
test("it renders zoom out button without errors", () => {
20+
it("should render zoom out button without errors", () => {
2121
const { zoomOutBtn } = renderApp();
2222

2323
expect(zoomOutBtn).toBeDefined();
2424
});
25-
test("it renders reset button without errors", () => {
25+
it("should render reset button without errors", () => {
2626
const { resetBtn } = renderApp();
2727

2828
expect(resetBtn).toBeDefined();
2929
});
30-
test("it renders transform component without errors", () => {
30+
it("should render transform component without errors", () => {
3131
const { content } = renderApp();
3232

3333
expect(content).toBeDefined();
3434
});
3535
});
36+
describe("When example view has been rendered", () => {
37+
it("should render with initial scale", async () => {
38+
// TODO: Implement test
39+
expect(true).toBe(true);
40+
});
41+
it("should render with limit initial scale to minScale", async () => {
42+
// TODO: Implement test
43+
expect(true).toBe(true);
44+
});
45+
it("should render with limit initial scale to maxScale", async () => {
46+
// TODO: Implement test
47+
expect(true).toBe(true);
48+
});
49+
it("should center on initialization", async () => {
50+
// TODO: Implement test
51+
expect(true).toBe(true);
52+
});
53+
});
3654
});
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
describe("Pan Touch [Sizes]", () => {
2+
describe("When content is bigger than wrapper", () => {
3+
it("should allow panning to the bottom-right end without moving back", async () => {
4+
// TODO: Implement test
5+
expect(true).toBe(true);
6+
});
7+
it("should allow panning with velocity", async () => {
8+
// TODO: Implement test
9+
expect(true).toBe(true);
10+
});
11+
});
12+
describe("When content is smaller than wrapper", () => {
13+
it("should not allow for panning", async () => {
14+
// TODO: Implement test
15+
expect(true).toBe(true);
16+
});
17+
it("should return to original position", async () => {
18+
// TODO: Implement test
19+
expect(true).toBe(true);
20+
});
21+
});
22+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
describe("Pan Touch [Exclusion]", () => {
2+
describe("When excluding element", () => {
3+
it("should not allow for panning on excluded element", async () => {
4+
// TODO: Implement test
5+
expect(true).toBe(true);
6+
});
7+
it("should allow panning on other elements", async () => {
8+
// TODO: Implement test
9+
expect(true).toBe(true);
10+
});
11+
});
12+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
describe("Pan TrackPad [Exclusion]", () => {
2+
describe("When excluding element", () => {
3+
it("should not allow for panning on excluded element", async () => {
4+
// TODO: Implement test
5+
expect(true).toBe(true);
6+
});
7+
it("should allow panning on other elements", async () => {
8+
// TODO: Implement test
9+
expect(true).toBe(true);
10+
});
11+
});
12+
});
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
describe("Pan [Clicks]", () => {
2+
describe("When allowing for left click pan", () => {
3+
it("should allow for panning with left click", async () => {
4+
// TODO: Implement test
5+
expect(true).toBe(true);
6+
});
7+
it("should not allow for panning with other clicks", async () => {
8+
// TODO: Implement test
9+
expect(true).toBe(true);
10+
});
11+
});
12+
describe("When allowing for middle click pan", () => {
13+
it("should allow for panning with middle click", async () => {
14+
// TODO: Implement test
15+
expect(true).toBe(true);
16+
});
17+
it("should not allow for panning with other clicks", async () => {
18+
// TODO: Implement test
19+
expect(true).toBe(true);
20+
});
21+
});
22+
describe("When allowing for right click pan", () => {
23+
it("should allow for panning with right click", async () => {
24+
// TODO: Implement test
25+
expect(true).toBe(true);
26+
});
27+
it("should not allow for panning with other clicks", async () => {
28+
// TODO: Implement test
29+
expect(true).toBe(true);
30+
});
31+
});
32+
describe("When allowing panning with any click", () => {
33+
it("should allow for panning with left click", async () => {
34+
// TODO: Implement test
35+
expect(true).toBe(true);
36+
});
37+
it("should allow for panning with middle click", async () => {
38+
// TODO: Implement test
39+
expect(true).toBe(true);
40+
});
41+
it("should allow for panning with right click", async () => {
42+
// TODO: Implement test
43+
expect(true).toBe(true);
44+
});
45+
});
46+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
describe("Pan [Exclusion]", () => {
2+
describe("When excluding element", () => {
3+
it("should not allow for panning on excluded element", async () => {
4+
// TODO: Implement test
5+
expect(true).toBe(true);
6+
});
7+
it("should allow panning on other elements", async () => {
8+
// TODO: Implement test
9+
expect(true).toBe(true);
10+
});
11+
});
12+
});
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
describe("Pan [Sizes]", () => {
2+
describe("When content is bigger than wrapper", () => {
3+
it("should allow panning to the bottom-right end without moving back", async () => {
4+
// TODO: Implement test
5+
expect(true).toBe(true);
6+
});
7+
it("should allow panning with velocity", async () => {
8+
// TODO: Implement test
9+
expect(true).toBe(true);
10+
});
11+
it("should not allow to move beyond bounds", async () => {
12+
// TODO: Implement test
13+
expect(true).toBe(true);
14+
});
15+
});
16+
describe("When content is smaller than wrapper", () => {
17+
it("should not allow for panning with centering", async () => {
18+
// TODO: Implement test
19+
expect(true).toBe(true);
20+
});
21+
it("should allow to move content around the wrapper body", async () => {
22+
// TODO: Implement test
23+
expect(true).toBe(true);
24+
});
25+
it("should not allow to move beyond bounds", async () => {
26+
// TODO: Implement test
27+
expect(true).toBe(true);
28+
});
29+
});
30+
});

__tests__/features/pinch/pinch.base.spec.tsx

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import { waitFor } from "@testing-library/dom";
33
import { renderApp } from "../../utils/render-app";
44

55
describe("Pinch [Base]", () => {
6-
describe("When pinch zooming", () => {
7-
it("should increase transform scale", async () => {
6+
describe("When content is the same size as wrapper", () => {
7+
it("should change transform scale", async () => {
88
const { ref, content, pinch } = renderApp();
99
expect(content.style.transform).toBe("translate(0px, 0px) scale(1)");
1010
pinch({ value: 1.5 });
@@ -13,5 +13,39 @@ describe("Pinch [Base]", () => {
1313
expect(ref.current?.instance.state.scale).toBe(1.5);
1414
});
1515
});
16+
it("should zoom to the position of midpoint", async () => {
17+
// TODO: Implement test
18+
expect(true).toBe(true);
19+
});
20+
it("should zoom out from position of midpoint", async () => {
21+
// TODO: Implement test
22+
expect(true).toBe(true);
23+
});
24+
it("should return to bounds after zooming out", async () => {
25+
// TODO: Implement test
26+
expect(true).toBe(true);
27+
});
28+
});
29+
describe("When content bigger than wrapper", () => {
30+
it("should center the content", async () => {
31+
// TODO: Implement test
32+
expect(true).toBe(true);
33+
});
34+
it("should change transform scale", async () => {
35+
// TODO: Implement test
36+
expect(true).toBe(true);
37+
});
38+
it("should zoom to the position of midpoint", async () => {
39+
// TODO: Implement test
40+
expect(true).toBe(true);
41+
});
42+
it("should zoom out from position of midpoint", async () => {
43+
// TODO: Implement test
44+
expect(true).toBe(true);
45+
});
46+
it("should return to bounds after zooming out", async () => {
47+
// TODO: Implement test
48+
expect(true).toBe(true);
49+
});
1650
});
1751
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
describe("Pinch [Exclusion]", () => {
2+
describe("When excluding element", () => {
3+
it("should not allow for pinching on excluded element", async () => {
4+
// TODO: Implement test
5+
expect(true).toBe(true);
6+
});
7+
it("should allow pinching on other elements", async () => {
8+
// TODO: Implement test
9+
expect(true).toBe(true);
10+
});
11+
});
12+
});

0 commit comments

Comments
 (0)