@@ -13,6 +13,7 @@ import AdjustableSidebarWidth, {
13
13
STORAGE_KEY ,
14
14
MAX_WIDTH ,
15
15
ULTRA_WIDE_DEFAULT ,
16
+ LARGE_DEFAULT_WIDTH ,
16
17
} from '@/components/AdjustableSidebarWidth.vue' ;
17
18
18
19
import store from '@/stores/DocumentationTopicStore' ;
@@ -106,9 +107,9 @@ describe('AdjustableSidebarWidth', () => {
106
107
} ) ;
107
108
108
109
describe ( 'on mount' , ( ) => {
109
- it ( 'sets the `width` to the middle between min and max for `large`, on mount' , ( ) => {
110
+ it ( 'sets the `width` to the `large` default width , on mount' , ( ) => {
110
111
const wrapper = createWrapper ( ) ;
111
- assertWidth ( wrapper , 350 ) ; // 35% on large
112
+ assertWidth ( wrapper , LARGE_DEFAULT_WIDTH ) ;
112
113
} ) ;
113
114
114
115
it ( 'changes the `width`, to the next closest max or min, on mount, as soon as the breakpoint gets changed' , ( ) => {
@@ -145,7 +146,7 @@ describe('AdjustableSidebarWidth', () => {
145
146
assertWidth ( wrapper , 450 ) ;
146
147
// assert the storage was called with the key and the default size
147
148
// 350 is half of min and max on Large
148
- expect ( storage . get ) . toHaveBeenLastCalledWith ( STORAGE_KEY , 350 ) ;
149
+ expect ( storage . get ) . toHaveBeenLastCalledWith ( STORAGE_KEY , LARGE_DEFAULT_WIDTH ) ;
149
150
} ) ;
150
151
151
152
it ( 'sets the `width` to the `max width allowed`, if stored value is bigger' , ( ) => {
@@ -369,8 +370,8 @@ describe('AdjustableSidebarWidth', () => {
369
370
// assert drop
370
371
document . dispatchEvent ( createEvent ( eventsMap . mouse . end ) ) ;
371
372
// assert emit event
372
- expect ( wrapper . emitted ( 'width-change' ) ) . toHaveLength ( 4 ) ;
373
- expect ( wrapper . emitted ( 'width-change' ) [ 3 ] ) . toEqual ( [ maxWidth ] ) ;
373
+ expect ( wrapper . emitted ( 'width-change' ) ) . toHaveLength ( 3 ) ;
374
+ expect ( wrapper . emitted ( 'width-change' ) [ 2 ] ) . toEqual ( [ maxWidth ] ) ;
374
375
// assert saved storage
375
376
expect ( storage . set ) . toHaveBeenLastCalledWith ( STORAGE_KEY , maxWidth ) ;
376
377
// assert drag stopped
@@ -407,8 +408,8 @@ describe('AdjustableSidebarWidth', () => {
407
408
// assert drop
408
409
document . dispatchEvent ( createEvent ( eventsMap . touch . end ) ) ;
409
410
// assert emit event
410
- expect ( wrapper . emitted ( 'width-change' ) ) . toHaveLength ( 4 ) ;
411
- expect ( wrapper . emitted ( 'width-change' ) [ 3 ] ) . toEqual ( [ maxWidth ] ) ;
411
+ expect ( wrapper . emitted ( 'width-change' ) ) . toHaveLength ( 3 ) ;
412
+ expect ( wrapper . emitted ( 'width-change' ) [ 2 ] ) . toEqual ( [ maxWidth ] ) ;
412
413
// assert saved storage
413
414
expect ( storage . set ) . toHaveBeenLastCalledWith ( STORAGE_KEY , maxWidth ) ;
414
415
// assert drag stopped
0 commit comments