-
Notifications
You must be signed in to change notification settings - Fork 10
/
AlertSpec.js
executable file
·58 lines (49 loc) · 2.51 KB
/
AlertSpec.js
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
describe('PROVIDER: GumgaAlert', function() {
var scope
, controller
, Alert;
beforeEach(module('gumga.services.alert'));
angular.module('myOtherApp',[]);
beforeEach(function(){
inject(function ($rootScope,GumgaAlert) {
Alert = GumgaAlert;
scope = $rootScope.$new();
spyOn(Alert,'_notify');
})
angular.module('testApp',[])
.config(function(GumgaAlertProvider){})
angular.module('myOtherApp','testApp');
})
it('Should call notify with danger and without any options',function(){
Alert.createDangerMessage('Error','404');
expect(Alert._notify).toHaveBeenCalledWith('danger','Error','404',{});
})
it('Should call notify with danger and with options',function(){
Alert.createDangerMessage('Error','404',{offset: 30,timer: 500});
expect(Alert._notify).toHaveBeenCalledWith('danger','Error','404',{offset: 30,timer: 500});
})
it('Should call notify with info and without any options',function(){
Alert.createInfoMessage('Info','You have some pending updates');
expect(Alert._notify).toHaveBeenCalledWith('info','Info','You have some pending updates',{});
})
it('Should call notify with warning and with options',function(){
Alert.createInfoMessage('Info','You have some pending updates',{offset: 30,timer: 500,delay: 500, alowDismiss: false});
expect(Alert._notify).toHaveBeenCalledWith('info','Info','You have some pending updates',{offset: 30,timer: 500,delay: 500, alowDismiss: false});
})
it('Should call notify with warning and without any options',function(){
Alert.createWarningMessage('Warning','You have some pending updates');
expect(Alert._notify).toHaveBeenCalledWith('warn','Warning','You have some pending updates',{});
})
it('Should call notify with info and with options',function(){
Alert.createWarningMessage('Warning','You have some pending updates',{offset: 30,timer: 500,delay: 500, alowDismiss: false});
expect(Alert._notify).toHaveBeenCalledWith('warn','Warning','You have some pending updates',{offset: 30,timer: 500,delay: 500, alowDismiss: false});
})
it('Should call success with warning and without any options',function(){
Alert.createSuccessMessage('Yes!','It worked!');
expect(Alert._notify).toHaveBeenCalledWith('success','Yes!','It worked!',{});
})
it('Should call success with info and with options',function(){
Alert.createSuccessMessage('Yes!','It worked!',{offset: 30,timer: 500,delay: 500, alowDismiss: false});
expect(Alert._notify).toHaveBeenCalledWith('success','Yes!','It worked!',{offset: 30,timer: 500,delay: 500, alowDismiss: false});
})
});