@@ -33,7 +33,13 @@ function params(overrides: Partial<Params> = {}): Params {
3333
3434function page ( overrides : Partial < Page > = { } ) : Page {
3535 // A fresh tab sits at the panel's baseline, which the menu reports as 100%.
36- return { canGoBack : true , canGoForward : true , zoomFactor : BASE_ZOOM_FACTOR , ...overrides }
36+ return {
37+ canGoBack : true ,
38+ canGoForward : true ,
39+ zoomFactor : BASE_ZOOM_FACTOR ,
40+ defaultZoomFactor : BASE_ZOOM_FACTOR ,
41+ ...overrides ,
42+ }
3743}
3844
3945function handlers ( ) : Handlers {
@@ -67,7 +73,7 @@ describe('buildAgentContextMenuTemplate', () => {
6773 'Reload' ,
6874 'Zoom In' ,
6975 'Zoom Out' ,
70- 'Actual Size (100%)' ,
76+ 'Reset Zoom (100%)' ,
7177 ] )
7278 } )
7379
@@ -137,7 +143,7 @@ describe('buildAgentContextMenuTemplate', () => {
137143 // against Chromium's native scale (where this factor would read 110%).
138144 const twoUp = steppedZoomFactor ( steppedZoomFactor ( BASE_ZOOM_FACTOR , 1 ) , 1 )
139145 const stepped = buildAgentContextMenuTemplate ( params ( ) , page ( { zoomFactor : twoUp } ) , handlers ( ) )
140- expect ( item ( stepped , 'Actual Size (121%)' ) ?. enabled ) . toBe ( true )
146+ expect ( item ( stepped , 'Reset Zoom (121%)' ) ?. enabled ) . toBe ( true )
141147
142148 const atMax = buildAgentContextMenuTemplate ( params ( ) , page ( { zoomFactor : 3 } ) , handlers ( ) )
143149 expect ( item ( atMax , 'Zoom In' ) ?. enabled ) . toBe ( false )
@@ -148,21 +154,26 @@ describe('buildAgentContextMenuTemplate', () => {
148154
149155 // Nothing to reset to at 100%.
150156 expect (
151- item ( buildAgentContextMenuTemplate ( params ( ) , page ( ) , handlers ( ) ) , 'Actual Size (100%)' )
157+ item ( buildAgentContextMenuTemplate ( params ( ) , page ( ) , handlers ( ) ) , 'Reset Zoom (100%)' )
152158 ?. enabled
153159 ) . toBe ( false )
154160 } )
155161
156- it ( 'resets to exactly the baseline , undoing accumulated drift' , ( ) => {
162+ it ( 'resets to the configured default , undoing accumulated drift' , ( ) => {
157163 const handled = handlers ( )
158164 // Three rungs of float multiplication up, so the factor no longer sits on a
159165 // clean value — reset has to restore the baseline exactly, not step back.
160166 const drifted = [ 1 , 1 , 1 ] . reduce ( ( factor ) => steppedZoomFactor ( factor , 1 ) , BASE_ZOOM_FACTOR )
161- const template = buildAgentContextMenuTemplate ( params ( ) , page ( { zoomFactor : drifted } ) , handled )
167+ const configuredDefault = BASE_ZOOM_FACTOR * 1.25
168+ const template = buildAgentContextMenuTemplate (
169+ params ( ) ,
170+ page ( { zoomFactor : drifted , defaultZoomFactor : configuredDefault } ) ,
171+ handled
172+ )
162173
163- item ( template , 'Actual Size (133%)' ) ?. click ?.( { } as never , undefined as never , { } as never )
174+ item ( template , 'Reset Zoom (133%)' ) ?. click ?.( { } as never , undefined as never , { } as never )
164175
165- expect ( handled . setZoomFactor ) . toHaveBeenCalledWith ( BASE_ZOOM_FACTOR )
176+ expect ( handled . setZoomFactor ) . toHaveBeenCalledWith ( configuredDefault )
166177 } )
167178
168179 it ( 'never leaves a separator with nothing above it' , ( ) => {
@@ -190,7 +201,10 @@ describe('attachAgentContextMenu', () => {
190201 it ( 'pops a menu built from the page that was right-clicked' , ( ) => {
191202 const contents = new WebContentsView ( ) . webContents
192203 vi . mocked ( contents . navigationHistory . canGoBack ) . mockReturnValue ( true )
193- attachAgentContextMenu ( contents , { openTab : vi . fn ( ) } )
204+ attachAgentContextMenu ( contents , {
205+ openTab : vi . fn ( ) ,
206+ defaultZoomFactor : ( ) => BASE_ZOOM_FACTOR ,
207+ } )
194208
195209 const listeners = vi . mocked ( contents . on ) . mock . calls as unknown as [
196210 string ,
0 commit comments