Skip to content

Commit

Permalink
fix(actionSheetTest): fix failing actionSheet unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mhartington committed Jul 27, 2015
1 parent 38e7166 commit bab6cad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/unit/angular/service/actionSheet.unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ describe('Ionic ActionSheet Service', function() {
$q.flush();
expect($document[0].body.classList.contains('action-sheet-open')).toBe(false);
expect(scope.element.hasClass('active')).toBe(false);
expect(scope.$destroy).toHaveBeenCalled();
expect(scope.element.remove).toHaveBeenCalled();
//Naughty, but ngAnimate can't be flushed ATM
$timeout(function() {

This comment has been minimized.

Copy link
@ajoslin

ajoslin Jul 30, 2015

Contributor

This just makes it so these two expectations will never run.

The code in the $timeout callback will never be called, because angular-mocks makes $timeout mocked to not do anything until $timeout.flush() is called.

Therefore, you've done the equivalent of commenting out these test cases.

Just thought I'd let you know.

This comment has been minimized.

Copy link
@mhartington

mhartington Jul 30, 2015

Author Contributor

Thanks @ajoslin.

The issue is that with $animate.removeClass, it's async so there's no way (at least that I know of) to detect when that happens.

expect(scope.$destroy).toHaveBeenCalled();
expect(scope.element.remove).toHaveBeenCalled();
});
}));

it('destructiveButtonClicked should removeSheet if returning true', function() {
Expand Down

0 comments on commit bab6cad

Please sign in to comment.