From b27fb8a6448b7c8d59b533fe2df9497170fbaa70 Mon Sep 17 00:00:00 2001 From: Shyam Seshadri Date: Wed, 11 Aug 2010 11:42:04 -0700 Subject: Fix toEqual matcher to use angular.equals instead of simple == comparison, which breaks down for arrays and objects --- test/scenario/MatcherSpec.js | 8 ++++++++ test/testabilityPatch.js | 15 +++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/scenario/MatcherSpec.js b/test/scenario/MatcherSpec.js index c47f0c25..2eddd2bc 100644 --- a/test/scenario/MatcherSpec.js +++ b/test/scenario/MatcherSpec.js @@ -27,4 +27,12 @@ describe('Matcher', function () { expect(e).toEqual('Expected 456 but was 123'); } }); + it('should correctly match arrays', function() { + var future = $scenario.addFuture('Calculate first future', function(done) { + done(['a', 'b']); + }); + matcher = new Matcher(this, future); + matcher.toEqual(['a', 'b']); + executeFutures(); + }); }); \ No newline at end of file diff --git a/test/testabilityPatch.js b/test/testabilityPatch.js index 5d0df780..e9a88b67 100644 --- a/test/testabilityPatch.js +++ b/test/testabilityPatch.js @@ -35,22 +35,25 @@ function childNode(element, index) { } extend(angular, { - 'bind': bind, + 'element': jqLite, 'compile': compile, + 'scope': createScope, 'copy': copy, - 'element': jqLite, 'extend': extend, + 'equals': equals, 'foreach': foreach, + 'noop':noop, + 'bind':bind, + 'toJson': toJson, + 'fromJson': fromJson, 'identity':identity, 'isUndefined': isUndefined, 'isDefined': isDefined, - 'isObject': isObject, 'isString': isString, 'isFunction': isFunction, + 'isObject': isObject, 'isNumber': isNumber, - 'isArray': isArray, - 'noop':noop, - 'scope': createScope + 'isArray': isArray }); -- cgit v1.2.3