diff options
| author | Jeff Cross | 2013-11-05 23:30:48 -0800 |
|---|---|---|
| committer | Jeff Cross | 2013-11-06 00:14:11 -0800 |
| commit | 6fb191570ee72f087e8bb6b1d8f5eea0f585886c (patch) | |
| tree | 42d294dffa1e78424a733e80035f7fd887dca3fb /src/ngMock/angular-mocks.js | |
| parent | d378f5500ab2eef0779338336c6a95656505ebb8 (diff) | |
| download | angular.js-6fb191570ee72f087e8bb6b1d8f5eea0f585886c.tar.bz2 | |
fix(ngMock): throw more descriptive errors for $animate.flushNext()
Diffstat (limited to 'src/ngMock/angular-mocks.js')
| -rw-r--r-- | src/ngMock/angular-mocks.js | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js index b854501d..f3a6138e 100644 --- a/src/ngMock/angular-mocks.js +++ b/src/ngMock/angular-mocks.js @@ -562,7 +562,7 @@ angular.mock.$IntervalProvider = function() { */ (function() { var R_ISO8061_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?:\:?(\d\d)(?:\:?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/; - + function jsonStringToDate(string) { var match; if (match = string.match(R_ISO8061_STR)) { @@ -776,7 +776,12 @@ angular.mock.animate = angular.module('mock.animate', ['ng']) enabled : $delegate.enabled, flushNext : function(name) { var tick = animate.queue.shift(); - expect(tick.method).toBe(name); + + if (!tick) throw new Error('No animation to be flushed'); + if(tick.method !== name) { + throw new Error('The next animation is not "' + name + + '", but is "' + tick.method + '"'); + } tick.fn(); return tick; } @@ -1191,7 +1196,7 @@ function createHttpBackendMock($rootScope, $delegate, $browser) { * @returns {requestHandler} Returns an object with `respond` method that controls how a matched * request is handled. * - * - respond – + * - respond – * `{function([status,] data[, headers])|function(function(method, url, data, headers)}` * – The respond method takes a set of static data to be returned or a function that can return * an array containing response status (number), response data (string) and response headers @@ -2122,4 +2127,4 @@ angular.mock.clearDataCache = function() { } } }; -})(window); +})(window);
\ No newline at end of file |
