From f1b94b4b599ab701bc75b55bbbbb73c5ef329a93 Mon Sep 17 00:00:00 2001 From: Michał Gołębiowski Date: Wed, 19 Jun 2013 20:52:50 +0100 Subject: feat(jqLite): switch bind/unbind to more recent jQuery on/off jQuery switched to a completely new event binding implementation as of 1.7.0, centering around on/off methods instead of previous bind/unbind. This patch makes jqLite match this implementation while still supporting previous bind/unbind methods. --- test/ng/directive/formSpec.js | 2 +- test/ng/locationSpec.js | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'test/ng') diff --git a/test/ng/directive/formSpec.js b/test/ng/directive/formSpec.js index 0e3695cd..f6173414 100644 --- a/test/ng/directive/formSpec.js +++ b/test/ng/directive/formSpec.js @@ -247,7 +247,7 @@ describe('form', function() { }); doc = $compile('
')(scope); - doc.bind('submit', callback); + doc.on('submit', callback); browserTrigger(doc, 'submit'); expect(callback).toHaveBeenCalledOnce(); diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js index 9e4b3bd6..2bce3e64 100644 --- a/test/ng/locationSpec.js +++ b/test/ng/locationSpec.js @@ -7,7 +7,7 @@ describe('$location', function() { afterEach(function() { // link rewriting used in html5 mode on legacy browsers binds to document.onClick, so we need // to clean this up after each test. - jqLite(document).unbind('click'); + jqLite(document).off('click'); }); describe('NewUrl', function() { @@ -770,7 +770,7 @@ describe('$location', function() { originalBrowser = $browser.url(); // we have to prevent the default operation, as we need to test absolute links (http://...) // and navigating to these links would kill jstd - $rootElement.bind('click', function(e) { + $rootElement.on('click', function(e) { lastEventPreventDefault = e.isDefaultPrevented(); e.preventDefault(); }); @@ -825,7 +825,7 @@ describe('$location', function() { jqLite(link). attr('href', 'http://host.com/base/foo'). - bind('click', function(e) { e.preventDefault(); }); + on('click', function(e) { e.preventDefault(); }); browserTrigger(link, 'click'); expect($browser.url()).toBe('http://host.com/base/'); } @@ -1116,11 +1116,11 @@ describe('$location', function() { var base, clickHandler; module(function($provide) { $provide.value('$rootElement', { - bind: function(event, handler) { + on: function(event, handler) { expect(event).toEqual('click'); clickHandler = handler; }, - unbind: noop + off: noop }); return function($browser) { $browser.url(base = 'http://server/'); @@ -1146,11 +1146,11 @@ describe('$location', function() { var base, clickHandler; module(function($provide) { $provide.value('$rootElement', { - bind: function(event, handler) { + on: function(event, handler) { expect(event).toEqual('click'); clickHandler = handler; }, - unbind: angular.noop + off: angular.noop }); return function($browser) { $browser.url(base = 'http://server/'); @@ -1180,7 +1180,7 @@ describe('$location', function() { $rootElement.html(''); var button = $rootElement.find('button'); - button.bind('click', function() { + button.on('click', function() { button.remove(); }); browserTrigger(button, 'click'); -- cgit v1.2.3