From e217068b9c2a17a263721a967356706450dff88c Mon Sep 17 00:00:00 2001 From: AndyKIron Date: Mon, 16 Oct 2023 12:04:05 +0300 Subject: [PATCH] chore(isct-63): add attribution to table, table row, search, modal --- .../common/base/chip-filter.base.component.ts | 3 +++ ...opdown-dual-multi-select.base.component.ts | 3 +++ ...opdown-dual-multi-select-body.component.ts | 1 + ...down-dual-multi-select-footer.component.ts | 1 + ...down-dual-multi-select-header.component.ts | 1 + ...n-dual-multi-select-body-item.component.ts | 3 +++ ...opdown-dual-multi-select-body.component.ts | 3 +++ ...down-dual-multi-select-footer.component.ts | 3 +++ ...down-dual-multi-select-header.component.ts | 3 +++ .../modal-footer/modal-footer.component.ts | 4 +++- .../modal-header/modal-header.component.ts | 5 +++-- .../components/modal/v3/modal.component.ts | 4 +++- .../search/v3/search.component.html | 8 +++++++- .../components/search/v3/search.component.ts | 17 +++++++++++++++-- .../table-basic/table-basic.component.html | 1 + .../table-basic/table-basic.component.ts | 14 +++++++++++++- .../table-row/table-row.component.html | 6 ++++-- .../table-row/table-row.component.ts | 14 +++++++++++++- .../v3/stories/table.component.stories.ts | 5 ++++- .../components/table/v3/table.component.html | 19 +++++++++++++------ .../components/table/v3/table.component.ts | 16 ++++++++++++++-- .../fusion-ui/entities/test-ids-modifiers.ts | 17 +++++++++++++++++ 22 files changed, 131 insertions(+), 20 deletions(-) diff --git a/projects/fusion-ui/components/chip-filter/common/base/chip-filter.base.component.ts b/projects/fusion-ui/components/chip-filter/common/base/chip-filter.base.component.ts index 1014ca6c1..2d108a5b2 100644 --- a/projects/fusion-ui/components/chip-filter/common/base/chip-filter.base.component.ts +++ b/projects/fusion-ui/components/chip-filter/common/base/chip-filter.base.component.ts @@ -31,6 +31,7 @@ import {TestIdsService} from '@ironsource/fusion-ui/services/test-ids'; @Directive() export abstract class ChipFilterBaseComponent implements OnInit, AfterViewInit, OnDestroy, AfterContentInit { + /** @internal */ @Input() testId: string; /** @internal */ @ContentChild(ApiBase, {static: true}) apiBase: ApiBase; @@ -52,7 +53,9 @@ export abstract class ChipFilterBaseComponent implements OnInit, AfterViewInit, /** @internal */ rightIcon: ChipIcon; + /** @internal */ testIdChipFilterModifiers: typeof ChipFilterTestIdModifiers = ChipFilterTestIdModifiers; + /** @internal */ testIdsService: TestIdsService = this.injector.get(TestIdsService); private onDestroy$ = new Subject(); diff --git a/projects/fusion-ui/components/dropdown-dual-multi-select/common/base/dropdown-dual-multi-select.base.component.ts b/projects/fusion-ui/components/dropdown-dual-multi-select/common/base/dropdown-dual-multi-select.base.component.ts index f8b7fd113..d193b4206 100644 --- a/projects/fusion-ui/components/dropdown-dual-multi-select/common/base/dropdown-dual-multi-select.base.component.ts +++ b/projects/fusion-ui/components/dropdown-dual-multi-select/common/base/dropdown-dual-multi-select.base.component.ts @@ -46,6 +46,7 @@ export abstract class DropdownDualMultiSelectBaseComponent extends ApiBase imple /** @internal */ @Input() autoComplete: boolean = true; @Input() title: string; + /** @internal */ @Input() testId: string; /** @internal */ @Input() pendingItems: boolean = false; @@ -59,7 +60,9 @@ export abstract class DropdownDualMultiSelectBaseComponent extends ApiBase imple return this._hasSelectAll; } + /** @internal */ testIdIncludeExcludeModifiers: typeof IncludeExcludeTestIdModifiers = IncludeExcludeTestIdModifiers; + /** @internal */ testIdsService: TestIdsService = this.injector.get(TestIdsService); @Input() set placeholder(data: string) { diff --git a/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body.component.ts b/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body.component.ts index 045b341d5..9209ac492 100644 --- a/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body.component.ts +++ b/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body.component.ts @@ -46,6 +46,7 @@ export class DropdownDualMultiSelectBodyComponent implements OnInit, OnDestroy, @Input() totalItems: number; @Input() isPendingItems: boolean; @Input() hasSelectAll: boolean = true; + /** @internal */ @Input() testId: string; @Input() set items(data: DropdownOption[]) { diff --git a/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-footer/dropdown-dual-multi-select-footer.component.ts b/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-footer/dropdown-dual-multi-select-footer.component.ts index 6e3738783..4d62385d3 100644 --- a/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-footer/dropdown-dual-multi-select-footer.component.ts +++ b/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-footer/dropdown-dual-multi-select-footer.component.ts @@ -7,6 +7,7 @@ import {ChangeDetectionStrategy, Component, EventEmitter, Input, Output} from '@ changeDetection: ChangeDetectionStrategy.OnPush }) export class DropdownDualMultiSelectFooterComponent { + /** @internal */ @Input() testId: string; @Output() applySelect = new EventEmitter(); @Output() closeSelect = new EventEmitter(); diff --git a/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-header/dropdown-dual-multi-select-header.component.ts b/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-header/dropdown-dual-multi-select-header.component.ts index 0510253cc..87a055cc6 100644 --- a/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-header/dropdown-dual-multi-select-header.component.ts +++ b/projects/fusion-ui/components/dropdown-dual-multi-select/v2/components/dropdown-dual-multi-select-header/dropdown-dual-multi-select-header.component.ts @@ -19,6 +19,7 @@ import {Subject} from 'rxjs'; }) export class DropdownDualMultiSelectHeaderComponent implements OnDestroy, ControlValueAccessor { @Input() title: string; + /** @internal */ @Input() testId: string; inputSize = InputSize; diff --git a/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body-item/dropdown-dual-multi-select-body-item.component.ts b/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body-item/dropdown-dual-multi-select-body-item.component.ts index c0fc0bfc5..fbc49e08b 100644 --- a/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body-item/dropdown-dual-multi-select-body-item.component.ts +++ b/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body-item/dropdown-dual-multi-select-body-item.component.ts @@ -14,12 +14,15 @@ export class DropdownDualMultiSelectBodyItemComponent { @Input() item: DropdownOption; @Input() isDisabled: boolean; @Input() isSelectedItem: boolean; + /** @internal */ @Input() testId: string; @Output() changeSelected = new EventEmitter(); @Output() clearSelect = new EventEmitter(); + /** @internal */ testIdIncludeExcludeModifiers: typeof IncludeExcludeTestIdModifiers = IncludeExcludeTestIdModifiers; + /** @internal */ testIdsService: TestIdsService = this.injector.get(TestIdsService); constructor(private injector: Injector) {} diff --git a/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body.component.ts b/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body.component.ts index 605040f41..26c7af1e8 100644 --- a/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body.component.ts +++ b/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-body/dropdown-dual-multi-select-body.component.ts @@ -50,6 +50,7 @@ export class DropdownDualMultiSelectBodyComponent implements OnInit, OnDestroy, @Input() totalItems: number; @Input() isPendingItems: boolean; @Input() hasSelectAll: boolean = true; + /** @internal */ @Input() testId: string; @Input() set items(data: DropdownOption[]) { @@ -75,7 +76,9 @@ export class DropdownDualMultiSelectBodyComponent implements OnInit, OnDestroy, @Output() scrollDown = new EventEmitter(); + /** @internal */ testIdIncludeExcludeModifiers: typeof IncludeExcludeTestIdModifiers = IncludeExcludeTestIdModifiers; + /** @internal */ testIdsService: TestIdsService = this.injector.get(TestIdsService); isSelectAllDisabled$ = new BehaviorSubject(false); diff --git a/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-footer/dropdown-dual-multi-select-footer.component.ts b/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-footer/dropdown-dual-multi-select-footer.component.ts index 84d908a2b..db44e9c67 100644 --- a/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-footer/dropdown-dual-multi-select-footer.component.ts +++ b/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-footer/dropdown-dual-multi-select-footer.component.ts @@ -9,11 +9,14 @@ import {TestIdsService} from '@ironsource/fusion-ui/services/test-ids'; changeDetection: ChangeDetectionStrategy.OnPush }) export class DropdownDualMultiSelectFooterComponent { + /** @internal */ @Input() testId: string; @Output() applySelect = new EventEmitter(); @Output() closeSelect = new EventEmitter(); + /** @internal */ testIdIncludeExcludeModifiers: typeof IncludeExcludeTestIdModifiers = IncludeExcludeTestIdModifiers; + /** @internal */ testIdsService: TestIdsService = this.injector.get(TestIdsService); constructor(private injector: Injector) {} diff --git a/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-header/dropdown-dual-multi-select-header.component.ts b/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-header/dropdown-dual-multi-select-header.component.ts index b56c09dce..f474cab2c 100644 --- a/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-header/dropdown-dual-multi-select-header.component.ts +++ b/projects/fusion-ui/components/dropdown-dual-multi-select/v3/components/dropdown-dual-multi-select-header/dropdown-dual-multi-select-header.component.ts @@ -33,9 +33,12 @@ export class DropdownDualMultiSelectHeaderComponent implements OnDestroy, AfterV @ViewChild('input') input?: ElementRef; @Input() title: string; + /** @internal */ @Input() testId: string; + /** @internal */ testIdIncludeExcludeModifiers: typeof IncludeExcludeTestIdModifiers = IncludeExcludeTestIdModifiers; + /** @internal */ testIdsService: TestIdsService = this.injector.get(TestIdsService); searchIcon?: IconData = {iconName: 'search-bold', iconVersion: 'v3'}; diff --git a/projects/fusion-ui/components/modal/v3/components/modal-footer/modal-footer.component.ts b/projects/fusion-ui/components/modal/v3/components/modal-footer/modal-footer.component.ts index 2709791e6..d2391ae86 100644 --- a/projects/fusion-ui/components/modal/v3/components/modal-footer/modal-footer.component.ts +++ b/projects/fusion-ui/components/modal/v3/components/modal-footer/modal-footer.component.ts @@ -1,5 +1,6 @@ import {Component, EventEmitter, Injector, Input, Output} from '@angular/core'; -import {ModalTestIdModifiers, TestIdsService} from '@ironsource/fusion-ui'; +import {ModalTestIdModifiers} from '@ironsource/fusion-ui/entities'; +import {TestIdsService} from '@ironsource/fusion-ui/services/test-ids'; @Component({ selector: 'fusion-modal-footer', @@ -19,6 +20,7 @@ export class ModalFooterComponent { this.submitButtonDisabled = config?.submitButtonDisabled; } @Input() error; + /** @internal */ @Input() testId: string; @Output() onSubmit = new EventEmitter(); diff --git a/projects/fusion-ui/components/modal/v3/components/modal-header/modal-header.component.ts b/projects/fusion-ui/components/modal/v3/components/modal-header/modal-header.component.ts index f72decea4..0bd303d0a 100644 --- a/projects/fusion-ui/components/modal/v3/components/modal-header/modal-header.component.ts +++ b/projects/fusion-ui/components/modal/v3/components/modal-header/modal-header.component.ts @@ -1,6 +1,6 @@ import {Component, EventEmitter, Injector, Input, Output} from '@angular/core'; -import {BehaviorSubject} from 'rxjs'; -import {ModalTestIdModifiers, TestIdsService} from '@ironsource/fusion-ui'; +import {ModalTestIdModifiers} from '@ironsource/fusion-ui/entities'; +import {TestIdsService} from '@ironsource/fusion-ui/services/test-ids'; @Component({ selector: 'fusion-modal-header', @@ -10,6 +10,7 @@ import {ModalTestIdModifiers, TestIdsService} from '@ironsource/fusion-ui'; export class ModalHeaderComponent { @Input() headerText: string; @Input() showCloseButton = true; + /** @internal */ @Input() testId: string; private _infoText: string; diff --git a/projects/fusion-ui/components/modal/v3/modal.component.ts b/projects/fusion-ui/components/modal/v3/modal.component.ts index 55d5326bf..41a7464ce 100644 --- a/projects/fusion-ui/components/modal/v3/modal.component.ts +++ b/projects/fusion-ui/components/modal/v3/modal.component.ts @@ -58,7 +58,7 @@ export class ModalComponent implements OnDestroy, OnInit { get configuration(): ModalConfiguration { return this._configuration.getValue(); } - + /** @internal */ @Input() testId: string; @Output() open = new EventEmitter(); @@ -69,7 +69,9 @@ export class ModalComponent implements OnDestroy, OnInit { /** @internal */ @ViewChild('modalHolder', {static: true}) modalHolder: ElementRef; + /** @internal */ modalTestIdModifiers: typeof ModalTestIdModifiers = ModalTestIdModifiers; + /** @internal */ testIdsService: TestIdsService = this.injector.get(TestIdsService); private uid: string; diff --git a/projects/fusion-ui/components/search/v3/search.component.html b/projects/fusion-ui/components/search/v3/search.component.html index e623a7afa..74f53e857 100644 --- a/projects/fusion-ui/components/search/v3/search.component.html +++ b/projects/fusion-ui/components/search/v3/search.component.html @@ -6,5 +6,11 @@ [placeholder]="placeholder" [formControl]="searchFormControl" [class.fu-has-clear-icon]="showClearIcon" + [attr.data-testid]="testIdsService.getTestAttribute.bind(this) | generic:testId:searchTestIdModifiers.INPUT" /> - + diff --git a/projects/fusion-ui/components/search/v3/search.component.ts b/projects/fusion-ui/components/search/v3/search.component.ts index 8d950e721..217d8c6ea 100644 --- a/projects/fusion-ui/components/search/v3/search.component.ts +++ b/projects/fusion-ui/components/search/v3/search.component.ts @@ -1,10 +1,13 @@ -import {ChangeDetectionStrategy, Component, ElementRef, forwardRef, Input, OnDestroy, OnInit, ViewChild} from '@angular/core'; +import {ChangeDetectionStrategy, Component, ElementRef, forwardRef, Injector, Input, OnDestroy, OnInit, ViewChild} from '@angular/core'; import {CommonModule} from '@angular/common'; import {FormControl, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule} from '@angular/forms'; import {Subject} from 'rxjs'; import {takeUntil} from 'rxjs/operators'; import {isNullOrUndefined} from '@ironsource/fusion-ui/utils'; import {IconData, IconModule} from '@ironsource/fusion-ui/components/icon/v1'; +import {GenericPipe} from '@ironsource/fusion-ui/pipes/generic'; +import {SearchTestIdModifiers} from '@ironsource/fusion-ui/entities'; +import {TestIdsService} from '@ironsource/fusion-ui/services/test-ids'; @Component({ selector: 'fusion-search', @@ -12,7 +15,7 @@ import {IconData, IconModule} from '@ironsource/fusion-ui/components/icon/v1'; styleUrls: ['./search.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, - imports: [CommonModule, FormsModule, ReactiveFormsModule, IconModule], + imports: [CommonModule, FormsModule, ReactiveFormsModule, IconModule, GenericPipe], providers: [ { provide: NG_VALUE_ACCESSOR, @@ -45,6 +48,9 @@ export class SearchComponent implements OnInit, OnDestroy { return this._showClearIcon; } + /** @internal */ + @Input() testId: string; + /** @internal */ searchFormControl = new FormControl(); /** @internal */ @@ -54,6 +60,13 @@ export class SearchComponent implements OnInit, OnDestroy { /** @internal */ clearIcon: IconData = {iconName: 'cancel', iconVersion: 'v3'}; + /** @internal */ + searchTestIdModifiers: typeof SearchTestIdModifiers = SearchTestIdModifiers; + /** @internal */ + testIdsService: TestIdsService = this.injector.get(TestIdsService); + + constructor(private injector: Injector) {} + ngOnInit() { this.searchFormControl.valueChanges.pipe(takeUntil(this.onDestroy$)).subscribe(value => { this.propagateTouched(); diff --git a/projects/fusion-ui/components/table/v3/components/table-basic/table-basic.component.html b/projects/fusion-ui/components/table/v3/components/table-basic/table-basic.component.html index 52d1e3fad..9327cc826 100644 --- a/projects/fusion-ui/components/table/v3/components/table-basic/table-basic.component.html +++ b/projects/fusion-ui/components/table/v3/components/table-basic/table-basic.component.html @@ -10,6 +10,7 @@ [isExpanded]="isExpanded(rowIndex)" [isInnerRow]="false" [class.is-row-in-request]="tableService.rowsMetadata[row['_rowId']]?.inRequest" + [testId]="testId" (rowRemoved)="tableService.removeRow({rows: rows, rowIndex: rowIndex, row: row, options: options})" (selectedChange)="tableService.onRowSelectChanged($event, row)" (expandRow)="onExpandRow($event)" diff --git a/projects/fusion-ui/components/table/v3/components/table-basic/table-basic.component.ts b/projects/fusion-ui/components/table/v3/components/table-basic/table-basic.component.ts index 1c1f3b4ee..236fde114 100644 --- a/projects/fusion-ui/components/table/v3/components/table-basic/table-basic.component.ts +++ b/projects/fusion-ui/components/table/v3/components/table-basic/table-basic.component.ts @@ -5,6 +5,7 @@ import { Component, ElementRef, EventEmitter, + Injector, Input, OnDestroy, OnInit, @@ -21,6 +22,8 @@ import { import {TableService} from '@ironsource/fusion-ui/components/table/common/services'; import {fromEvent, Subject, from} from 'rxjs'; import {filter, mergeMap, takeUntil} from 'rxjs/operators'; +import {TableTestIdModifiers} from '@ironsource/fusion-ui/entities'; +import {TestIdsService} from '@ironsource/fusion-ui/services/test-ids'; @Component({ // eslint-disable-next-line @@ -44,6 +47,9 @@ export class TableBasicComponent implements OnInit, OnDestroy, AfterViewInit { this._halfTableClientWidth = value ? value / 2 : 0; } + /** @internal */ + @Input() testId: string; + @Output() rowSelected = new EventEmitter(); @Output() expandRow = new EventEmitter(); @@ -71,6 +77,11 @@ export class TableBasicComponent implements OnInit, OnDestroy, AfterViewInit { rowClass = this.getRowClass.bind(this); rowRowspanIndexes = this.getRowspanIndexes.bind(this); + /** @internal */ + tableTestIdModifiers: typeof TableTestIdModifiers = TableTestIdModifiers; + /** @internal */ + testIdsService: TestIdsService = this.injector.get(TestIdsService); + private _halfTableClientWidth = 0; private tableOptions; private onDestroy$ = new Subject(); @@ -79,7 +90,8 @@ export class TableBasicComponent implements OnInit, OnDestroy, AfterViewInit { public tableService: TableService, private cdr: ChangeDetectorRef, private elementRef: ElementRef, - private renderer: Renderer2 + private renderer: Renderer2, + private injector: Injector ) {} ngOnInit(): void { diff --git a/projects/fusion-ui/components/table/v3/components/table-row/table-row.component.html b/projects/fusion-ui/components/table/v3/components/table-row/table-row.component.html index 06de451a6..6cb1d9abc 100644 --- a/projects/fusion-ui/components/table/v3/components/table-row/table-row.component.html +++ b/projects/fusion-ui/components/table/v3/components/table-row/table-row.component.html @@ -1,4 +1,4 @@ - + - + (); @@ -69,6 +76,11 @@ export class TableRowComponent implements OnInit, OnChanges { cellShown = this.showCell.bind(this); attrRowspan = this.getAttrRowspan.bind(this); + /** @internal */ + tableTestIdModifiers: typeof TableTestIdModifiers = TableTestIdModifiers; + /** @internal */ + testIdsService: TestIdsService = this.injector.get(TestIdsService); + get expandCellCount(): Observable { if (!!this.options && !!this.options.rowsExpandableOptions && !!this.tableService.expandLevels) { const expandLevelsByIndex = this.tableService.getExpandLevelByRowIndex(this.rowIndex); @@ -100,7 +112,7 @@ export class TableRowComponent implements OnInit, OnChanges { }; } - constructor(public tableService: TableService, private cdRef: ChangeDetectorRef) {} + constructor(public tableService: TableService, private cdRef: ChangeDetectorRef, private injector: Injector) {} ngOnInit(): void { this.dataRowIndex = this.rowIndex; diff --git a/projects/fusion-ui/components/table/v3/stories/table.component.stories.ts b/projects/fusion-ui/components/table/v3/stories/table.component.stories.ts index c29bd7d14..10e98f1a6 100644 --- a/projects/fusion-ui/components/table/v3/stories/table.component.stories.ts +++ b/projects/fusion-ui/components/table/v3/stories/table.component.stories.ts @@ -65,7 +65,8 @@ export default { args: { options: TABLE_DEFAULT_OPTIONS, columns: TABLE_DEFAULT_COLUMNS_CONFIG, - rows: ROWS_DEFAULT_DATA + rows: ROWS_DEFAULT_DATA, + testId: 'test-id' } } as Meta; @@ -76,6 +77,7 @@ const TableTemplate: StoryFn = (args: TableComponent) => ({ [columns]="columns" [rows]="rows" [loading]="loading" + [testId]="testId" >` }); @@ -85,6 +87,7 @@ const TableWithHostTemplate: StoryFn = (args: TableComponent) => [options]="options" [columns]="columns" [rows]="rows" + [testId]="testId" >` }); diff --git a/projects/fusion-ui/components/table/v3/table.component.html b/projects/fusion-ui/components/table/v3/table.component.html index f49263b42..5d80e3ee3 100644 --- a/projects/fusion-ui/components/table/v3/table.component.html +++ b/projects/fusion-ui/components/table/v3/table.component.html @@ -1,6 +1,6 @@
-
{{tableLabel.text}} +
{{tableLabel.text}} @@ -10,6 +10,7 @@
@@ -33,7 +34,7 @@ -
{{ column.title }}
+
{{ column.title }}
-
-
+
+
@@ -87,6 +93,7 @@ [options]="options" [tableClientWidth]="getTableClientWidth()" [expandedRows]="expandedRows" + [testId]="testId" (rowSelected)="selectionChanged.emit($event)" (expandRow)="doExpandRow($event)" (click)="onTableBodyClicked($event)" @@ -128,7 +135,7 @@ -
+
diff --git a/projects/fusion-ui/components/table/v3/table.component.ts b/projects/fusion-ui/components/table/v3/table.component.ts index 3b711e7b6..ff04dd43e 100644 --- a/projects/fusion-ui/components/table/v3/table.component.ts +++ b/projects/fusion-ui/components/table/v3/table.component.ts @@ -9,7 +9,8 @@ import { ChangeDetectorRef, Component, ChangeDetectionStrategy, - OnDestroy + OnDestroy, + Injector } from '@angular/core'; import {BehaviorSubject, defer, fromEvent, Subject} from 'rxjs'; import {debounceTime, takeUntil, tap} from 'rxjs/operators'; @@ -30,6 +31,8 @@ import { import {TableBasicComponent} from './components/table-basic/table-basic.component'; import {MenuDropItem} from '@ironsource/fusion-ui/components/menu-drop'; import {FormControl} from '@angular/forms'; +import {TableTestIdModifiers} from '@ironsource/fusion-ui/entities'; +import {TestIdsService} from '@ironsource/fusion-ui/services/test-ids'; @Component({ selector: 'fusion-table', @@ -85,6 +88,9 @@ export class TableComponent implements OnInit, OnDestroy { this._expandedRows = value; } + /** @internal */ + @Input() testId: string; + /** * On Sort changed */ @@ -185,6 +191,11 @@ export class TableComponent implements OnInit, OnDestroy { /** @internal */ searchFormControl: FormControl; + /** @internal */ + tableTestIdModifiers: typeof TableTestIdModifiers = TableTestIdModifiers; + /** @internal */ + testIdsService: TestIdsService = this.injector.get(TestIdsService); + get isCheckboxTitleShown(): boolean { return this.columns ? this.columns.some(column => column.type === TableColumnTypeEnum.Checkbox && column.title !== '') : false; } @@ -246,7 +257,8 @@ export class TableComponent implements OnInit, OnDestroy { /** @internal */ public tableService: TableService, private uniqueService: UniqueIdService, - private cdr: ChangeDetectorRef + private cdr: ChangeDetectorRef, + private injector: Injector ) { this.tableService.clearSelectedRows(); } diff --git a/projects/fusion-ui/entities/test-ids-modifiers.ts b/projects/fusion-ui/entities/test-ids-modifiers.ts index 4391d9352..8f6cfce85 100644 --- a/projects/fusion-ui/entities/test-ids-modifiers.ts +++ b/projects/fusion-ui/entities/test-ids-modifiers.ts @@ -29,3 +29,20 @@ export enum ModalTestIdModifiers { MODAL_CANCEL_BUTTON = 'modal-cancel-button', MODAL_ERROR = 'modal-error' } + +export enum SearchTestIdModifiers { + INPUT = 'search-input', + CLEAR_BUTTON = 'search-clear-button' +} + +export enum TableTestIdModifiers { + LABEL = 'table-label', + COLUMN_HEADER = 'table-header-c', + COLUMN_TITLE = 'table-column-title-c', + COLUMN_SORT_UP = 'table-column-sort-up-c', + COLUMN_SORT_DOWN = 'table-column-sort-down-c', + COLUMN_HEADER_SELECT_ALL = 'table-header-select-all', + CELL = 'table-cell', + + BUTTON_GO_TOP = 'table-button-go-top' +}