Skip to content

Commit 8a74383

Browse files
committed
test: 💍 base size tests
1 parent 91102a6 commit 8a74383

File tree

1 file changed

+46
-2
lines changed

1 file changed

+46
-2
lines changed

__tests__/features/pan/pan.sizes.spec.tsx

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
1+
import { renderApp } from "../../utils";
2+
13
describe("Pan [Sizes]", () => {
24
describe("When content is bigger than wrapper", () => {
35
it("should allow panning to the bottom-right end without moving back", async () => {
4-
// TODO: Implement test
5-
expect(true).toBe(true);
6+
const { content, pan } = renderApp({
7+
wrapperWidth: "100px",
8+
wrapperHeight: "100px",
9+
contentWidth: "200px",
10+
contentHeight: "200px",
11+
disablePadding: true,
12+
});
13+
14+
pan({ x: 150, y: 150 });
15+
expect(content.style.transform).toBe("translate(100px, 100px) scale(1)");
616
});
717
it("should allow panning with velocity", async () => {
818
// TODO: Implement test
@@ -14,6 +24,18 @@ describe("Pan [Sizes]", () => {
1424
});
1525
});
1626
describe("When content is smaller than wrapper", () => {
27+
it("should not allow for panning", async () => {
28+
const { content, pan } = renderApp({
29+
wrapperWidth: "100px",
30+
wrapperHeight: "100px",
31+
contentWidth: "50px",
32+
contentHeight: "50px",
33+
disablePadding: true,
34+
});
35+
36+
pan({ x: 150, y: 150 });
37+
expect(content.style.transform).toBe("translate(0px, 0px) scale(1)");
38+
});
1739
it("should not allow for panning with centering", async () => {
1840
// TODO: Implement test
1941
expect(true).toBe(true);
@@ -27,4 +49,26 @@ describe("Pan [Sizes]", () => {
2749
expect(true).toBe(true);
2850
});
2951
});
52+
describe("When content is equal to wrapper", () => {
53+
it("should not allow for panning", async () => {
54+
const { content, pan } = renderApp({
55+
wrapperWidth: "100px",
56+
wrapperHeight: "100px",
57+
contentWidth: "100px",
58+
contentHeight: "100px",
59+
disablePadding: true,
60+
});
61+
62+
pan({ x: 150, y: 150 });
63+
expect(content.style.transform).toBe("translate(0px, 0px) scale(1)");
64+
});
65+
it("should allow to move content around the wrapper body", async () => {
66+
// TODO: Implement test
67+
expect(true).toBe(true);
68+
});
69+
it("should not allow to move beyond bounds", async () => {
70+
// TODO: Implement test
71+
expect(true).toBe(true);
72+
});
73+
});
3074
});

0 commit comments

Comments
 (0)