File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838 // Write
3939
4040 if ( arguments . length > 1 ) {
41- options = extend ( api . defaults , options ) ;
41+ options = extend ( {
42+ path : '/'
43+ } , api . defaults , options ) ;
4244
4345 if ( typeof options . expires === 'number' ) {
4446 var expires = new Date ( ) ;
118120 json : true
119121 } , [ ] . slice . call ( arguments ) ) ;
120122 } ;
121- api . defaults = {
122- path : '/'
123- } ;
123+ api . defaults = { } ;
124124
125125 api . remove = function ( key , options ) {
126126 api ( key , '' , extend ( options , {
Original file line number Diff line number Diff line change @@ -164,11 +164,11 @@ test('return value', function () {
164164
165165test ( 'default path attribute' , function ( ) {
166166 expect ( 1 ) ;
167- ok ( Cookies . set ( 'c' , 'v' ) . match ( / p a t h = \/ / ) , 'should be default to the whole site ' ) ;
167+ ok ( Cookies . set ( 'c' , 'v' ) . match ( / p a t h = \/ / ) , 'should read the default path ' ) ;
168168} ) ;
169169
170- test ( 'changing defaults' , function ( ) {
171- expect ( 2 ) ;
170+ test ( 'API for changing defaults' , function ( ) {
171+ expect ( 3 ) ;
172172
173173 Cookies . defaults . path = '/foo' ;
174174 ok ( Cookies . set ( 'c' , 'v' ) . match ( / p a t h = \/ f o o / ) , 'should use attributes from defaults' ) ;
@@ -178,6 +178,7 @@ test('changing defaults', function () {
178178 Cookies . remove ( 'c' , { path : '/bar' } ) ;
179179
180180 delete Cookies . defaults . path ;
181+ ok ( Cookies . set ( 'c' , 'v' ) . match ( / p a t h = \/ / ) , 'should roll back to the default path' ) ;
181182} ) ;
182183
183184module ( 'remove' , lifecycle ) ;
You can’t perform that action at this time.
0 commit comments