@@ -52,7 +52,7 @@ const boundingClientSpy = jest.spyOn(navStickyElement, 'getBoundingClientRect')
5252
5353document . body . appendChild ( navStickyElement ) ;
5454
55- const maxWidth = 500 ; // 50 % of the innerWidth, as per the default maxWidth on large
55+ const maxWidth = 400 ; // 40 % of the innerWidth, as per the default maxWidth on large
5656let slotProps = { } ;
5757
5858const createWrapper = opts => shallowMount ( AdjustableSidebarWidth , {
@@ -141,9 +141,9 @@ describe('AdjustableSidebarWidth', () => {
141141 } ) ;
142142
143143 it ( 'sets the `width` to the last stored value' , ( ) => {
144- storage . get . mockReturnValueOnce ( 450 ) ;
144+ storage . get . mockReturnValueOnce ( 350 ) ;
145145 const wrapper = createWrapper ( ) ;
146- assertWidth ( wrapper , 450 ) ;
146+ assertWidth ( wrapper , 350 ) ;
147147 // assert the storage was called with the key and the default size
148148 // 350 is half of min and max on Large
149149 expect ( storage . get ) . toHaveBeenLastCalledWith ( STORAGE_KEY , LARGE_DEFAULT_WIDTH ) ;
@@ -158,7 +158,7 @@ describe('AdjustableSidebarWidth', () => {
158158 it ( 'sets the `width` to the `min` width allowed, if stored value is smaller' , ( ) => {
159159 storage . get . mockReturnValueOnce ( 100 ) ;
160160 const wrapper = createWrapper ( ) ;
161- assertWidth ( wrapper , 200 ) ; // 20 % of 1000
161+ assertWidth ( wrapper , 300 ) ; // 30 % of 1000
162162 } ) ;
163163
164164 it ( 'sets the `width` to the `ULTRA_WIDE_DEFAULT`, if no stored value, and on a very large monitor' , ( ) => {
@@ -311,11 +311,11 @@ describe('AdjustableSidebarWidth', () => {
311311 window . innerWidth = 500 ;
312312 window . dispatchEvent ( createEvent ( 'orientationchange' ) ) ;
313313 await flushPromises ( ) ;
314- assertWidth ( wrapper , 250 ) ; // 50 % of 500, on large
314+ assertWidth ( wrapper , 200 ) ; // 40 % of 500, on large
315315 window . innerWidth = 1000 ;
316316 window . dispatchEvent ( createEvent ( 'orientationchange' ) ) ;
317317 await flushPromises ( ) ;
318- assertWidth ( wrapper , 250 ) ; // 20 % out of 1000, as that is the min percentage
318+ assertWidth ( wrapper , 300 ) ; // 30 % out of 1000, as that is the min percentage
319319 } ) ;
320320
321321 it ( 'changes the sidebar width, if outside the min/max on resize' , async ( ) => {
@@ -327,11 +327,11 @@ describe('AdjustableSidebarWidth', () => {
327327 window . innerWidth = 500 ;
328328 window . dispatchEvent ( createEvent ( 'resize' ) ) ;
329329 await flushPromises ( ) ;
330- assertWidth ( wrapper , 250 ) ; // 50 % of 500, on large
330+ assertWidth ( wrapper , 200 ) ; // 40 % of 500, on large
331331 window . innerWidth = 1000 ;
332332 window . dispatchEvent ( createEvent ( 'resize' ) ) ;
333333 await flushPromises ( ) ;
334- assertWidth ( wrapper , 250 ) ; // 20 % out of 1000, as that is the min percentage
334+ assertWidth ( wrapper , 300 ) ; // 30 % out of 1000, as that is the min percentage
335335 } ) ;
336336
337337 it ( 'stores the height of screen on orientationchange and resize' , async ( ) => {
@@ -370,8 +370,8 @@ describe('AdjustableSidebarWidth', () => {
370370 // assert drop
371371 document . dispatchEvent ( createEvent ( eventsMap . mouse . end ) ) ;
372372 // assert emit event
373- expect ( wrapper . emitted ( 'width-change' ) ) . toHaveLength ( 3 ) ;
374- expect ( wrapper . emitted ( 'width-change' ) [ 2 ] ) . toEqual ( [ maxWidth ] ) ;
373+ expect ( wrapper . emitted ( 'width-change' ) ) . toHaveLength ( 2 ) ;
374+ expect ( wrapper . emitted ( 'width-change' ) [ 1 ] ) . toEqual ( [ maxWidth ] ) ;
375375 // assert saved storage
376376 expect ( storage . set ) . toHaveBeenLastCalledWith ( STORAGE_KEY , maxWidth ) ;
377377 // assert drag stopped
@@ -408,8 +408,8 @@ describe('AdjustableSidebarWidth', () => {
408408 // assert drop
409409 document . dispatchEvent ( createEvent ( eventsMap . touch . end ) ) ;
410410 // assert emit event
411- expect ( wrapper . emitted ( 'width-change' ) ) . toHaveLength ( 3 ) ;
412- expect ( wrapper . emitted ( 'width-change' ) [ 2 ] ) . toEqual ( [ maxWidth ] ) ;
411+ expect ( wrapper . emitted ( 'width-change' ) ) . toHaveLength ( 2 ) ;
412+ expect ( wrapper . emitted ( 'width-change' ) [ 1 ] ) . toEqual ( [ maxWidth ] ) ;
413413 // assert saved storage
414414 expect ( storage . set ) . toHaveBeenLastCalledWith ( STORAGE_KEY , maxWidth ) ;
415415 // assert drag stopped
@@ -450,7 +450,7 @@ describe('AdjustableSidebarWidth', () => {
450450 } ) ) ;
451451 // assert class
452452 expect ( aside . classes ( ) ) . toContain ( 'dragging' ) ;
453- assertWidth ( wrapper , 960 ) ; // wrapper is no wider than 50 % of the widest possible, which is 1920
453+ assertWidth ( wrapper , 608 ) ; // wrapper is no wider than 40 % of the widest possible, which is 1920
454454 } ) ;
455455
456456 it ( 'prevents dragging below the `minWidth`' , ( ) => {
@@ -463,7 +463,7 @@ describe('AdjustableSidebarWidth', () => {
463463 } ) ) ;
464464 // assert class
465465 expect ( aside . classes ( ) ) . toContain ( 'dragging' ) ;
466- assertWidth ( wrapper , 200 ) ; // wrapper is minimum 20% of the screen (1000px)
466+ assertWidth ( wrapper , 300 ) ; // wrapper is minimum 20% of the screen (1000px)
467467 } ) ;
468468
469469 it ( 'force closes the nav, if dragging below the forceClose threshold' , ( ) => {
@@ -478,7 +478,7 @@ describe('AdjustableSidebarWidth', () => {
478478 } ) ) ;
479479 // assert class
480480 expect ( aside . classes ( ) ) . toContain ( 'dragging' ) ;
481- assertWidth ( wrapper , 200 ) ; // wrapper is minimum 20 % of the screen (1000px)
481+ assertWidth ( wrapper , 300 ) ; // wrapper is minimum 30 % of the screen (1000px)
482482 expect ( wrapper . emitted ( 'update:hiddenOnLarge' ) ) . toEqual ( [ [ true ] ] ) ;
483483 // simulate event is handled on parent
484484 wrapper . setProps ( {
@@ -488,7 +488,7 @@ describe('AdjustableSidebarWidth', () => {
488488 document . dispatchEvent ( createEvent ( eventsMap . mouse . move , {
489489 clientX : 350 ,
490490 } ) ) ;
491- assertWidth ( wrapper , 250 ) ;
491+ assertWidth ( wrapper , 300 ) ;
492492 expect ( wrapper . emitted ( 'update:hiddenOnLarge' ) ) . toEqual ( [ [ true ] , [ false ] ] ) ;
493493 expect ( aside . classes ( ) ) . toContain ( 'is-opening-on-large' ) ;
494494 } ) ;
@@ -523,7 +523,7 @@ describe('AdjustableSidebarWidth', () => {
523523 // assert class
524524 expect ( aside . classes ( ) ) . toContain ( 'dragging' ) ;
525525 // offset is 100, so we remove it from the clientX, but we add the scrollX.
526- assertWidth ( wrapper , 255 ) ;
526+ assertWidth ( wrapper , 300 ) ;
527527 // assert maxWidth
528528 document . dispatchEvent ( createEvent ( eventsMap . touch . move , {
529529 touches : [ {
@@ -638,7 +638,7 @@ describe('AdjustableSidebarWidth', () => {
638638 window . dispatchEvent ( createEvent ( 'resize' ) ) ;
639639 await flushPromises ( ) ;
640640 // assert content changes as well as content width is stored
641- assertWidth ( wrapper , 250 ) ;
641+ assertWidth ( wrapper , 200 ) ;
642642 expect ( store . state . contentWidth ) . toBe ( 99 ) ;
643643 } ) ;
644644 } ) ;
0 commit comments