@@ -25,14 +25,17 @@ describe('Ionic ActionSheet Service', function() {
25
25
expect(scope.element.hasClass('active')).toBe(true);
26
26
}));
27
27
28
- it('removeSheet should remove classes, remove element and destroy scope', inject(function($document, $timeout) {
28
+ it('removeSheet should remove classes, remove element and destroy scope', inject(function($document, $timeout, $animate) {
29
+ spyOn($animate, 'removeClass').andCallFake(function(el, cls, cb) {
30
+ el.removeClass(cls);
31
+ cb();
32
+ });
29
33
var scope = setup();
30
34
spyOn(scope, '$destroy');
31
35
spyOn(scope.element, 'remove');
32
36
scope.removeSheet();
33
37
expect($document[0].body.classList.contains('action-sheet-open')).toBe(false);
34
38
expect(scope.element.hasClass('active')).toBe(false);
35
- $timeout.flush();
36
39
expect(scope.$destroy).toHaveBeenCalled();
37
40
expect(scope.element.remove).toHaveBeenCalled();
38
41
}));
@@ -66,15 +69,18 @@ describe('Ionic ActionSheet Service', function() {
66
69
expect(scope.removeSheet).toHaveBeenCalled();
67
70
});
68
71
69
- it('cancel should removeSheet and call opts.cancel', inject(function($timeout) {
72
+ it('cancel should removeSheet and call opts.cancel', inject(function($timeout, $animate) {
73
+ spyOn($animate, 'removeClass').andCallFake(function(el, cls, cb) {
74
+ el.removeClass(cls);
75
+ cb();
76
+ });
70
77
var cancelSpy = jasmine.createSpy('opts.cancel');
71
78
var scope = setup({
72
79
cancel: cancelSpy
73
80
});
74
81
spyOn(scope, 'removeSheet').andCallThrough();
75
82
scope.cancel();
76
83
expect(scope.removeSheet).toHaveBeenCalled();
77
- $timeout.flush();
78
84
expect(cancelSpy).toHaveBeenCalled();
79
85
}));
80
86
0 commit comments