Skip to content

Commit 8c36a66

Browse files
committed
test(actionSheet): fix test for angular v1.2.17
1 parent 89d5553 commit 8c36a66

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/unit/angular/service/actionSheet.unit.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@ describe('Ionic ActionSheet Service', function() {
2525
expect(scope.element.hasClass('active')).toBe(true);
2626
}));
2727

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+
});
2933
var scope = setup();
3034
spyOn(scope, '$destroy');
3135
spyOn(scope.element, 'remove');
3236
scope.removeSheet();
3337
expect($document[0].body.classList.contains('action-sheet-open')).toBe(false);
3438
expect(scope.element.hasClass('active')).toBe(false);
35-
$timeout.flush();
3639
expect(scope.$destroy).toHaveBeenCalled();
3740
expect(scope.element.remove).toHaveBeenCalled();
3841
}));
@@ -66,15 +69,18 @@ describe('Ionic ActionSheet Service', function() {
6669
expect(scope.removeSheet).toHaveBeenCalled();
6770
});
6871

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+
});
7077
var cancelSpy = jasmine.createSpy('opts.cancel');
7178
var scope = setup({
7279
cancel: cancelSpy
7380
});
7481
spyOn(scope, 'removeSheet').andCallThrough();
7582
scope.cancel();
7683
expect(scope.removeSheet).toHaveBeenCalled();
77-
$timeout.flush();
7884
expect(cancelSpy).toHaveBeenCalled();
7985
}));
8086

0 commit comments

Comments
 (0)