Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit fc706d1

Browse files
committed
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 Closes #8889
1 parent 9525d0a commit fc706d1

File tree

3 files changed

+1
-10
lines changed

3 files changed

+1
-10
lines changed

src/ngMock/angular-mocks.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ angular.mock.$Browser = function() {
120120
}
121121
};
122122

123-
self.$$baseHref = '';
123+
self.$$baseHref = '/';
124124
self.baseHref = function() {
125125
return this.$$baseHref;
126126
};

test/ng/anchorScrollSpec.js

-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ describe('$anchorScroll', function() {
110110
return function($provide, $locationProvider) {
111111
$provide.value('$sniffer', {history: config.historyApi});
112112
$locationProvider.html5Mode(config.html5Mode);
113-
$provide.decorator('$browser', function($delegate) {
114-
$delegate.$$baseHref = '/';
115-
return $delegate;
116-
});
117113
};
118114
}
119115

test/ng/locationSpec.js

-5
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ describe('$location', function() {
100100
/* global Browser: false */
101101
var b = new Browser($window, $document, fakeLog, sniffer);
102102
b.pollFns = [];
103-
b.$$baseHref = '/';
104103
return b;
105104
};
106105
});
@@ -1541,10 +1540,6 @@ describe('$location', function() {
15411540
it('should listen on click events on href and prevent browser default in html5 mode', function() {
15421541
module(function($locationProvider, $provide) {
15431542
$locationProvider.html5Mode(true);
1544-
$provide.decorator('$browser', function($delegate) {
1545-
$delegate.$$baseHref = '/';
1546-
return $delegate;
1547-
});
15481543
return function($rootElement, $compile, $rootScope) {
15491544
$rootElement.html('<a href="http://server/somePath">link</a>');
15501545
$compile($rootElement)($rootScope);

0 commit comments

Comments
 (0)