From 7b8a23453f6c6b2e893380513e9bcfe1df84f14c Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Wed, 22 Jan 2014 23:09:42 -0800 Subject: [PATCH] Cleanup lodashBizarro code to get coverage up in AMD modules. --- test/index.html | 37 +++++++++++++++---------------------- test/test.js | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 25 deletions(-) diff --git a/test/index.html b/test/index.html index 4775f1776..08387de05 100644 --- a/test/index.html +++ b/test/index.html @@ -14,6 +14,7 @@ +
@@ -51,14 +52,11 @@ Function.prototype._method = function() {}; // allow bypassing native checks - setProperty(Function.prototype, 'toString', (function() { - function toString() { - return this.toString !== toString ? this.toString() : func.call(this); - } - var func = Function.prototype.toString; - setProperty(Function.prototype, '_toString', func); - return toString; - }())); + var _toString = Function.prototype.toString; + setProperty(Function.prototype, '_toString', _toString); + setProperty(Function.prototype, 'toString', function() { + return this === Set ? this.toString() : _toString.call(this); + }); // set bad shims setProperty(Array, '_isArray', Array.isArray); @@ -91,7 +89,6 @@ setProperty(String.prototype, '_trimRight', String.prototype.trimRight); setProperty(String.prototype, 'trimRight', String.prototype._trimRight ? function() {} : String); - setProperty(window, '_Set', window.Set); setProperty(window, 'WinRTError', Error); setProperty(document, '_createDocumentFragment', document.createDocumentFragment); @@ -129,11 +126,6 @@ } else { delete Object.keys; } - if (window._Set) { - setProperty(window, 'Set', _Set); - } else { - setProperty(window, 'Set', undefined); - } for (var key in { 'contains': true, 'trim': true, @@ -164,11 +156,11 @@ delete Object._keys; } - addBizarroMethods(); - // load Lo-Dash and expose it to the bad extensions/shims - document.write('