Use toString for objects if it has been overriden

This commit is contained in:
Paul Jolly
2015-09-25 19:43:19 +01:00
parent 375a6f9fda
commit d0ad9b98cd
2 changed files with 10 additions and 0 deletions

View File

@@ -181,6 +181,14 @@ describe("j$.pp", function () {
expect(j$.pp(obj)).toEqual("strung");
});
it("should stringify objects that implement custom toString", function () {
var obj = {
toString: function () { return "my toString"; }
};
expect(j$.pp(obj)).toEqual("my toString");
});
it("should handle objects with null prototype", function() {
if (jasmine.getEnv().ieVersion < 9) { return; }