@@ -13,6 +13,7 @@ import AdjustableSidebarWidth, {
1313 STORAGE_KEY ,
1414 MAX_WIDTH ,
1515 ULTRA_WIDE_DEFAULT ,
16+ LARGE_DEFAULT_WIDTH ,
1617} from '@/components/AdjustableSidebarWidth.vue' ;
1718
1819import store from '@/stores/DocumentationTopicStore' ;
@@ -106,9 +107,9 @@ describe('AdjustableSidebarWidth', () => {
106107 } ) ;
107108
108109 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' , ( ) => {
110111 const wrapper = createWrapper ( ) ;
111- assertWidth ( wrapper , 350 ) ; // 35% on large
112+ assertWidth ( wrapper , LARGE_DEFAULT_WIDTH ) ;
112113 } ) ;
113114
114115 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', () => {
145146 assertWidth ( wrapper , 450 ) ;
146147 // assert the storage was called with the key and the default size
147148 // 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 ) ;
149150 } ) ;
150151
151152 it ( 'sets the `width` to the `max width allowed`, if stored value is bigger' , ( ) => {
@@ -369,8 +370,8 @@ describe('AdjustableSidebarWidth', () => {
369370 // assert drop
370371 document . dispatchEvent ( createEvent ( eventsMap . mouse . end ) ) ;
371372 // 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 ] ) ;
374375 // assert saved storage
375376 expect ( storage . set ) . toHaveBeenLastCalledWith ( STORAGE_KEY , maxWidth ) ;
376377 // assert drag stopped
@@ -407,8 +408,8 @@ describe('AdjustableSidebarWidth', () => {
407408 // assert drop
408409 document . dispatchEvent ( createEvent ( eventsMap . touch . end ) ) ;
409410 // 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 ] ) ;
412413 // assert saved storage
413414 expect ( storage . set ) . toHaveBeenLastCalledWith ( STORAGE_KEY , maxWidth ) ;
414415 // assert drag stopped
0 commit comments