Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 1 addition & 12 deletions apps/web/src/browser/BrowserDeviceToolbar.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { PreviewViewportSetting } from "@t3tools/contracts";
import { describe, expect, it, vi } from "vite-plus/test";

import {
commitViewportAndAspectRatio,
reconcileLockedAspectRatio,
} from "./browserDeviceToolbarState";
import { commitViewportAndAspectRatio } from "./browserDeviceToolbarState";

describe("commitViewportAndAspectRatio", () => {
it("commits the aspect ratio only after the viewport succeeds", async () => {
Expand Down Expand Up @@ -39,11 +36,3 @@ describe("commitViewportAndAspectRatio", () => {
expect(onAspectRatioChange).not.toHaveBeenCalled();
});
});

describe("reconcileLockedAspectRatio", () => {
it("tracks external viewport ratios only while the lock remains active", () => {
expect(reconcileLockedAspectRatio(1.5, 16 / 9)).toBe(16 / 9);
expect(reconcileLockedAspectRatio(null, 16 / 9)).toBeNull();
expect(reconcileLockedAspectRatio(1.5, null)).toBeNull();
});
});
7 changes: 0 additions & 7 deletions apps/web/src/browser/browserDeviceToolbarState.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
import type { PreviewViewportSetting } from "@t3tools/contracts";

export function reconcileLockedAspectRatio(
current: number | null,
viewportAspectRatio: number | null,
): number | null {
return current === null || viewportAspectRatio === null ? null : viewportAspectRatio;
}

export async function commitViewportAndAspectRatio(
setting: PreviewViewportSetting,
aspectRatio: number | null,
Expand Down
Loading