我有简单的组件
@Component({
selector: 'app-certificate-panel',
templateUrl: './certificate.component.html'
})
export class CertificateComponent {
@Input()
public certificate: Certificate;
}
带模板
<h3 translate>General</h3>
<x-form-row label="{{'Version' | translate}}">
{{ certificate.version }}
</x-form-row>
<x-form-row label="{{'Serial Number' | translate}}">
{{ certificate.serialNumber }}
</x-form-row>
<h3 translate>Issued From</h3>
<x-form-row label="{{'Common Name (CN)' | translate}}" *ngIf="certificate.issuedFrom.commonName">
{{ certificate.issuedFrom.commonName }}
</x-form-row>
<x-form-row label="{{'Organization Unit (OU)' | translate}}" *ngIf="certificate.issuedFrom.organizationUnit">
{{ certificate.issuedFrom.organizationUnit }}
</x-form-row>
显示了更多属性。此模板中有几个*ngIf
。
现在我想编写单元测试。我应该测试每个*ngIf
吗?不是在测试框架功能吗?