@@ -13,15 +13,15 @@ module('read', lifecycle);
1313test ( 'simple value' , function ( ) {
1414 expect ( 1 ) ;
1515 document . cookie = 'c=v' ;
16- equal ( $ . cookie ( 'c' ) , 'v' , 'should return value' ) ;
16+ strictEqual ( $ . cookie ( 'c' ) , 'v' , 'should return value' ) ;
1717} ) ;
1818
1919test ( 'empty value' , function ( ) {
2020 expect ( 1 ) ;
2121 // IE saves cookies with empty string as "c; ", e.g. without "=" as opposed to EOMB, which
2222 // resulted in a bug while reading such a cookie.
2323 $ . cookie ( 'c' , '' ) ;
24- equal ( $ . cookie ( 'c' ) , '' , 'should return value' ) ;
24+ strictEqual ( $ . cookie ( 'c' ) , '' , 'should return value' ) ;
2525} ) ;
2626
2727test ( 'not existing' , function ( ) {
@@ -32,31 +32,31 @@ test('not existing', function () {
3232test ( 'RFC 2068 quoted string' , function ( ) {
3333 expect ( 1 ) ;
3434 document . cookie = 'c="v@address.com\\"\\\\\\""' ;
35- equal ( $ . cookie ( 'c' ) , 'v@address.com"\\"' , 'should decode RFC 2068 quoted string' ) ;
35+ strictEqual ( $ . cookie ( 'c' ) , 'v@address.com"\\"' , 'should decode RFC 2068 quoted string' ) ;
3636} ) ;
3737
3838test ( 'decode' , function ( ) {
3939 expect ( 1 ) ;
4040 document . cookie = encodeURIComponent ( ' c' ) + '=' + encodeURIComponent ( ' v' ) ;
41- equal ( $ . cookie ( ' c' ) , ' v' , 'should decode key and value' ) ;
41+ strictEqual ( $ . cookie ( ' c' ) , ' v' , 'should decode key and value' ) ;
4242} ) ;
4343
4444test ( 'decode pluses to space for server side written cookie' , function ( ) {
4545 expect ( 1 ) ;
4646 document . cookie = 'c=foo+bar' ;
47- equal ( $ . cookie ( 'c' ) , 'foo bar' , 'should convert pluses back to space' ) ;
47+ strictEqual ( $ . cookie ( 'c' ) , 'foo bar' , 'should convert pluses back to space' ) ;
4848} ) ;
4949
5050test ( 'raw = true' , function ( ) {
5151 expect ( 2 ) ;
5252 $ . cookie . raw = true ;
5353
5454 document . cookie = 'c=%20v' ;
55- equal ( $ . cookie ( 'c' ) , '%20v' , 'should not decode value' ) ;
55+ strictEqual ( $ . cookie ( 'c' ) , '%20v' , 'should not decode value' ) ;
5656
5757 // see https://github.com/carhartl/jquery-cookie/issues/50
5858 $ . cookie ( 'c' , 'foo=bar' ) ;
59- equal ( $ . cookie ( 'c' ) , 'foo=bar' , 'should include the entire value' ) ;
59+ strictEqual ( $ . cookie ( 'c' ) , 'foo=bar' , 'should include the entire value' ) ;
6060} ) ;
6161
6262test ( 'json = true' , function ( ) {
@@ -76,7 +76,7 @@ test('not existing with json = true', function () {
7676 $ . cookie . json = true ;
7777
7878 if ( 'JSON' in window ) {
79- equal ( $ . cookie ( 'whatever' ) , null , 'should return null' ) ;
79+ strictEqual ( $ . cookie ( 'whatever' ) , undefined , "won't throw exception" ) ;
8080 } else {
8181 ok ( true ) ;
8282 }
@@ -89,7 +89,7 @@ asyncTest('malformed cookie value in IE (#88, #117)', function() {
8989 $ ( iframe ) . on ( 'load' , function ( ) {
9090 start ( ) ;
9191 if ( iframe . contentWindow . ok ) {
92- equal ( iframe . contentWindow . testValue , 'two' , 'reads all cookie values, skipping duplicate occurences of "; "' ) ;
92+ strictEqual ( iframe . contentWindow . testValue , 'two' , 'reads all cookie values, skipping duplicate occurences of "; "' ) ;
9393 } else {
9494 // Skip the test where we can't stub document.cookie using
9595 // Object.defineProperty. Seems to work fine in
@@ -122,54 +122,46 @@ module('write', lifecycle);
122122test ( 'String primitive' , function ( ) {
123123 expect ( 1 ) ;
124124 $ . cookie ( 'c' , 'v' ) ;
125- equal ( $ . cookie ( 'c' ) , 'v' , 'should write value' ) ;
125+ strictEqual ( $ . cookie ( 'c' ) , 'v' , 'should write value' ) ;
126126} ) ;
127127
128128test ( 'String object' , function ( ) {
129129 expect ( 1 ) ;
130130 $ . cookie ( 'c' , new String ( 'v' ) ) ;
131- equal ( $ . cookie ( 'c' ) , 'v' , 'should write value' ) ;
131+ strictEqual ( $ . cookie ( 'c' ) , 'v' , 'should write value' ) ;
132132} ) ;
133133
134134test ( 'value "[object Object]"' , function ( ) {
135135 expect ( 1 ) ;
136136 $ . cookie ( 'c' , '[object Object]' ) ;
137- equal ( $ . cookie ( 'c' ) , '[object Object]' , 'should write value' ) ;
137+ strictEqual ( $ . cookie ( 'c' ) , '[object Object]' , 'should write value' ) ;
138138} ) ;
139139
140140test ( 'number' , function ( ) {
141141 expect ( 1 ) ;
142142 $ . cookie ( 'c' , 1234 ) ;
143- equal ( $ . cookie ( 'c' ) , '1234' , 'should write value' ) ;
143+ strictEqual ( $ . cookie ( 'c' ) , '1234' , 'should write value' ) ;
144144} ) ;
145145
146146test ( 'expires option as days from now' , function ( ) {
147147 expect ( 1 ) ;
148148 var sevenDaysFromNow = new Date ( ) ;
149149 sevenDaysFromNow . setDate ( sevenDaysFromNow . getDate ( ) + 7 ) ;
150- equal ( $ . cookie ( 'c' , 'v' , { expires : 7 } ) , 'c=v; expires=' + sevenDaysFromNow . toUTCString ( ) ,
150+ strictEqual ( $ . cookie ( 'c' , 'v' , { expires : 7 } ) , 'c=v; expires=' + sevenDaysFromNow . toUTCString ( ) ,
151151 'should write the cookie string with expires' ) ;
152152} ) ;
153153
154154test ( 'expires option as Date instance' , function ( ) {
155155 expect ( 1 ) ;
156156 var sevenDaysFromNow = new Date ( ) ;
157157 sevenDaysFromNow . setDate ( sevenDaysFromNow . getDate ( ) + 7 ) ;
158- equal ( $ . cookie ( 'c' , 'v' , { expires : sevenDaysFromNow } ) , 'c=v; expires=' + sevenDaysFromNow . toUTCString ( ) ,
158+ strictEqual ( $ . cookie ( 'c' , 'v' , { expires : sevenDaysFromNow } ) , 'c=v; expires=' + sevenDaysFromNow . toUTCString ( ) ,
159159 'should write the cookie string with expires' ) ;
160160} ) ;
161161
162- test ( 'invalid expires option (in the past)' , function ( ) {
163- expect ( 1 ) ;
164- var yesterday = new Date ( ) ;
165- yesterday . setDate ( yesterday . getDate ( ) - 1 ) ;
166- $ . cookie ( 'c' , 'v' , { expires : yesterday } ) ;
167- equal ( $ . cookie ( 'c' ) , null , 'should not save already expired cookie' ) ;
168- } ) ;
169-
170162test ( 'return value' , function ( ) {
171163 expect ( 1 ) ;
172- equal ( $ . cookie ( 'c' , 'v' ) , 'c=v' , 'should return written cookie string' ) ;
164+ strictEqual ( $ . cookie ( 'c' , 'v' ) , 'c=v' , 'should return written cookie string' ) ;
173165} ) ;
174166
175167test ( 'defaults' , function ( ) {
@@ -182,7 +174,7 @@ test('defaults', function () {
182174test ( 'raw = true' , function ( ) {
183175 expect ( 1 ) ;
184176 $ . cookie . raw = true ;
185- equal ( $ . cookie ( 'c' , ' v' ) . split ( '=' ) [ 1 ] , ' v' , 'should not encode' ) ;
177+ strictEqual ( $ . cookie ( 'c' , ' v' ) . split ( '=' ) [ 1 ] , ' v' , 'should not encode' ) ;
186178} ) ;
187179
188180test ( 'json = true' , function ( ) {
@@ -191,7 +183,7 @@ test('json = true', function () {
191183
192184 if ( 'JSON' in window ) {
193185 $ . cookie ( 'c' , { foo : 'bar' } ) ;
194- equal ( document . cookie , 'c=' + encodeURIComponent ( JSON . stringify ( { foo : 'bar' } ) ) , 'should stringify JSON' ) ;
186+ strictEqual ( document . cookie , 'c=' + encodeURIComponent ( JSON . stringify ( { foo : 'bar' } ) ) , 'should stringify JSON' ) ;
195187 } else {
196188 ok ( true ) ;
197189 }
@@ -204,7 +196,7 @@ test('deletion', function() {
204196 expect ( 1 ) ;
205197 $ . cookie ( 'c' , 'v' ) ;
206198 $ . removeCookie ( 'c' ) ;
207- equal ( document . cookie , '' , 'should delete the cookie' ) ;
199+ strictEqual ( document . cookie , '' , 'should delete the cookie' ) ;
208200} ) ;
209201
210202test ( 'return' , function ( ) {
@@ -224,16 +216,16 @@ test('with options', function() {
224216 callCount ++ ;
225217 if ( callCount === 1 ) {
226218 // see https://github.com/carhartl/jquery-cookie/issues/99
227- equal ( arguments . length , 1 , 'look up cookie instead of accidently writing a new' ) ;
219+ strictEqual ( arguments . length , 1 , 'look up cookie instead of accidently writing a new' ) ;
228220 return 'cookie' ; // act as if a cookie was found...
229221 }
230222 if ( callCount === 2 ) {
231- equal ( arguments [ 2 ] . foo , 'bar' , 'pass along options when deleting cookie' ) ;
223+ strictEqual ( arguments [ 2 ] . foo , 'bar' , 'pass along options when deleting cookie' ) ;
232224 }
233225 } ;
234226
235227 $ . removeCookie ( 'c' , { foo : 'bar' } ) ;
236- equal ( callCount , 2 ) ;
228+ strictEqual ( callCount , 2 ) ;
237229
238230 $ . cookie = originalCookie ;
239231} ) ;
0 commit comments