test(actionSheet): fix test for angular v1.2.17

This commit is contained in:
Andrew Joslin
2014-06-10 15:27:48 -06:00
parent 89d5553d7f
commit 8c36a667d8

View File

@@ -25,14 +25,17 @@ describe('Ionic ActionSheet Service', function() {
expect(scope.element.hasClass('active')).toBe(true);
}));
it('removeSheet should remove classes, remove element and destroy scope', inject(function($document, $timeout) {
it('removeSheet should remove classes, remove element and destroy scope', inject(function($document, $timeout, $animate) {
spyOn($animate, 'removeClass').andCallFake(function(el, cls, cb) {
el.removeClass(cls);
cb();
});
var scope = setup();
spyOn(scope, '$destroy');
spyOn(scope.element, 'remove');
scope.removeSheet();
expect($document[0].body.classList.contains('action-sheet-open')).toBe(false);
expect(scope.element.hasClass('active')).toBe(false);
$timeout.flush();
expect(scope.$destroy).toHaveBeenCalled();
expect(scope.element.remove).toHaveBeenCalled();
}));
@@ -66,7 +69,11 @@ describe('Ionic ActionSheet Service', function() {
expect(scope.removeSheet).toHaveBeenCalled();
});
it('cancel should removeSheet and call opts.cancel', inject(function($timeout) {
it('cancel should removeSheet and call opts.cancel', inject(function($timeout, $animate) {
spyOn($animate, 'removeClass').andCallFake(function(el, cls, cb) {
el.removeClass(cls);
cb();
});
var cancelSpy = jasmine.createSpy('opts.cancel');
var scope = setup({
cancel: cancelSpy
@@ -74,7 +81,6 @@ describe('Ionic ActionSheet Service', function() {
spyOn(scope, 'removeSheet').andCallThrough();
scope.cancel();
expect(scope.removeSheet).toHaveBeenCalled();
$timeout.flush();
expect(cancelSpy).toHaveBeenCalled();
}));