<input type="checkbox"
class="custom-control-input"
id="channel_ident"
- formControlName="channel_ident">
+ formControlName="channel_ident"
+ (click)="toggleIdent()">
<label class="custom-control-label"
for="channel_ident"></label>
</div>
</div>
</div>
+ <ng-container *ngIf="showContactInfo">
<legend>
<ng-container i18n>Contact Information</ng-container>
<cd-helper i18n>Submitting any contact information is completely optional and disabled by default.</cd-helper>
i18n-placeholder>
</div>
</div>
+ </ng-container>
<legend i18n>Advanced Settings</legend>
<div class="form-group row">
<label class="cd-col-form-label"
expect(component).toBeTruthy();
});
+ it('should show/hide ident fields on checking/unchecking', () => {
+ const getContactField = () =>
+ fixture.debugElement.nativeElement.querySelector('input[id=contact]');
+ const getDescriptionField = () =>
+ fixture.debugElement.nativeElement.querySelector('input[id=description]');
+
+ // Initially hidden.
+ expect(getContactField()).toBeFalsy();
+ expect(getDescriptionField()).toBeFalsy();
+
+ // Show fields.
+ component.toggleIdent();
+ fixture.detectChanges();
+ expect(getContactField()).toBeTruthy();
+ expect(getDescriptionField()).toBeTruthy();
+
+ // Hide fields.
+ component.toggleIdent();
+ fixture.detectChanges();
+ expect(getContactField()).toBeFalsy();
+ expect(getDescriptionField()).toBeFalsy();
+ });
+
it('should set module enability to true correctly', () => {
expect(component.moduleEnabled).toBeTruthy();
});