aboutsummaryrefslogtreecommitdiffstats
path: root/test/ngMock
diff options
context:
space:
mode:
Diffstat (limited to 'test/ngMock')
-rw-r--r--test/ngMock/angular-mocksSpec.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/test/ngMock/angular-mocksSpec.js b/test/ngMock/angular-mocksSpec.js
index 88e1876f..67fd13a1 100644
--- a/test/ngMock/angular-mocksSpec.js
+++ b/test/ngMock/angular-mocksSpec.js
@@ -404,7 +404,7 @@ describe('ngMock', function() {
expect(function() {$timeout.flush(100);}).toThrow();
expect(log).toEqual(['t1']);
- $timeout.flush(900);
+ $timeout.flush(1000);
expect(log).toEqual(['t1', 't2']);
expect(function() {$timeout.flush();}).toThrow();
});
@@ -425,6 +425,21 @@ describe('ngMock', function() {
});
+ it('should not update the current time if an exception is thrown during a flush', function() {
+ $timeout(log.fn('t1'), 100);
+ $timeout(log.fn('t2'), 101);
+
+ expect(function() { $timeout.flush(90); }).toThrow();
+ expect(function() { $timeout.flush(90); }).toThrow();
+
+ $timeout.flush(100);
+ expect(log).toEqual(['t1']);
+
+ $timeout.flush(1);
+ expect(log).toEqual(['t1', 't2']);
+ });
+
+
describe('verifyNoPendingTasks', function() {
it('should throw an exception when not flushed', function() {