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.15 test/javascripts/cookie_spec.js
workarea-core-3.4.36 test/javascripts/cookie_spec.js
workarea-core-3.5.14 test/javascripts/cookie_spec.js
workarea-core-3.4.35 test/javascripts/cookie_spec.js
workarea-core-3.5.13 test/javascripts/cookie_spec.js
workarea-core-3.4.34 test/javascripts/cookie_spec.js
workarea-core-3.5.12 test/javascripts/cookie_spec.js
workarea-core-3.4.33 test/javascripts/cookie_spec.js
workarea-core-3.5.11 test/javascripts/cookie_spec.js
workarea-core-3.5.10 test/javascripts/cookie_spec.js
workarea-core-3.4.32 test/javascripts/cookie_spec.js
workarea-core-3.5.9 test/javascripts/cookie_spec.js
workarea-core-3.4.31 test/javascripts/cookie_spec.js
workarea-core-3.5.8 test/javascripts/cookie_spec.js
workarea-core-3.4.30 test/javascripts/cookie_spec.js
workarea-core-3.5.7 test/javascripts/cookie_spec.js
workarea-core-3.4.29 test/javascripts/cookie_spec.js
workarea-core-3.5.6 test/javascripts/cookie_spec.js
workarea-core-3.4.28 test/javascripts/cookie_spec.js
workarea-core-3.5.5 test/javascripts/cookie_spec.js