[Code Style] Run gulp fixstyle
...to apply code style settings from #142.
This commit is contained in:
@@ -42,7 +42,7 @@ define(
|
||||
/**
|
||||
* Launch a dialog showing a list of current notifications.
|
||||
*/
|
||||
$scope.showNotificationsList = function(){
|
||||
$scope.showNotificationsList = function () {
|
||||
dialogService.getDialogResponse('overlay-message-list', {
|
||||
dialog: {
|
||||
title: "Messages",
|
||||
@@ -50,11 +50,11 @@ define(
|
||||
// from the notifications
|
||||
messages: notificationService.notifications
|
||||
},
|
||||
cancel: function(){
|
||||
cancel: function () {
|
||||
dialogService.dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
return NotificationIndicatorController;
|
||||
|
||||
@@ -118,7 +118,7 @@ define(
|
||||
function NotificationService($timeout, topic, DEFAULT_AUTO_DISMISS, MINIMIZE_TIMEOUT) {
|
||||
this.notifications = [];
|
||||
this.$timeout = $timeout;
|
||||
this.highest ={ severity: "info" };
|
||||
this.highest = { severity: "info" };
|
||||
this.DEFAULT_AUTO_DISMISS = DEFAULT_AUTO_DISMISS;
|
||||
this.MINIMIZE_TIMEOUT = MINIMIZE_TIMEOUT;
|
||||
this.topic = topic;
|
||||
@@ -143,7 +143,7 @@ define(
|
||||
//Check this is a known notification
|
||||
var index = service.notifications.indexOf(notification);
|
||||
|
||||
if (service.active.timeout){
|
||||
if (service.active.timeout) {
|
||||
/*
|
||||
Method can be called manually (clicking dismiss) or
|
||||
automatically from an auto-timeout. this.active.timeout
|
||||
@@ -157,10 +157,10 @@ define(
|
||||
}
|
||||
|
||||
if (index >= 0) {
|
||||
notification.model.minimized=true;
|
||||
notification.model.minimized = true;
|
||||
//Add a brief timeout before showing the next notification
|
||||
// in order to allow the minimize animation to run through.
|
||||
service.$timeout(function() {
|
||||
service.$timeout(function () {
|
||||
service.setActiveNotification(service.selectNextNotification());
|
||||
}, service.MINIMIZE_TIMEOUT);
|
||||
}
|
||||
@@ -180,7 +180,7 @@ define(
|
||||
//Check this is a known notification
|
||||
var index = service.notifications.indexOf(notification);
|
||||
|
||||
if (service.active.timeout){
|
||||
if (service.active.timeout) {
|
||||
/* Method can be called manually (clicking dismiss) or
|
||||
* automatically from an auto-timeout. this.active.timeout
|
||||
* acts as a semaphore to prevent race conditions. Cancel any
|
||||
@@ -219,7 +219,7 @@ define(
|
||||
* Returns the notification that is currently visible in the banner area
|
||||
* @returns {Notification}
|
||||
*/
|
||||
NotificationService.prototype.getActiveNotification = function (){
|
||||
NotificationService.prototype.getActiveNotification = function () {
|
||||
return this.active.notification;
|
||||
};
|
||||
|
||||
@@ -281,8 +281,8 @@ define(
|
||||
"alert": 2,
|
||||
"error": 3
|
||||
};
|
||||
this.highest.severity = this.notifications.reduce(function(previous, notification){
|
||||
if (severity[notification.model.severity] > severity[previous]){
|
||||
this.highest.severity = this.notifications.reduce(function (previous, notification) {
|
||||
if (severity[notification.model.severity] > severity[previous]) {
|
||||
return notification.model.severity;
|
||||
} else {
|
||||
return previous;
|
||||
@@ -308,23 +308,23 @@ define(
|
||||
|
||||
notification = {
|
||||
model: notificationModel,
|
||||
minimize: function() {
|
||||
minimize: function () {
|
||||
self.minimize(self, notification);
|
||||
},
|
||||
dismiss: function(){
|
||||
dismiss: function () {
|
||||
self.dismiss(self, notification);
|
||||
topic.notify();
|
||||
},
|
||||
dismissOrMinimize: function(){
|
||||
dismissOrMinimize: function () {
|
||||
self.dismissOrMinimize(notification);
|
||||
},
|
||||
onDismiss: function(callback) {
|
||||
onDismiss: function (callback) {
|
||||
topic.listen(callback);
|
||||
}
|
||||
};
|
||||
|
||||
notificationModel.severity = notificationModel.severity || "info";
|
||||
if (notificationModel.autoDismiss === true){
|
||||
if (notificationModel.autoDismiss === true) {
|
||||
notificationModel.autoDismiss = this.DEFAULT_AUTO_DISMISS;
|
||||
}
|
||||
|
||||
@@ -337,7 +337,7 @@ define(
|
||||
notificationModel.options = notificationModel.options || [];
|
||||
notificationModel.options.unshift({
|
||||
label: "Dismiss",
|
||||
callback: function() {
|
||||
callback: function () {
|
||||
notification.dismiss();
|
||||
}
|
||||
});
|
||||
@@ -350,10 +350,10 @@ define(
|
||||
/*
|
||||
Check if there is already an active (ie. visible) notification
|
||||
*/
|
||||
if (!this.active.notification){
|
||||
if (!this.active.notification) {
|
||||
this.setActiveNotification(notification);
|
||||
|
||||
} else if (!this.active.timeout){
|
||||
} else if (!this.active.timeout) {
|
||||
/*
|
||||
If there is already an active notification, time it out. If it's
|
||||
already got a timeout in progress (either because it has had
|
||||
@@ -397,7 +397,7 @@ define(
|
||||
} else {
|
||||
delete this.active.timeout;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Used internally by the NotificationService
|
||||
@@ -406,17 +406,17 @@ define(
|
||||
*/
|
||||
NotificationService.prototype.selectNextNotification = function () {
|
||||
var notification,
|
||||
i=0;
|
||||
i = 0;
|
||||
|
||||
/*
|
||||
Loop through the notifications queue and find the first one that
|
||||
has not already been minimized (manually or otherwise).
|
||||
*/
|
||||
for (; i< this.notifications.length; i++) {
|
||||
for (; i < this.notifications.length; i++) {
|
||||
notification = this.notifications[i];
|
||||
|
||||
if (!notification.model.minimized &&
|
||||
notification!== this.active.notification) {
|
||||
notification !== this.active.notification) {
|
||||
|
||||
return notification;
|
||||
}
|
||||
@@ -425,4 +425,4 @@ define(
|
||||
|
||||
return NotificationService;
|
||||
}
|
||||
);
|
||||
);
|
||||
|
||||
@@ -30,7 +30,7 @@ define(
|
||||
mockDialogService,
|
||||
controller;
|
||||
|
||||
beforeEach(function(){
|
||||
beforeEach(function () {
|
||||
mockNotificationService = jasmine.createSpy("notificationService");
|
||||
mockScope = jasmine.createSpy("$scope");
|
||||
mockDialogService = jasmine.createSpyObj(
|
||||
@@ -43,12 +43,12 @@ define(
|
||||
controller = new NotificationIndicatorController(mockScope, mockNotificationService, mockDialogService);
|
||||
});
|
||||
|
||||
it("exposes the highest notification severity to the template", function() {
|
||||
it("exposes the highest notification severity to the template", function () {
|
||||
expect(mockScope.highest).toBeTruthy();
|
||||
expect(mockScope.highest.severity).toBe("error");
|
||||
});
|
||||
|
||||
it("invokes the dialog service to show list of messages", function() {
|
||||
it("invokes the dialog service to show list of messages", function () {
|
||||
expect(mockScope.showNotificationsList).toBeDefined();
|
||||
mockScope.showNotificationsList();
|
||||
expect(mockDialogService.getDialogResponse).toHaveBeenCalled();
|
||||
@@ -60,7 +60,7 @@ define(
|
||||
expect(mockDialogService.dismiss).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("provides a means of dismissing the message list", function() {
|
||||
it("provides a means of dismissing the message list", function () {
|
||||
expect(mockScope.showNotificationsList).toBeDefined();
|
||||
mockScope.showNotificationsList();
|
||||
expect(mockDialogService.getDialogResponse).toHaveBeenCalled();
|
||||
|
||||
@@ -34,7 +34,7 @@ define(
|
||||
mockTopicObject,
|
||||
errorModel;
|
||||
|
||||
beforeEach(function(){
|
||||
beforeEach(function () {
|
||||
mockTimeout = jasmine.createSpy("$timeout");
|
||||
mockTopicFunction = jasmine.createSpy("topic");
|
||||
mockTopicObject = jasmine.createSpyObj("topicObject", ["listen", "notify"]);
|
||||
@@ -54,14 +54,14 @@ define(
|
||||
});
|
||||
|
||||
it("gets a new success notification, making" +
|
||||
" the notification active", function() {
|
||||
" the notification active", function () {
|
||||
var activeNotification;
|
||||
notificationService.notify(successModel);
|
||||
activeNotification = notificationService.getActiveNotification();
|
||||
expect(activeNotification.model).toBe(successModel);
|
||||
});
|
||||
|
||||
it("notifies listeners on dismissal of notification", function() {
|
||||
it("notifies listeners on dismissal of notification", function () {
|
||||
var notification,
|
||||
dismissListener = jasmine.createSpy("ondismiss");
|
||||
notification = notificationService.notify(successModel);
|
||||
@@ -75,7 +75,7 @@ define(
|
||||
});
|
||||
|
||||
it("allows specification of an info notification given just a" +
|
||||
" title, making the notification active", function() {
|
||||
" title, making the notification active", function () {
|
||||
var activeNotification,
|
||||
notificationTitle = "Test info notification";
|
||||
notificationService.info(notificationTitle);
|
||||
@@ -85,7 +85,7 @@ define(
|
||||
});
|
||||
|
||||
it("gets a new success notification with" +
|
||||
" numerical auto-dismiss specified. ", function() {
|
||||
" numerical auto-dismiss specified. ", function () {
|
||||
var activeNotification;
|
||||
successModel.autoDismiss = 1000;
|
||||
notificationService.notify(successModel);
|
||||
@@ -99,7 +99,7 @@ define(
|
||||
});
|
||||
|
||||
it("gets a new notification with" +
|
||||
" boolean auto-dismiss specified. ", function() {
|
||||
" boolean auto-dismiss specified. ", function () {
|
||||
var activeNotification;
|
||||
successModel.autoDismiss = true;
|
||||
notificationService.notify(successModel);
|
||||
@@ -112,7 +112,7 @@ define(
|
||||
expect(activeNotification).toBeUndefined();
|
||||
});
|
||||
|
||||
it("allows minimization of notifications", function() {
|
||||
it("allows minimization of notifications", function () {
|
||||
var notification,
|
||||
activeNotification;
|
||||
|
||||
@@ -128,7 +128,7 @@ define(
|
||||
expect(notificationService.notifications.length).toBe(1);
|
||||
});
|
||||
|
||||
it("allows dismissal of notifications", function() {
|
||||
it("allows dismissal of notifications", function () {
|
||||
var notification,
|
||||
activeNotification;
|
||||
|
||||
@@ -143,9 +143,9 @@ define(
|
||||
expect(notificationService.notifications.length).toBe(0);
|
||||
});
|
||||
|
||||
describe(" gets called with multiple notifications", function(){
|
||||
describe(" gets called with multiple notifications", function () {
|
||||
it("auto-dismisses the previously active notification, making" +
|
||||
" the new notification active", function() {
|
||||
" the new notification active", function () {
|
||||
var activeNotification;
|
||||
//First pre-load with a info message
|
||||
notificationService.notify(successModel);
|
||||
@@ -165,7 +165,7 @@ define(
|
||||
activeNotification = notificationService.getActiveNotification();
|
||||
expect(activeNotification.model).toBe(errorModel);
|
||||
});
|
||||
it("auto-minimizes an active error notification", function() {
|
||||
it("auto-minimizes an active error notification", function () {
|
||||
var activeNotification;
|
||||
//First pre-load with an error message
|
||||
notificationService.notify(errorModel);
|
||||
@@ -187,7 +187,7 @@ define(
|
||||
expect(errorModel.minimized).toEqual(true);
|
||||
});
|
||||
it("auto-minimizes errors when a number of them arrive in" +
|
||||
" short succession ", function() {
|
||||
" short succession ", function () {
|
||||
var activeNotification,
|
||||
error2 = {
|
||||
title: "Second Mock Error Notification",
|
||||
|
||||
Reference in New Issue
Block a user