Skip to content

Commit

Permalink
test: 💍 added the test cases drafts
Browse files Browse the repository at this point in the history
  • Loading branch information
prc5 committed Jun 28, 2024
1 parent 4afb583 commit 3ab68ac
Show file tree
Hide file tree
Showing 20 changed files with 514 additions and 10 deletions.
8 changes: 8 additions & 0 deletions __tests__/features/base/interactions.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
describe("Base [Interactions]", () => {
describe("When clicking in nested button", () => {
it("should allow to trigger button callback", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
32 changes: 25 additions & 7 deletions __tests__/features/base/rendering.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
import { renderApp } from "../../utils/render-app";

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

expect(wrapper).toBeDefined();
});
test("it renders center in button without errors", () => {
it("should render center in button without errors", () => {
const { centerBtn } = renderApp();

expect(centerBtn).toBeDefined();
});
test("it renders zoom in button without errors", () => {
it("should render zoom in button without errors", () => {
const { zoomInBtn } = renderApp();

expect(zoomInBtn).toBeDefined();
});
test("it renders zoom out button without errors", () => {
it("should render zoom out button without errors", () => {
const { zoomOutBtn } = renderApp();

expect(zoomOutBtn).toBeDefined();
});
test("it renders reset button without errors", () => {
it("should render reset button without errors", () => {
const { resetBtn } = renderApp();

expect(resetBtn).toBeDefined();
});
test("it renders transform component without errors", () => {
it("should render transform component without errors", () => {
const { content } = renderApp();

expect(content).toBeDefined();
});
});
describe("When example view has been rendered", () => {
it("should render with initial scale", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should render with limit initial scale to minScale", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should render with limit initial scale to maxScale", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should center on initialization", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
22 changes: 22 additions & 0 deletions __tests__/features/pan-touch/pan-touch.sizes.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
describe("Pan Touch [Sizes]", () => {
describe("When content is bigger than wrapper", () => {
it("should allow panning to the bottom-right end without moving back", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow panning with velocity", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
describe("When content is smaller than wrapper", () => {
it("should not allow for panning", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should return to original position", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
12 changes: 12 additions & 0 deletions __tests__/features/pan-touch/pan.exclusion.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe("Pan Touch [Exclusion]", () => {
describe("When excluding element", () => {
it("should not allow for panning on excluded element", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow panning on other elements", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
12 changes: 12 additions & 0 deletions __tests__/features/pan-track-pad/pan.exclusion.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe("Pan TrackPad [Exclusion]", () => {
describe("When excluding element", () => {
it("should not allow for panning on excluded element", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow panning on other elements", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
46 changes: 46 additions & 0 deletions __tests__/features/pan/pan.clicks.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
describe("Pan [Clicks]", () => {
describe("When allowing for left click pan", () => {
it("should allow for panning with left click", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should not allow for panning with other clicks", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
describe("When allowing for middle click pan", () => {
it("should allow for panning with middle click", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should not allow for panning with other clicks", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
describe("When allowing for right click pan", () => {
it("should allow for panning with right click", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should not allow for panning with other clicks", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
describe("When allowing panning with any click", () => {
it("should allow for panning with left click", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow for panning with middle click", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow for panning with right click", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
12 changes: 12 additions & 0 deletions __tests__/features/pan/pan.exclusion.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe("Pan [Exclusion]", () => {
describe("When excluding element", () => {
it("should not allow for panning on excluded element", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow panning on other elements", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
30 changes: 30 additions & 0 deletions __tests__/features/pan/pan.sizes.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
describe("Pan [Sizes]", () => {
describe("When content is bigger than wrapper", () => {
it("should allow panning to the bottom-right end without moving back", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow panning with velocity", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should not allow to move beyond bounds", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
describe("When content is smaller than wrapper", () => {
it("should not allow for panning with centering", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow to move content around the wrapper body", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should not allow to move beyond bounds", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
38 changes: 36 additions & 2 deletions __tests__/features/pinch/pinch.base.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { waitFor } from "@testing-library/dom";
import { renderApp } from "../../utils/render-app";

describe("Pinch [Base]", () => {
describe("When pinch zooming", () => {
it("should increase transform scale", async () => {
describe("When content is the same size as wrapper", () => {
it("should change transform scale", async () => {
const { ref, content, pinch } = renderApp();
expect(content.style.transform).toBe("translate(0px, 0px) scale(1)");
pinch({ value: 1.5 });
Expand All @@ -13,5 +13,39 @@ describe("Pinch [Base]", () => {
expect(ref.current?.instance.state.scale).toBe(1.5);
});
});
it("should zoom to the position of midpoint", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should zoom out from position of midpoint", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should return to bounds after zooming out", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
describe("When content bigger than wrapper", () => {
it("should center the content", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should change transform scale", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should zoom to the position of midpoint", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should zoom out from position of midpoint", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should return to bounds after zooming out", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
12 changes: 12 additions & 0 deletions __tests__/features/pinch/pinch.exclusion.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
describe("Pinch [Exclusion]", () => {
describe("When excluding element", () => {
it("should not allow for pinching on excluded element", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should allow pinching on other elements", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
70 changes: 70 additions & 0 deletions __tests__/features/positions/positions.base.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
describe("Positions [Base]", () => {
describe("When content is bigger than wrapper", () => {
describe("When rendering initially original size content", () => {
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});

describe("When zoomed in content", () => {
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});

describe("When zoomed out content", () => {
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
describe("When content is smaller than wrapper", () => {
describe("When rendering initially original size content", () => {
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});

describe("When zoomed in content", () => {
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});

describe("When zoomed out content", () => {
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should ...", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
});
18 changes: 18 additions & 0 deletions __tests__/features/positions/positions.centering.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
describe("Positions [Centering]", () => {
describe("When rendering initially zoomed out content", () => {
it("should center the content with prop X", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
it("should not center the content with prop X disabled", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
describe("When rendering initially zoomed in content", () => {
it("should not center the content with prop X", async () => {
// TODO: Implement test
expect(true).toBe(true);
});
});
});
Loading

0 comments on commit 3ab68ac

Please sign in to comment.