test(platform-server): add a test for 'hidden' property (#24239)

Add a test to verify that the hidden property is reflected properly to the hidden attribute.

PR Close #24239
This commit is contained in:
Vikram Subramanian 2018-05-31 19:29:02 -07:00 committed by Victor Berchet
parent f69ac670ee
commit 08f943a1f3
1 changed files with 23 additions and 0 deletions

View File

@ -334,6 +334,20 @@ class TransferStoreModule {
class EscapedTransferStoreModule { class EscapedTransferStoreModule {
} }
@Component({selector: 'app', template: '<input [hidden]="true"><input [hidden]="false">'})
class MyHiddenComponent {
@Input()
name = '';
}
@NgModule({
declarations: [MyHiddenComponent],
bootstrap: [MyHiddenComponent],
imports: [ServerModule, BrowserModule.withServerTransition({appId: 'hidden-attributes'})]
})
class HiddenModule {
}
(function() { (function() {
if (getDOM().supportsDOMEvents()) return; // NODE only if (getDOM().supportsDOMEvents()) return; // NODE only
@ -613,6 +627,15 @@ class EscapedTransferStoreModule {
}); });
})); }));
it('should handle element property "hidden"', async(() => {
renderModule(HiddenModule, {document: doc}).then(output => {
expect(output).toBe(
'<html><head></head><body><app ng-version="0.0.0-PLACEHOLDER">' +
'<input hidden=""><input></app></body></html>');
called = true;
});
}));
it('should call render hook', async(() => { it('should call render hook', async(() => {
renderModule(RenderHookModule, {document: doc}).then(output => { renderModule(RenderHookModule, {document: doc}).then(output => {
// title should be added by the render hook. // title should be added by the render hook.