From 815053e403ace666b2383643227ecde5f36742c5 Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski Date: Tue, 30 Apr 2013 11:29:07 +0200 Subject: fix(jqLite): correctly monkey-patch core jQuery methods When real jQuery is present, Angular monkey patch it to fire `$destroy` event. This commit fixes two issues in the jQuery patch: - passing a selector to the $.fn.remove method (only fire `$destroy` on the matched elements) - using `$.fn.html` without parameters as a getter (do not fire `$destroy`) --- test/jQueryPatchSpec.js | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) (limited to 'test/jQueryPatchSpec.js') diff --git a/test/jQueryPatchSpec.js b/test/jQueryPatchSpec.js index 19f4d821..0680a0c3 100644 --- a/test/jQueryPatchSpec.js +++ b/test/jQueryPatchSpec.js @@ -49,9 +49,55 @@ if (window.jQuery) { doc.empty(); }); - it('should fire on html()', function() { + it('should fire on html(param)', function() { doc.html('abc'); }); + + it('should fire on html(\'\')', function() { + doc.html(''); + }); + }); + }); + + describe('jQuery patch eagerness', function() { + + var doc = null; + var divSpy = null; + var spy1 = null; + var spy2 = null; + + beforeEach(function() { + divSpy = jasmine.createSpy('div.$destroy'); + spy1 = jasmine.createSpy('span1.$destroy'); + spy2 = jasmine.createSpy('span2.$destroy'); + doc = $('