From 607708e981a7e35e5b35eec69bcf592050949ad7 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 2 Sep 2014 09:10:43 -0700 Subject: [PATCH] fix($location): set `baseHref` in mock browser to `/` Set the default value for the base tag in the mock browser to `/`, as we now always require a base tag to be present for html5 mode. Fixes #8866. --- src/ngMock/angular-mocks.js | 2 +- test/ng/anchorScrollSpec.js | 4 ---- test/ng/locationSpec.js | 5 ----- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/ngMock/angular-mocks.js b/src/ngMock/angular-mocks.js index a8c29e7c7d6c..24bbcd41371c 100644 --- a/src/ngMock/angular-mocks.js +++ b/src/ngMock/angular-mocks.js @@ -120,7 +120,7 @@ angular.mock.$Browser = function() { } }; - self.$$baseHref = ''; + self.$$baseHref = '/'; self.baseHref = function() { return this.$$baseHref; }; diff --git a/test/ng/anchorScrollSpec.js b/test/ng/anchorScrollSpec.js index a387094bf44f..e7933d630195 100644 --- a/test/ng/anchorScrollSpec.js +++ b/test/ng/anchorScrollSpec.js @@ -110,10 +110,6 @@ describe('$anchorScroll', function() { return function($provide, $locationProvider) { $provide.value('$sniffer', {history: config.historyApi}); $locationProvider.html5Mode(config.html5Mode); - $provide.decorator('$browser', function($delegate) { - $delegate.$$baseHref = '/'; - return $delegate; - }); }; } diff --git a/test/ng/locationSpec.js b/test/ng/locationSpec.js index 391f13a9cae5..ca0a9fd0d5a2 100644 --- a/test/ng/locationSpec.js +++ b/test/ng/locationSpec.js @@ -100,7 +100,6 @@ describe('$location', function() { /* global Browser: false */ var b = new Browser($window, $document, fakeLog, sniffer); b.pollFns = []; - b.$$baseHref = '/'; return b; }; }); @@ -1541,10 +1540,6 @@ describe('$location', function() { it('should listen on click events on href and prevent browser default in html5 mode', function() { module(function($locationProvider, $provide) { $locationProvider.html5Mode(true); - $provide.decorator('$browser', function($delegate) { - $delegate.$$baseHref = '/'; - return $delegate; - }); return function($rootElement, $compile, $rootScope) { $rootElement.html('link'); $compile($rootElement)($rootScope);