fix(platform-server): correctly implement get href in parse5 adapter (#15022)
This commit is contained in:
parent
778f7d6f33
commit
80649ea03c
|
@ -505,7 +505,7 @@ export class Parse5DomAdapter extends DomAdapter {
|
|||
isShadowRoot(node: any): boolean { return this.getShadowRoot(node) == node; }
|
||||
importIntoDoc(node: any): any { return this.clone(node); }
|
||||
adoptNode(node: any): any { return node; }
|
||||
getHref(el: any): string { return el.href; }
|
||||
getHref(el: any): string { return this.getAttribute(el, 'href'); }
|
||||
resolveAndSetHref(el: any, baseUrl: string, href: string) {
|
||||
if (href == null) {
|
||||
el.href = baseUrl;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
|
||||
import {PlatformLocation, isPlatformServer} from '@angular/common';
|
||||
import {APP_BASE_HREF, PlatformLocation, isPlatformServer} from '@angular/common';
|
||||
import {ApplicationRef, CompilerFactory, Component, NgModule, NgModuleRef, NgZone, PLATFORM_ID, PlatformRef, destroyPlatform, getPlatform} from '@angular/core';
|
||||
import {TestBed, async, inject} from '@angular/core/testing';
|
||||
import {Http, HttpModule, Response, ResponseOptions, XHRBackend} from '@angular/http';
|
||||
|
@ -170,6 +170,19 @@ export function main() {
|
|||
});
|
||||
}));
|
||||
|
||||
it('should get base href from document', async(() => {
|
||||
const platform = platformDynamicServer([{
|
||||
provide: INITIAL_CONFIG,
|
||||
useValue:
|
||||
{document: '<html><head><base href="/"></head><body><app></app></body></html>'}
|
||||
}]);
|
||||
platform.bootstrapModule(ExampleModule).then((moduleRef) => {
|
||||
const location = moduleRef.injector.get(PlatformLocation);
|
||||
expect(location.getBaseHrefFromDOM()).toEqual('/');
|
||||
platform.destroy();
|
||||
});
|
||||
}));
|
||||
|
||||
it('adds styles with ng-transition attribute', async(() => {
|
||||
const platform = platformDynamicServer([{
|
||||
provide: INITIAL_CONFIG,
|
||||
|
|
Loading…
Reference in New Issue