Add new directive for UI tests
This commit is contained in:
parent
db4a13389a
commit
2d4d9d80bd
@ -78,6 +78,7 @@ import { ShortenStringPipe } from './shared/pipes/shorten-string-pipe/shorten-st
|
|||||||
import { GraphsComponent } from './components/graphs/graphs.component';
|
import { GraphsComponent } from './components/graphs/graphs.component';
|
||||||
import { DifficultyAdjustmentsTable } from './components/difficulty-adjustments-table/difficulty-adjustments-table.components';
|
import { DifficultyAdjustmentsTable } from './components/difficulty-adjustments-table/difficulty-adjustments-table.components';
|
||||||
import { BlocksList } from './components/blocks-list/blocks-list.component';
|
import { BlocksList } from './components/blocks-list/blocks-list.component';
|
||||||
|
import { DataCyDirective } from './data-cy.directive';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@ -137,6 +138,7 @@ import { BlocksList } from './components/blocks-list/blocks-list.component';
|
|||||||
GraphsComponent,
|
GraphsComponent,
|
||||||
DifficultyAdjustmentsTable,
|
DifficultyAdjustmentsTable,
|
||||||
BlocksList,
|
BlocksList,
|
||||||
|
DataCyDirective,
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule.withServerTransition({ appId: 'serverApp' }),
|
BrowserModule.withServerTransition({ appId: 'serverApp' }),
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user