Created
February 1, 2011 01:39
-
-
Save sdesai/805247 to your computer and use it in GitHub Desktop.
Patch node.remove to fix single box widget destructor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
testSingleBoxDestroy: function() { | |
(function(origRemove) { | |
Y.Node.prototype.remove = function() { | |
if (this._node) { | |
origRemove.apply(this, arguments); | |
} | |
} | |
})(Y.Node.prototype.remove); | |
function MyWidget() { | |
MyWidget.superclass.constructor.apply(this, arguments); | |
}; | |
MyWidget.NAME = "myWidget"; | |
Y.extend(MyWidget, Y.Widget, { | |
CONTENT_TEMPLATE:null | |
}); | |
var w = new MyWidget(); | |
try { | |
w.destroy(); | |
} catch(e) { | |
Y.Assert.fail("w.destroy() on a single box widget threw an exception" + e); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment