feat(ngMock.$timeout): remove flushNext method

This commit is contained in:
Vojta Jina
2013-09-05 12:01:31 -07:00
parent d70711481e
commit fc8034b352
3 changed files with 10 additions and 26 deletions

View File

@@ -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;
@@ -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;

View File

@@ -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);

View File

@@ -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);
}));
});