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

Remove timeout.flushNext() #3895

Merged
merged 1 commit into from
Oct 2, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 7 additions & 23 deletions src/ngMock/angular-mocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ angular.mock.$Browser = function() {
};


/**
* @name ngMock.$browser#defer.now
* @propertyOf ngMock.$browser
*
* @description
* Current milliseconds mock time.
*/
self.defer.now = 0;


Expand Down Expand Up @@ -119,29 +126,6 @@ angular.mock.$Browser = function() {
}
};

/**
* @name ngMock.$browser#defer.flushNext
* @methodOf ngMock.$browser
*
* @description
* Flushes next pending request and compares it to the provided delay
*
* @param {number=} expectedDelay the delay value that will be asserted against the delay of the next timeout function
*/
self.defer.flushNext = function(expectedDelay) {
var tick = self.deferredFns.shift();
expect(tick.time).toEqual(expectedDelay);
tick.fn();
};

/**
* @name ngMock.$browser#defer.now
* @propertyOf ngMock.$browser
*
* @description
* Current milliseconds mock time.
*/

self.$$baseHref = '';
self.baseHref = function() {
return this.$$baseHref;
Expand Down
2 changes: 1 addition & 1 deletion test/ng/timeoutSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe('$timeout', function() {
var promise2 = $timeout(function() {}, 100, false);
expect(cancelSpy).not.toHaveBeenCalled();

$timeout.flushNext(0);
$timeout.flush(0);

// Promise1 deferred object should already be removed from the list and not cancellable
$timeout.cancel(promise1);
Expand Down
4 changes: 2 additions & 2 deletions test/ngMock/angular-mocksSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,9 @@ describe('ngMock', function() {

$timeout(iterate, 100);
$timeout(iterate, 123);
$timeout.flushNext(100);
$timeout.flush(100);
expect(count).toBe(1);
$timeout.flushNext(123);
$timeout.flush(123);
expect(count).toBe(2);
}));
});
Expand Down