aboutsummaryrefslogtreecommitdiffstats
path: root/test/jQueryPatchSpec.js
diff options
context:
space:
mode:
authorMisko Hevery2011-09-08 13:56:29 -0700
committerIgor Minar2011-10-11 11:01:45 -0700
commit4f78fd692c0ec51241476e6be9a4df06cd62fdd6 (patch)
tree91f70bb89b9c095126fbc093f51cedbac5cb0c78 /test/jQueryPatchSpec.js
parentdf6d2ba3266de405ad6c2f270f24569355706e76 (diff)
downloadangular.js-4f78fd692c0ec51241476e6be9a4df06cd62fdd6.tar.bz2
feat(forms): new and improved forms
Diffstat (limited to 'test/jQueryPatchSpec.js')
-rw-r--r--test/jQueryPatchSpec.js57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/jQueryPatchSpec.js b/test/jQueryPatchSpec.js
new file mode 100644
index 00000000..0953bdac
--- /dev/null
+++ b/test/jQueryPatchSpec.js
@@ -0,0 +1,57 @@
+'use strict';
+
+if (window.jQuery) {
+
+ describe('jQuery patch', 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 = $('<div><span class=first>abc</span><span class=second>xyz</span></div>');
+ doc.find('span.first').bind('$destroy', spy1);
+ doc.find('span.second').bind('$destroy', spy2);
+ });
+
+ afterEach(function(){
+ expect(divSpy).not.toHaveBeenCalled();
+
+ expect(spy1).toHaveBeenCalled();
+ expect(spy1.callCount).toEqual(1);
+ expect(spy2).toHaveBeenCalled();
+ expect(spy2.callCount).toEqual(1);
+ });
+
+ describe('$detach event', function(){
+
+ it('should fire on detach()', function(){
+ doc.find('span').detach();
+ });
+
+ it('should fire on remove()', function(){
+ doc.find('span').remove();
+ });
+
+ it('should fire on replaceWith()', function(){
+ doc.find('span').replaceWith('<b>bla</b>');
+ });
+
+ it('should fire on replaceAll()', function(){
+ $('<b>bla</b>').replaceAll(doc.find('span'));
+ });
+
+ it('should fire on empty()', function(){
+ doc.empty();
+ });
+
+ it('should fire on html()', function(){
+ doc.html('abc');
+ });
+ });
+ });
+}