Merge branch 'recursive-containing' of https://github.com/cbandy/jasmine into cbandy-recursive-containing
This commit is contained in:
@@ -1382,7 +1382,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
|
||||
if (!hasKey(other, property) && hasKey(this.sample, property)) {
|
||||
mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.');
|
||||
}
|
||||
else if (!j$.matchersUtil.equals(this.sample[property], other[property])) {
|
||||
else if (!j$.matchersUtil.equals(other[property], this.sample[property])) {
|
||||
mismatchValues.push('\'' + property + '\' was \'' + (other[property] ? j$.util.htmlEscape(other[property].toString()) : other[property]) + '\' in actual, but was \'' + (this.sample[property] ? j$.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + '\' in expected.');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,4 +61,10 @@ describe("ObjectContaining", function() {
|
||||
|
||||
expect(containing.jasmineToString()).toMatch("<jasmine.objectContaining");
|
||||
});
|
||||
|
||||
it("matches recursively", function() {
|
||||
var containing = new j$.ObjectContaining({one: new j$.ObjectContaining({two: {}})});
|
||||
|
||||
expect(containing.jasmineMatches({one: {two: {}}})).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -18,7 +18,7 @@ getJasmineRequireObj().ObjectContaining = function(j$) {
|
||||
if (!hasKey(other, property) && hasKey(this.sample, property)) {
|
||||
mismatchKeys.push('expected has key \'' + property + '\', but missing from actual.');
|
||||
}
|
||||
else if (!j$.matchersUtil.equals(this.sample[property], other[property])) {
|
||||
else if (!j$.matchersUtil.equals(other[property], this.sample[property])) {
|
||||
mismatchValues.push('\'' + property + '\' was \'' + (other[property] ? j$.util.htmlEscape(other[property].toString()) : other[property]) + '\' in actual, but was \'' + (this.sample[property] ? j$.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + '\' in expected.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user