fix(router): improve error for missing base href

Closes #3096
This commit is contained in:
Brian Ford
2015-07-17 12:14:48 -07:00
parent 8296dcec09
commit 011fab37af
2 changed files with 17 additions and 2 deletions
@@ -75,5 +75,13 @@ export function main() {
location.go('user/btford');
expect(locationStrategy.path()).toEqual('/my/custom/href/user/btford');
});
it('should throw when no base href is provided', () => {
var locationStrategy = new MockLocationStrategy();
locationStrategy.internalBaseHref = null;
expect(() => new Location(locationStrategy))
.toThrowError(
`No base href set. Either provide a binding to "appBaseHrefToken" or add a base element.`);
});
});
}