Sha256: d6dbe028f1764e09480ac8f2541c92453b5f7320441d5555c26bf82d5af5fcc4

Contents?: true

Size: 1.73 KB

Versions: 62

Compression:

Stored size: 1.73 KB

Contents

(function () {
    'use strict';

    describe('WORKAREA.messages', function () {
        describe('insertMessage', function () {
            it('adds a flash message if no $parent is provided', function () {
                fixture.set('<p class="page-messages"></p>');

                WORKAREA.messages.insertMessage('foo', 'bar');

                expect($('.page-messages').text()).to.include('foo');
            });

            it('adds a static message if $parent is provided', function () {
                fixture.set('<p id="my-message"></p>');

                WORKAREA.messages.insertMessage('baz', 'bat', $('#my-message'));

                expect($('#my-message').text()).to.include('baz');
            });
        });

        describe('insertPageMessages', function() {
            it('will not add the same message twice', function () {
                var event = {},
                    xhr = {
                        getResponseHeader: function() {
                            return JSON.stringify({ ball: 'fuzz' });
                        }
                    };
                fixture.set('<p class="page-messages"></p>');

                WORKAREA.messages.insertPageMessages(event, xhr);
                WORKAREA.messages.insertPageMessages(event, xhr);

                expect($('.page-messages .message').length).to.equal(1);
            });
        });

        describe('initMessage', function () {
            it('does not add a dismiss if told not to', function () {
                fixture.set('<div class="messages" data-message-show-dismiss="false"></div>');

                WORKAREA.messages.init($(this.fixtures));

                expect($('.message__dismiss-action').length).to.equal(0);
            });
        });
    });
}());

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
workarea-storefront-3.5.15 test/javascripts/messages_spec.js
workarea-storefront-3.4.36 test/javascripts/messages_spec.js
workarea-storefront-3.5.14 test/javascripts/messages_spec.js
workarea-storefront-3.4.35 test/javascripts/messages_spec.js
workarea-storefront-3.5.13 test/javascripts/messages_spec.js
workarea-storefront-3.4.34 test/javascripts/messages_spec.js
workarea-storefront-3.5.12 test/javascripts/messages_spec.js
workarea-storefront-3.4.33 test/javascripts/messages_spec.js
workarea-storefront-3.5.11 test/javascripts/messages_spec.js
workarea-storefront-3.5.10 test/javascripts/messages_spec.js
workarea-storefront-3.4.32 test/javascripts/messages_spec.js
workarea-storefront-3.5.9 test/javascripts/messages_spec.js
workarea-storefront-3.4.31 test/javascripts/messages_spec.js
workarea-storefront-3.5.8 test/javascripts/messages_spec.js
workarea-storefront-3.4.30 test/javascripts/messages_spec.js
workarea-storefront-3.5.7 test/javascripts/messages_spec.js
workarea-storefront-3.4.29 test/javascripts/messages_spec.js
workarea-storefront-3.5.6 test/javascripts/messages_spec.js
workarea-storefront-3.4.28 test/javascripts/messages_spec.js
workarea-storefront-3.5.5 test/javascripts/messages_spec.js