Add new directive for UI tests
This commit is contained in:
13
frontend/src/app/data-cy.directive.ts
Normal file
13
frontend/src/app/data-cy.directive.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { Directive, ElementRef, Renderer2 } from '@angular/core';
|
||||
import { environment } from '../environments/environment';
|
||||
|
||||
@Directive({
|
||||
selector: '[data-cy]'
|
||||
})
|
||||
export class DataCyDirective {
|
||||
constructor(private el: ElementRef, private renderer: Renderer2) {
|
||||
if (environment.production) {
|
||||
renderer.removeAttribute(el.nativeElement, 'data-cy');
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user