From f196faf0bbec55b2b912644f8b513214d6000980 Mon Sep 17 00:00:00 2001 From: Gregg Van Hove Date: Thu, 25 Aug 2016 15:29:32 -0700 Subject: [PATCH] Update anonymous constructor pretty print specs to work in IE --- spec/core/PrettyPrintSpec.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/spec/core/PrettyPrintSpec.js b/spec/core/PrettyPrintSpec.js index 4783ac4e..fcaab1e6 100644 --- a/spec/core/PrettyPrintSpec.js +++ b/spec/core/PrettyPrintSpec.js @@ -189,24 +189,13 @@ describe("jasmineUnderTest.pp", function () { expect(jasmineUnderTest.pp(obj)).toEqual("my toString"); }); - it("should stringify objects from named constructors with custom toString", function () { - var MyNamedConstructor = function MyNamedConstructor () {}; - MyNamedConstructor.toString = function () { return ""; }; - - var a = {}; - a.constructor = MyNamedConstructor; - - expect(jasmineUnderTest.pp(a)).toEqual("MyNamedConstructor({ constructor: Function })"); - }); - it("should stringify objects from anonymous constructors with custom toString", function () { - var MyAnonymousConstructor = function () {}; - MyAnonymousConstructor.toString = function () { return ""; }; + var MyAnonymousConstructor = (function() { return function () {}; })(); + MyAnonymousConstructor.toString = function () { return ''; }; - var a = {}; - a.constructor = MyAnonymousConstructor; + var a = new MyAnonymousConstructor(); - expect(jasmineUnderTest.pp(a)).toEqual("({ constructor: Function })"); + expect(jasmineUnderTest.pp(a)).toEqual("({ })"); }); it("should handle objects with null prototype", function() {