forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular-growl-v2-tests.ts
65 lines (56 loc) · 2.07 KB
/
angular-growl-v2-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/// <reference path="angular-growl-v2.d.ts" />
var app = angular.module("ag", ["pascalprecht.translate", "$httpProvider"]);
app.config((growlProvider:angular.growl.IGrowlProvider, $httpProvider:angular.IHttpProvider) => {
var ttl:angular.growl.IGrowlTTLConfig = {
success: 5000,
error: 4000
};
growlProvider.globalTimeToLive(ttl)
.globalTimeToLive(5000)
.globalDisableCloseButton(true)
.globalDisableIcons(true)
.globalReversedOrder(false)
.globalDisableCountDown(true)
.messageVariableKey("someKey")
.globalInlineMessages(false)
.globalPosition("top-center")
.messagesKey("someKey")
.messageTextKey("someKey")
.messageTitleKey("someKey")
.messageSeverityKey("someKey")
.onlyUniqueMessages(false);
$httpProvider.interceptors.push(growlProvider.serverMessagesInterceptor);
});
app.controller("Ctrl", ($scope:angular.IScope,
growl:angular.growl.IGrowlService,
growlMessages:angular.growl.IGrowlMessagesService) => {
var config:angular.growl.IGrowlMessageConfig = {
ttl: 5000,
disableCountDown: true,
disableCloseButton: true
};
var message = "Some message";
growl.warning(message);
growl.warning(message, config);
growl.error(message);
growl.error(message, config);
growl.info(message);
growl.info(message, config);
growl.success(message);
growl.success(message, config);
growl.general(message);
growl.general(message, config);
growl.general(message, config, "error");
growl.onlyUnique();
growl.reverseOrder();
growl.inlineMessages();
growl.position();
growlMessages.initDirective(1, 10);
var messages:angular.growl.IGrowlMessage[] = growlMessages.getAllMessages(2);
growlMessages.destroyAllMessages(0);
growlMessages.addMessage(messages[0]);
growlMessages.deleteMessage(messages[1]);
var testMessage = growl.warning(message);
testMessage.setText("Some other message");
testMessage.destroy();
});