From dc8762eff19c595cc5107a1b1cc0842f3801c4a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski?= Date: Wed, 1 Feb 2017 14:10:59 +0100 Subject: [PATCH] chore(anchorScroll): remove a Jasmine toHaveBeenCalled workaround The Jasmine fix landed long time ago and we've updated Jasmine since that happened. --- test/ng/anchorScrollSpec.js | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/test/ng/anchorScrollSpec.js b/test/ng/anchorScrollSpec.js index 22fb13608..b51566808 100644 --- a/test/ng/anchorScrollSpec.js +++ b/test/ng/anchorScrollSpec.js @@ -87,15 +87,7 @@ describe('$anchorScroll', function() { return function($window) { forEach(elmSpy, function(spy, id) { - var count = map[id] || 0; - // TODO(gkalpak): `toHaveBeenCalledTimes()` works correctly with 0 since - // https://github.com/jasmine/jasmine/commit/342f0eb9a38194ecb8559e7df872c72afc0fe52e - // Fix when we upgrade to a version that contains the fix. - if (count > 0) { - expect(spy).toHaveBeenCalledTimes(count); - } else { - expect(spy).not.toHaveBeenCalled(); - } + expect(spy).toHaveBeenCalledTimes(map[id] || 0); }); expect($window.scrollTo).not.toHaveBeenCalled(); }; @@ -401,14 +393,7 @@ describe('$anchorScroll', function() { return function($rootScope, $window) { inject(expectScrollingTo(identifierCountMap)); - // TODO(gkalpak): `toHaveBeenCalledTimes()` works correctly with 0 since - // https://github.com/jasmine/jasmine/commit/342f0eb9a38194ecb8559e7df872c72afc0fe52e - // Fix when we upgrade to a version that contains the fix. - if (list.length > 0) { - expect($window.scrollBy).toHaveBeenCalledTimes(list.length); - } else { - expect($window.scrollBy).not.toHaveBeenCalled(); - } + expect($window.scrollBy).toHaveBeenCalledTimes(list.length); forEach(list, function(offset, idx) { // Due to sub-pixel rendering, there is a +/-1 error margin in the actual offset var args = $window.scrollBy.calls.argsFor(idx);