Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit fc8034b

Browse files
committed
feat(ngMock.$timeout): remove flushNext method
1 parent d707114 commit fc8034b

File tree

3 files changed

+10
-26
lines changed

3 files changed

+10
-26
lines changed

src/ngMock/angular-mocks.js

+7-23
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@ angular.mock.$Browser = function() {
7575
};
7676

7777

78+
/**
79+
* @name ngMock.$browser#defer.now
80+
* @propertyOf ngMock.$browser
81+
*
82+
* @description
83+
* Current milliseconds mock time.
84+
*/
7885
self.defer.now = 0;
7986

8087

@@ -119,29 +126,6 @@ angular.mock.$Browser = function() {
119126
}
120127
};
121128

122-
/**
123-
* @name ngMock.$browser#defer.flushNext
124-
* @methodOf ngMock.$browser
125-
*
126-
* @description
127-
* Flushes next pending request and compares it to the provided delay
128-
*
129-
* @param {number=} expectedDelay the delay value that will be asserted against the delay of the next timeout function
130-
*/
131-
self.defer.flushNext = function(expectedDelay) {
132-
var tick = self.deferredFns.shift();
133-
expect(tick.time).toEqual(expectedDelay);
134-
tick.fn();
135-
};
136-
137-
/**
138-
* @name ngMock.$browser#defer.now
139-
* @propertyOf ngMock.$browser
140-
*
141-
* @description
142-
* Current milliseconds mock time.
143-
*/
144-
145129
self.$$baseHref = '';
146130
self.baseHref = function() {
147131
return this.$$baseHref;

test/ng/timeoutSpec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ describe('$timeout', function() {
7777
var promise2 = $timeout(function() {}, 100, false);
7878
expect(cancelSpy).not.toHaveBeenCalled();
7979

80-
$timeout.flushNext(0);
80+
$timeout.flush(0);
8181

8282
// Promise1 deferred object should already be removed from the list and not cancellable
8383
$timeout.cancel(promise1);

test/ngMock/angular-mocksSpec.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,9 @@ describe('ngMock', function() {
417417

418418
$timeout(iterate, 100);
419419
$timeout(iterate, 123);
420-
$timeout.flushNext(100);
420+
$timeout.flush(100);
421421
expect(count).toBe(1);
422-
$timeout.flushNext(123);
422+
$timeout.flush(123);
423423
expect(count).toBe(2);
424424
}));
425425
});

0 commit comments

Comments
 (0)