Tests/Specs: Use Chai for assertions, instead of Jasmine's assertions.
[mootools.git] / Specs / Utilities / Cookie.js
bloba7ed94ec2bc583bf81d58a434ea60d38caf62156
1 /*
2 ---
3 name: Cookie
4 requires: ~
5 provides: ~
6 ...
7 */
9 describe('Cookie', function(){
11         it("should set a cookie", function(){
13                 Cookie.write('test', 1);
15         });
17         it('should read and write a cookie', function(){
18                 var options = {
19                         duration: 1
20                 };
22                 Cookie.write('key', 'value', options);
24                 expect(Cookie.read('key', options)).to.equal('value');
26                 Cookie.dispose('key', options);
28                 expect(Cookie.read('key', options)).to.equal(null);
29         });
31         it('should set HttpCookie flag correctly', function(){
32                 var instance = new Cookie('key', {
33                         httpOnly: true,
34                         document: {
35                                 cookie: ''
36                         }
37                 }).write('value');
39                 expect(instance.options.document.cookie.indexOf('HttpOnly')).to.not.equal(-1);
40         });
42 });