authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 22:33:29-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 22:33:29-07:00
logf1e84c28fe5982ecb507f4c934acf7a1a7b253b7
tree82f347c841c0fb9c9e2be48175c604d9760925fd
parent420fd76f60433fe05b8d2c76f4fbde430dc49968
signature Signed by PGP key B5690EEEBB952194

test(web): keep settings viewport comparison private (#10307)


2 files changed, 1 insertions(+), 24 deletions(-)

apps/web/src/components/settings/SettingsPanels.logic.test.ts-23
...@@ -14,7 +14,6 @@ import {...@@ -14,7 +14,6 @@ import {
14 formatDiagnosticsDescription,14 formatDiagnosticsDescription,
15 getChangedBrowserSettingLabels,15 getChangedBrowserSettingLabels,
16 getChangedTypographySettingLabels,16 getChangedTypographySettingLabels,
17 isSamePreviewViewport,
18 hasChangedBackgroundActivitySettings,17 hasChangedBackgroundActivitySettings,
19 isProjectGroupingEnabled,18 isProjectGroupingEnabled,
20 projectGroupingModeFromToggle,19 projectGroupingModeFromToggle,
...@@ -282,25 +281,3 @@ describe("getChangedBrowserSettingLabels", () => {...@@ -282,25 +281,3 @@ describe("getChangedBrowserSettingLabels", () => {
282 ]);281 ]);
283 });282 });
284});283});
285
286describe("isSamePreviewViewport", () => {
287 it("separates presets that share a size", () => {
288 // Two presets can agree on width and height and still be different
289 // entries in the picker, so the id has to take part in the comparison.
290 expect(
291 isSamePreviewViewport(
292 { _tag: "preset", width: 390, height: 844, presetId: "iphone-12-pro" },
293 { _tag: "preset", width: 390, height: 844, presetId: "ipad-mini" },
294 ),
295 ).toBe(false);
296 });
297
298 it("separates a freeform viewport from a preset of the same size", () => {
299 expect(
300 isSamePreviewViewport(
301 { _tag: "freeform", width: 390, height: 844 },
302 { _tag: "preset", width: 390, height: 844, presetId: "iphone-12-pro" },
303 ),
304 ).toBe(false);
305 });
306});
apps/web/src/components/settings/SettingsPanels.logic.ts+1-1
...@@ -126,7 +126,7 @@ export type BrowserDefaultSettings = Pick<...@@ -126,7 +126,7 @@ export type BrowserDefaultSettings = Pick<
126 * reports every stored viewport as changed — including one that matches the126 * reports every stored viewport as changed — including one that matches the
127 * default.127 * default.
128 */128 */
129export function isSamePreviewViewport(129function isSamePreviewViewport(
130 left: PreviewViewportSetting,130 left: PreviewViewportSetting,
131 right: PreviewViewportSetting,131 right: PreviewViewportSetting,
132): boolean {132): boolean {