mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-06 22:35:22 +08:00
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:
2
src/ngMock/angular-mocks.js
vendored
2
src/ngMock/angular-mocks.js
vendored
@@ -120,7 +120,7 @@ angular.mock.$Browser = function() {
|
||||
}
|
||||
};
|
||||
|
||||
self.$$baseHref = '';
|
||||
self.$$baseHref = '/';
|
||||
self.baseHref = function() {
|
||||
return this.$$baseHref;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user