Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
chore(tests): bump to 1.4.5
Browse files Browse the repository at this point in the history
Closes #4303
  • Loading branch information
Foxandxss authored and wesleycho committed Aug 28, 2015
1 parent 9b094a0 commit 5a44eb2
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/collapse/test/collapse.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('collapse directive', function() {
var collapseHeight = element.height();
scope.exp = true;
scope.$digest();
expect(element.height()).toBeGreaterThan(collapseHeight);
expect(element.height()).toBe(collapseHeight);
});

it('should shrink accordingly when content size inside collapse decreases', function() {
Expand Down
25 changes: 17 additions & 8 deletions src/dropdown/test/dropdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,14 @@ describe('dropdownToggle', function() {
it('should call it correctly when toggles', function() {
$rootScope.isopen = true;
$rootScope.$digest();
$animate.triggerCallbacks();

$animate.flush();
$rootScope.$digest();
expect($rootScope.toggleHandler).toHaveBeenCalledWith(true);

clickDropdownToggle();
$animate.triggerCallbacks();
$animate.flush();
$rootScope.$digest();
expect($rootScope.toggleHandler).toHaveBeenCalledWith(false);
});
});
Expand All @@ -343,19 +346,22 @@ describe('dropdownToggle', function() {
});

it('should not have been called initially', function() {
$animate.triggerCallbacks();
expect($rootScope.toggleHandler).not.toHaveBeenCalled();
});

it('should call it correctly when toggles', function() {
$rootScope.isopen = false;
$rootScope.$digest();
$animate.triggerCallbacks();

$animate.flush();
$rootScope.$digest();
expect($rootScope.toggleHandler).toHaveBeenCalledWith(false);

$rootScope.isopen = true;
$rootScope.$digest();
$animate.triggerCallbacks();

$animate.flush();
$rootScope.$digest();
expect($rootScope.toggleHandler).toHaveBeenCalledWith(true);
});
});
Expand All @@ -368,17 +374,20 @@ describe('dropdownToggle', function() {
});

it('should not have been called initially', function() {
$animate.triggerCallbacks();
expect($rootScope.toggleHandler).not.toHaveBeenCalled();
});

it('should call it when clicked', function() {
clickDropdownToggle();
$animate.triggerCallbacks();

$animate.flush();
$rootScope.$digest();
expect($rootScope.toggleHandler).toHaveBeenCalledWith(true);

clickDropdownToggle();
$animate.triggerCallbacks();

$animate.flush();
$rootScope.$digest();
expect($rootScope.toggleHandler).toHaveBeenCalledWith(false);
});
});
Expand Down
19 changes: 19 additions & 0 deletions src/modal/test/modal.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ describe('$modal', function () {
$rootScope.$digest();
if (!noFlush) {
$animate.flush();
$rootScope.$digest();
$animate.flush();
$rootScope.$digest();
}
return closed;
}
Expand All @@ -164,6 +167,9 @@ describe('$modal', function () {
$rootScope.$digest();
if (!noFlush) {
$animate.flush();
$rootScope.$digest();
$animate.flush();
$rootScope.$digest();
}
return closed;
}
Expand Down Expand Up @@ -233,6 +239,8 @@ describe('$modal', function () {
triggerKeyDown($document, 27);
$animate.flush();
$rootScope.$digest();
$animate.flush();
$rootScope.$digest();

expect($document).toHaveModalsOpen(0);
});
Expand All @@ -253,6 +261,8 @@ describe('$modal', function () {
triggerKeyDown(button, 27);
$animate.flush();
$rootScope.$digest();
$animate.flush();
$rootScope.$digest();

expect($document).toHaveModalsOpen(0);

Expand All @@ -268,6 +278,8 @@ describe('$modal', function () {
$document.find('body > div.modal').click();
$animate.flush();
$rootScope.$digest();
$animate.flush();
$rootScope.$digest();

expect($document).toHaveModalsOpen(0);
});
Expand All @@ -286,6 +298,8 @@ describe('$modal', function () {
triggerKeyDown($document, 27);
$animate.flush();
$rootScope.$digest();
$animate.flush();
$rootScope.$digest();

expect(document.activeElement.tagName).toBe('A');
expect($document).toHaveModalsOpen(0);
Expand All @@ -310,6 +324,8 @@ describe('$modal', function () {
triggerKeyDown($document, 27);
$animate.flush();
$rootScope.$digest();
$animate.flush();
$rootScope.$digest();

expect(document.activeElement.tagName).toBe('BODY');
expect($document).toHaveModalsOpen(0);
Expand Down Expand Up @@ -339,6 +355,9 @@ describe('$modal', function () {
expect(modal.result).toBeRejectedWith('$uibUnscheduledDestruction');

$animate.flush();
$rootScope.$digest();
$animate.flush();
$rootScope.$digest();
expect($document).toHaveModalsOpen(0);
});

Expand Down

0 comments on commit 5a44eb2

Please sign in to comment.