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
This commit is contained in:
Tobias Bosch
2014-09-02 09:10:43 -07:00
parent 9525d0ad1d
commit fc706d13d8
3 changed files with 1 additions and 10 deletions

View File

@@ -120,7 +120,7 @@ angular.mock.$Browser = function() {
}
};
self.$$baseHref = '';
self.$$baseHref = '/';
self.baseHref = function() {
return this.$$baseHref;
};

View File

@@ -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;
});
};
}

View File

@@ -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('<a href="http://server/somePath">link</a>');
$compile($rootElement)($rootScope);