From 2c69a6735e8af5d1b9b73fd221274d374e8efdea Mon Sep 17 00:00:00 2001 From: Misko Hevery Date: Mon, 6 May 2013 14:53:45 -0700 Subject: fix($location): prevent navigation when event isDefaultPrevented --- test/ng/locationSpec.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js index cf7ceaf4..c4a88fd9 100644 --- a/test/ng/locationSpec.js +++ b/test/ng/locationSpec.js @@ -835,6 +835,12 @@ describe('$location', function() { jqLite(link).attr('href', 'http://host.com/base/'); browserTrigger(link, 'click'); expectRewriteTo($browser, 'http://host.com/base/'); + + jqLite(link). + attr('href', 'http://host.com/base/foo'). + bind('click', function(e) { e.preventDefault(); }); + browserTrigger(link, 'click'); + expect($browser.url()).toBe('http://host.com/base/'); } ); }); @@ -1372,6 +1378,7 @@ describe('$location', function() { expect(location.$$rewrite('http://other')).toEqual(undefined); expect(location.$$rewrite('http://server/pre/')).toEqual('http://server/pre/'); expect(location.$$rewrite('http://server/pre/#otherPath')).toEqual('http://server/pre/#otherPath'); + expect(location.$$rewrite('javascript:void(0)')).toEqual(undefined); }); }); -- cgit v1.2.3