@@ -52,7 +52,7 @@ const boundingClientSpy = jest.spyOn(navStickyElement, 'getBoundingClientRect')
52
52
53
53
document . body . appendChild ( navStickyElement ) ;
54
54
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
56
56
let slotProps = { } ;
57
57
58
58
const createWrapper = opts => shallowMount ( AdjustableSidebarWidth , {
@@ -141,9 +141,9 @@ describe('AdjustableSidebarWidth', () => {
141
141
} ) ;
142
142
143
143
it ( 'sets the `width` to the last stored value' , ( ) => {
144
- storage . get . mockReturnValueOnce ( 450 ) ;
144
+ storage . get . mockReturnValueOnce ( 350 ) ;
145
145
const wrapper = createWrapper ( ) ;
146
- assertWidth ( wrapper , 450 ) ;
146
+ assertWidth ( wrapper , 350 ) ;
147
147
// assert the storage was called with the key and the default size
148
148
// 350 is half of min and max on Large
149
149
expect ( storage . get ) . toHaveBeenLastCalledWith ( STORAGE_KEY , LARGE_DEFAULT_WIDTH ) ;
@@ -158,7 +158,7 @@ describe('AdjustableSidebarWidth', () => {
158
158
it ( 'sets the `width` to the `min` width allowed, if stored value is smaller' , ( ) => {
159
159
storage . get . mockReturnValueOnce ( 100 ) ;
160
160
const wrapper = createWrapper ( ) ;
161
- assertWidth ( wrapper , 200 ) ; // 20 % of 1000
161
+ assertWidth ( wrapper , 300 ) ; // 30 % of 1000
162
162
} ) ;
163
163
164
164
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', () => {
311
311
window . innerWidth = 500 ;
312
312
window . dispatchEvent ( createEvent ( 'orientationchange' ) ) ;
313
313
await flushPromises ( ) ;
314
- assertWidth ( wrapper , 250 ) ; // 50 % of 500, on large
314
+ assertWidth ( wrapper , 200 ) ; // 40 % of 500, on large
315
315
window . innerWidth = 1000 ;
316
316
window . dispatchEvent ( createEvent ( 'orientationchange' ) ) ;
317
317
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
319
319
} ) ;
320
320
321
321
it ( 'changes the sidebar width, if outside the min/max on resize' , async ( ) => {
@@ -327,11 +327,11 @@ describe('AdjustableSidebarWidth', () => {
327
327
window . innerWidth = 500 ;
328
328
window . dispatchEvent ( createEvent ( 'resize' ) ) ;
329
329
await flushPromises ( ) ;
330
- assertWidth ( wrapper , 250 ) ; // 50 % of 500, on large
330
+ assertWidth ( wrapper , 200 ) ; // 40 % of 500, on large
331
331
window . innerWidth = 1000 ;
332
332
window . dispatchEvent ( createEvent ( 'resize' ) ) ;
333
333
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
335
335
} ) ;
336
336
337
337
it ( 'stores the height of screen on orientationchange and resize' , async ( ) => {
@@ -370,8 +370,8 @@ describe('AdjustableSidebarWidth', () => {
370
370
// assert drop
371
371
document . dispatchEvent ( createEvent ( eventsMap . mouse . end ) ) ;
372
372
// 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 ] ) ;
375
375
// assert saved storage
376
376
expect ( storage . set ) . toHaveBeenLastCalledWith ( STORAGE_KEY , maxWidth ) ;
377
377
// assert drag stopped
@@ -408,8 +408,8 @@ describe('AdjustableSidebarWidth', () => {
408
408
// assert drop
409
409
document . dispatchEvent ( createEvent ( eventsMap . touch . end ) ) ;
410
410
// 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 ] ) ;
413
413
// assert saved storage
414
414
expect ( storage . set ) . toHaveBeenLastCalledWith ( STORAGE_KEY , maxWidth ) ;
415
415
// assert drag stopped
@@ -450,7 +450,7 @@ describe('AdjustableSidebarWidth', () => {
450
450
} ) ) ;
451
451
// assert class
452
452
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
454
454
} ) ;
455
455
456
456
it ( 'prevents dragging below the `minWidth`' , ( ) => {
@@ -463,7 +463,7 @@ describe('AdjustableSidebarWidth', () => {
463
463
} ) ) ;
464
464
// assert class
465
465
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)
467
467
} ) ;
468
468
469
469
it ( 'force closes the nav, if dragging below the forceClose threshold' , ( ) => {
@@ -478,7 +478,7 @@ describe('AdjustableSidebarWidth', () => {
478
478
} ) ) ;
479
479
// assert class
480
480
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)
482
482
expect ( wrapper . emitted ( 'update:hiddenOnLarge' ) ) . toEqual ( [ [ true ] ] ) ;
483
483
// simulate event is handled on parent
484
484
wrapper . setProps ( {
@@ -488,7 +488,7 @@ describe('AdjustableSidebarWidth', () => {
488
488
document . dispatchEvent ( createEvent ( eventsMap . mouse . move , {
489
489
clientX : 350 ,
490
490
} ) ) ;
491
- assertWidth ( wrapper , 250 ) ;
491
+ assertWidth ( wrapper , 300 ) ;
492
492
expect ( wrapper . emitted ( 'update:hiddenOnLarge' ) ) . toEqual ( [ [ true ] , [ false ] ] ) ;
493
493
expect ( aside . classes ( ) ) . toContain ( 'is-opening-on-large' ) ;
494
494
} ) ;
@@ -523,7 +523,7 @@ describe('AdjustableSidebarWidth', () => {
523
523
// assert class
524
524
expect ( aside . classes ( ) ) . toContain ( 'dragging' ) ;
525
525
// offset is 100, so we remove it from the clientX, but we add the scrollX.
526
- assertWidth ( wrapper , 255 ) ;
526
+ assertWidth ( wrapper , 300 ) ;
527
527
// assert maxWidth
528
528
document . dispatchEvent ( createEvent ( eventsMap . touch . move , {
529
529
touches : [ {
@@ -638,7 +638,7 @@ describe('AdjustableSidebarWidth', () => {
638
638
window . dispatchEvent ( createEvent ( 'resize' ) ) ;
639
639
await flushPromises ( ) ;
640
640
// assert content changes as well as content width is stored
641
- assertWidth ( wrapper , 250 ) ;
641
+ assertWidth ( wrapper , 200 ) ;
642
642
expect ( store . state . contentWidth ) . toBe ( 99 ) ;
643
643
} ) ;
644
644
} ) ;
0 commit comments