Test comparison of objects from different frames

This commit is contained in:
Ben Christel
2016-07-19 14:31:58 -07:00
parent 7f7dda7a2c
commit a0bce8031e
2 changed files with 28 additions and 2 deletions
+18
View File
@@ -93,6 +93,24 @@ describe("matchersUtil", function() {
expect(jasmineUnderTest.matchersUtil.equals(new Error("foo"), new Error("bar"))).toBe(false);
});
it("fails for objects with different constructors", function() {
function One() {}
function Two() {}
expect(jasmineUnderTest.matchersUtil.equals(new One(), new Two())).toBe(false);
});
if (typeof document === 'object') {
it("passes for equivalent objects from different frames", function() {
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
console.log(iframe);
iframe.contentWindow.eval('window.testObject = {}');
expect(jasmineUnderTest.matchersUtil.equals({}, iframe.contentWindow.testObject)).toBe(true);
document.body.removeChild(iframe);
});
}
it("passes for Objects that are equivalent (simple case)", function() {
expect(jasmineUnderTest.matchersUtil.equals({a: "foo"}, {a: "foo"})).toBe(true);
});