Sha256: 0e935936688ce37b3d2d021ff756d825677fda8c5f7bc1190fc5bc4e7e70d38f

Contents?: true

Size: 1.2 KB

Versions: 62

Compression:

Stored size: 1.2 KB

Contents

//= require workarea/core/modules/cookie

(function () {
    'use strict';

    describe('WORKAREA.cookie', function () {
        describe('create', function () {
            it('creates a cookie with a given name and value', function () {
                WORKAREA.cookie.create('foo', 'bar', 7);

                expect(_.includes(document.cookie, 'foo=bar')).to.equal(true);
            });
        });

        describe('destroy', function () {
            it('destroys a cookie with a given name', function () {
                WORKAREA.cookie.create('foo', 'bar', 7);
                WORKAREA.cookie.destroy('foo');

                expect(_.includes(document.cookie, 'foo=bar')).to.equal(false);
            });
        });

        describe('read', function () {
            it('reads the cookie', function () {
                document.cookie = 'foo=bar';
                expect(WORKAREA.cookie.read('foo')).to.equal('bar');
            });

            it('reads a url with query params from the cookie', function() {
                document.cookie = 'baz=http://bat.com/?q=hello';

                expect(WORKAREA.cookie.read('baz')).to.equal('http://bat.com/?q=hello');
            });
        });
    });
}());

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-core-3.5.27 test/javascripts/cookie_spec.js
workarea-core-3.5.26 test/javascripts/cookie_spec.js
workarea-core-3.4.45 test/javascripts/cookie_spec.js
workarea-core-3.5.25 test/javascripts/cookie_spec.js
workarea-core-3.5.23 test/javascripts/cookie_spec.js
workarea-core-3.4.44 test/javascripts/cookie_spec.js
workarea-core-3.5.22 test/javascripts/cookie_spec.js
workarea-core-3.4.43 test/javascripts/cookie_spec.js
workarea-core-3.5.21 test/javascripts/cookie_spec.js
workarea-core-3.4.42 test/javascripts/cookie_spec.js
workarea-core-3.5.20 test/javascripts/cookie_spec.js
workarea-core-3.4.41 test/javascripts/cookie_spec.js
workarea-core-3.5.19 test/javascripts/cookie_spec.js
workarea-core-3.4.40 test/javascripts/cookie_spec.js
workarea-core-3.5.18 test/javascripts/cookie_spec.js
workarea-core-3.4.39 test/javascripts/cookie_spec.js
workarea-core-3.5.17 test/javascripts/cookie_spec.js
workarea-core-3.4.38 test/javascripts/cookie_spec.js
workarea-core-3.5.16 test/javascripts/cookie_spec.js
workarea-core-3.4.37 test/javascripts/cookie_spec.js