Sha256: 15fd48be66971cd63cf1d7570388ee9df89bcf985e73b6d8d2ccf974d6af9520

Contents?: true

Size: 1.72 KB

Versions: 17

Compression:

Stored size: 1.72 KB

Contents

describe('Factory: Nofification', function() {
    var Notification, foreman;

    beforeEach(module('Bastion.components'));

    beforeEach(module(function ($provide) {
        foreman = {
            toastNotifications: {
                notify: function () {}
            }
        };

        $provide.value('foreman', foreman);
    }));

    beforeEach(inject(function (_Notification_) {
        Notification = _Notification_;
        spyOn(foreman.toastNotifications, 'notify');
    }));

    it("provides a way to set error messages", function () {
        var message = "Everything is broken!";
        Notification.setErrorMessage(message);
        expect(foreman.toastNotifications.notify).toHaveBeenCalledWith({message: message, type: 'danger'});
    });

    it("provides a way to set warning messages", function () {
        var message = "Everything ran correctly!";
        Notification.setWarningMessage(message);
        expect(foreman.toastNotifications.notify).toHaveBeenCalledWith({message: message, type: 'warning'});
    });

    it("provides a way to set success messages", function () {
        var message = "Everything ran correctly!";
        Notification.setSuccessMessage(message);
        expect(foreman.toastNotifications.notify).toHaveBeenCalledWith({message: message, type: 'success'});
    });

    it("allows message context to be specified for interpolation", function () {
        var message = "Everything ran correctly {{ ending }}!",
            $scope = {ending: 'yay'},
            expectedMessage = 'Everything ran correctly yay!';

        Notification.setSuccessMessage(message, $scope);
        expect(foreman.toastNotifications.notify).toHaveBeenCalledWith({message: expectedMessage, type: 'success'});
    });
});

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
bastion-6.1.15 test/components/notification.service.test.js
bastion-6.1.14 test/components/notification.service.test.js
bastion-6.1.13 test/components/notification.service.test.js
bastion-6.1.12 test/components/notification.service.test.js
bastion-6.1.11 test/components/notification.service.test.js
bastion-6.1.10 test/components/notification.service.test.js
bastion-6.1.9 test/components/notification.service.test.js
bastion-6.1.8 test/components/notification.service.test.js
bastion-6.1.7 test/components/notification.service.test.js
bastion-6.1.6 test/components/notification.service.test.js
bastion-6.1.5 test/components/notification.service.test.js
bastion-6.1.4 test/components/notification.service.test.js
bastion-6.1.3 test/components/notification.service.test.js
bastion-6.1.2 test/components/notification.service.test.js
bastion-6.1.1 test/components/notification.service.test.js
bastion-6.1.0 test/components/notification.service.test.js
bastion-6.0.0 test/components/notification.service.test.js