fix(platform-server): reflect properties to attributes for known elements, for serialization
This commit is contained in:

committed by
Igor Minar

parent
9559d3e949
commit
047cda5b3c
@ -90,6 +90,14 @@ export class HttpBeforeExampleModule {
|
||||
export class HttpAfterExampleModule {
|
||||
}
|
||||
|
||||
@Component({selector: 'app', template: `<img [src]="'link'">`})
|
||||
class ImageApp {
|
||||
}
|
||||
|
||||
@NgModule({declarations: [ImageApp], imports: [ServerModule], bootstrap: [ImageApp]})
|
||||
class ImageExampleModule {
|
||||
}
|
||||
|
||||
export function main() {
|
||||
if (getDOM().supportsDOMEvents()) return; // NODE only
|
||||
|
||||
@ -143,6 +151,18 @@ export function main() {
|
||||
});
|
||||
}));
|
||||
|
||||
it('copies known properties to attributes', async(() => {
|
||||
const platform = platformDynamicServer(
|
||||
[{provide: INITIAL_CONFIG, useValue: {document: '<app></app>'}}]);
|
||||
platform.bootstrapModule(ImageExampleModule).then(ref => {
|
||||
const appRef: ApplicationRef = ref.injector.get(ApplicationRef);
|
||||
const app = appRef.components[0].location.nativeElement;
|
||||
const img = getDOM().getElementsByTagName(app, 'img')[0] as any;
|
||||
expect(img.attribs['src']).toEqual('link');
|
||||
});
|
||||
}));
|
||||
|
||||
|
||||
describe('PlatformLocation', () => {
|
||||
it('is injectable', async(() => {
|
||||
const platform = platformDynamicServer(
|
||||
|
Reference in New Issue
Block a user