fix(platform-browser): support customEqualityTesters when overriding Jasmine toEqual

This commit is contained in:
Vikram Subramanian 2017-10-04 02:49:12 -07:00 committed by Alex Rickabaugh
parent 696af79dc7
commit f580ffab4f
1 changed files with 3 additions and 2 deletions

View File

@ -114,10 +114,11 @@ export const expect: (actual: any) => NgMatchers = <any>_global.expect;
_global.beforeEach(function() {
jasmine.addMatchers({
// Custom handler for Map as Jasmine does not support it yet
toEqual: function(util) {
toEqual: function(
util: jasmine.MatchersUtil, customEqualityTesters: jasmine.CustomEqualityTester[]) {
return {
compare: function(actual: any, expected: any) {
return {pass: util.equals(actual, expected, [compareMap])};
return {pass: util.equals(actual, expected, [compareMap, ...customEqualityTesters])};
}
};