@@ -5,7 +5,7 @@ import { sidebarToggleCommand } from "@/shell/shell"
55import { previousSessionCommand , nextSessionCommand } from "@/shell/titlebar/tab-strip"
66import { goBackCommand , goForwardCommand , newTabCommand } from "@/shell/titlebar/titlebar"
77import { exportLogsCommand } from "./desktop"
8- import { DESKTOP_MENU } from "./desktop-menu"
8+ import { DESKTOP_MENU , nextDesktopZoomLevel } from "./desktop-menu"
99
1010test ( "every desktop menu command is one its owner registers" , ( ) => {
1111 const registered = new Set ( [
@@ -27,3 +27,20 @@ test("every desktop menu command is one its owner registers", () => {
2727
2828 expect ( commands . filter ( ( command ) => ! registered . has ( command ) ) ) . toEqual ( [ ] )
2929} )
30+
31+ test . each ( [
32+ { factor : 1 , direction : "in" , level : 1.1 } ,
33+ { factor : 1.25 , direction : "out" , level : 1.1 } ,
34+ // A factor read back from Chromium sits a hair off the level it was set to.
35+ { factor : 1.0999999 , direction : "in" , level : 1.25 } ,
36+ { factor : 1.1000001 , direction : "out" , level : 1 } ,
37+ // A pinch leaves the factor between levels, or outside them.
38+ { factor : 1.3 , direction : "in" , level : 1.5 } ,
39+ { factor : 1.3 , direction : "out" , level : 1.25 } ,
40+ { factor : 0.5 , direction : "out" , level : 1 } ,
41+ { factor : 3 , direction : "in" , level : 2 } ,
42+ { factor : 2 , direction : "in" , level : 2 } ,
43+ { factor : 1 , direction : "out" , level : 1 } ,
44+ ] as const ) ( "zooming $direction from $factor lands on $level" , ( { factor, direction, level } ) => {
45+ expect ( nextDesktopZoomLevel ( factor , direction ) ) . toBe ( level )
46+ } )
0 commit comments