Skip to content

Commit

Permalink
docs(table): atualiza descrição da propriedade property
Browse files Browse the repository at this point in the history
Atualiza descrição da propriedade `property` na interface PoTableColumn.

Fixes DTHFUI-9772
  • Loading branch information
anabye committed Dec 2, 2024
1 parent 4f0cc89 commit 107abba
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export interface PoTableColumn {
* { property: 'address.street', label: 'Rua' }
* ```
*/
property?: string;
property: string;

/**
* @optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1576,15 +1576,15 @@ describe('PoTableBaseComponent:', () => {

it('getFilteredColumns: should filter and map columns correctly', () => {
component.columns = [
{ label: 'Currency', visible: true },
{ label: 'Currency', property: 'currency', visible: true },
{ label: 'Números', property: 'numberData', visible: true },
{ label: 'Datas', property: 'dateData', visible: true },
{ label: 'Textos', property: 'textData', visible: false }
];

component['getFilteredColumns']();

expect(component.filteredColumns).toEqual(['Currency', 'numberData', 'dateData']);
expect(component.filteredColumns).toEqual(['currency', 'numberData', 'dateData']);
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,7 @@ export abstract class PoTableBaseComponent implements OnChanges, OnDestroy {
}

private getFilteredColumns(): void {
this.filteredColumns = this.columns
.filter(column => column.visible !== false)
.map(column => column.property || column.label);
this.filteredColumns = this.columns.filter(column => column.visible !== false).map(column => column.property);
}

private get sortType(): PoTableColumnSortType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1238,15 +1238,19 @@ describe('PoTableColumnManagerComponent:', () => {

describe('stringify', () => {
it(`should return stringify value with no difference`, () => {
const columns: Array<PoTableColumn> = [{ icons: [{ value: 'value', tooltip: 'tooltip' }] }];
const result = '[{"icons":[{"value":"value","tooltip":"tooltip"}]}]';
const columns: Array<PoTableColumn> = [
{ property: 'columnIcon', icons: [{ value: 'value', tooltip: 'tooltip' }] }
];
const result = `[{"property":"columnIcon","icons":[{"value":"value","tooltip":"tooltip"}]}]`;
const filter = component['stringify'](columns);
expect(filter).toEqual(result);
});

it('should return stringify value with difference by filtered key', () => {
const columns: Array<PoTableColumn> = [{ icons: [{ icon: 'icon', value: 'value', tooltip: 'tooltip' }] }];
const result = '[{"icons":[{"value":"value","tooltip":"tooltip"}]}]';
const columns: Array<PoTableColumn> = [
{ property: 'columnIcon', icons: [{ icon: 'icon', value: 'value', tooltip: 'tooltip' }] }
];
const result = '[{"property":"columnIcon","icons":[{"value":"value","tooltip":"tooltip"}]}]';
const filter = component['stringify'](columns);
expect(filter).toEqual(result);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ describe('PoTableComponent:', () => {

it(`checkingIfColumnHasTooltip: should call getColumnLabel and set tooltipText with columnLabel.tooltip
if contains the column parameter and column.type is 'label'`, () => {
const column = { type: 'label', tooltip: 'Label Tooltip Value' };
const column = { property: 'columnTooltip', type: 'label', tooltip: 'Label Tooltip Value' };
const row = {};

spyOn(component, <any>'getColumnLabel').and.returnValue({ tooltip: column.tooltip });
Expand All @@ -1315,7 +1315,7 @@ describe('PoTableComponent:', () => {
});

it(`checkingIfColumnHasTooltip: should apply undefined to tooltipText if 'getColumnLabel' returns undefined`, () => {
const column = { type: 'label', tooltip: 'Label Tooltip Value' };
const column = { property: 'columnTooltip', type: 'label', tooltip: 'Label Tooltip Value' };
const row = {};

spyOn(component, <any>'getColumnLabel').and.returnValue(undefined);
Expand Down Expand Up @@ -2850,7 +2850,7 @@ describe('PoTableComponent:', () => {
});

it('getTemplate: should be return null by column property', () => {
const column: PoTableColumn = {};
const column: PoTableColumn = { property: '' };
column.property = 'status3';

const tableColumnTemplate: PoTableColumnTemplateDirective = {
Expand All @@ -2873,7 +2873,7 @@ describe('PoTableComponent:', () => {
});

it('getTemplate: should be return TemplateRef by column property', () => {
const column: PoTableColumn = {};
const column: PoTableColumn = { property: '' };
column.property = 'status';

const tableColumnTemplate: PoTableColumnTemplateDirective = {
Expand Down

0 comments on commit 107abba

Please sign in to comment.