mirror of
https://github.com/mempool/mempool.git
synced 2025-02-24 14:50:52 +01:00
Add new directive for UI tests
This commit is contained in:
parent
db4a13389a
commit
2d4d9d80bd
2 changed files with 15 additions and 0 deletions
|
@ -78,6 +78,7 @@ import { ShortenStringPipe } from './shared/pipes/shorten-string-pipe/shorten-st
|
|||
import { GraphsComponent } from './components/graphs/graphs.component';
|
||||
import { DifficultyAdjustmentsTable } from './components/difficulty-adjustments-table/difficulty-adjustments-table.components';
|
||||
import { BlocksList } from './components/blocks-list/blocks-list.component';
|
||||
import { DataCyDirective } from './data-cy.directive';
|
||||
|
||||
@NgModule({
|
||||
declarations: [
|
||||
|
@ -137,6 +138,7 @@ import { BlocksList } from './components/blocks-list/blocks-list.component';
|
|||
GraphsComponent,
|
||||
DifficultyAdjustmentsTable,
|
||||
BlocksList,
|
||||
DataCyDirective,
|
||||
],
|
||||
imports: [
|
||||
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…
Add table
Reference in a new issue