fix($location): don't rewrite when link is shift-clicked

Closes #9904
Closes #9906
This commit is contained in:
Peter Bacon Darwin
2015-01-25 00:36:44 +00:00
parent 4ae8a2a4b6
commit 939ca37cfe
2 changed files with 14 additions and 1 deletions
+1 -1
View File
@@ -837,7 +837,7 @@ function $LocationProvider() {
// TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
// currently we open nice url link and redirect then
if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.which == 2) return;
if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;
var elm = jqLite(event.target);
+13
View File
@@ -1505,6 +1505,19 @@ describe('$location', function() {
});
it('should not rewrite when clicked with shift pressed', function() {
configureService({linkHref: 'base/a?b=c', html5Mode: true, supportHist: true});
inject(
initBrowser(),
initLocation(),
function($browser) {
browserTrigger(link, 'click', { keys: ['shift'] });
expectNoRewrite($browser);
}
);
});
it('should not mess up hash urls when clicking on links in hashbang mode', function() {
var base;
module(function() {