GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — angular.js/test/jQueryPatchSpec.js at master · gwright/angular.js Expand file tree/ Copy pathjQueryPatchSpec.jsMore file actions 103 lines (81 loc) · 2.76 KB / Copy pathjQueryPatchSpec.jsFile metadata and controls103 lines (81 loc) · 2.76 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 '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(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 = $('<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).not.toHaveBeenCalled(); }); describe('$detach event is not invoked in too many cases', function() { it('should fire only on matched elements on detach(selector)', function() { doc.find('span').detach('.second'); expect(spy2).toHaveBeenCalled(); expect(spy2.callCount).toEqual(1); }); it('should fire only on matched elements on remove(selector)', function() { doc.find('span').remove('.second'); expect(spy2).toHaveBeenCalled(); expect(spy2.callCount).toEqual(1); }); it('should not fire on html()', function() { doc.html(); expect(spy2).not.toHaveBeenCalled(); }); }); }); } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |