Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit dbb8483

Browse files
committed
refactor(matchers): add the toEqualOneOf matcher
1 parent 6341f42 commit dbb8483

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

test/helpers/matchers.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ beforeEach(function() {
3232
};
3333
}
3434

35+
function DOMTester(a, b) {
36+
if (a && b && a.nodeType > 0 && b.nodeType > 0) {
37+
return a === b;
38+
}
39+
}
40+
3541
function isNgElementHidden(element) {
3642
// we need to check element.getAttribute for SVG nodes
3743
var hidden = true;
@@ -111,12 +117,19 @@ beforeEach(function() {
111117
};
112118
}
113119
};
120+
},
114121

115-
function DOMTester(a, b) {
116-
if (a && b && a.nodeType > 0 && b.nodeType > 0) {
117-
return a === b;
122+
toEqualOneOf: function(util) {
123+
return {
124+
compare: function(actual) {
125+
var expectedArgs = Array.prototype.slice.call(arguments, 1);
126+
return {
127+
pass: expectedArgs.some(function(expected) {
128+
return util.equals(actual, expected, [DOMTester]);
129+
})
130+
};
118131
}
119-
}
132+
};
120133
},
121134

122135
toEqualData: function() {

0 commit comments

Comments
 (0)