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.27 test/javascripts/messages_spec.js
workarea-storefront-3.5.26 test/javascripts/messages_spec.js
workarea-storefront-3.4.45 test/javascripts/messages_spec.js
workarea-storefront-3.5.25 test/javascripts/messages_spec.js
workarea-storefront-3.5.23 test/javascripts/messages_spec.js
workarea-storefront-3.4.44 test/javascripts/messages_spec.js
workarea-storefront-3.5.22 test/javascripts/messages_spec.js
workarea-storefront-3.4.43 test/javascripts/messages_spec.js
workarea-storefront-3.5.21 test/javascripts/messages_spec.js
workarea-storefront-3.4.42 test/javascripts/messages_spec.js
workarea-storefront-3.5.20 test/javascripts/messages_spec.js
workarea-storefront-3.4.41 test/javascripts/messages_spec.js
workarea-storefront-3.5.19 test/javascripts/messages_spec.js
workarea-storefront-3.4.40 test/javascripts/messages_spec.js
workarea-storefront-3.5.18 test/javascripts/messages_spec.js
workarea-storefront-3.4.39 test/javascripts/messages_spec.js
workarea-storefront-3.5.17 test/javascripts/messages_spec.js
workarea-storefront-3.4.38 test/javascripts/messages_spec.js
workarea-storefront-3.5.16 test/javascripts/messages_spec.js
workarea-storefront-3.4.37 test/javascripts/messages_spec.js