Skip to content

Commit

Permalink
[AAE-16969] Remove force casting of all types to text (#8963)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomgny authored Oct 4, 2023
1 parent c548fc7 commit 11b4f51
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import {
mockEuropeCountriesData,
mockCountriesIncorrectData,
mockInvalidSchemaDefinition,
mockSchemaDefinition,
mockSchemaDefinitionWithDifferentTypes
mockSchemaDefinition
} from '../../../mocks/data-table-widget.mock';
import { ObjectDataRow } from '@alfresco/adf-core';

Expand All @@ -32,14 +31,6 @@ describe('WidgetDataTableAdapter', () => {
widgetDataTableAdapter = new WidgetDataTableAdapter(mockEuropeCountriesData, mockSchemaDefinition);
});

it('should set columns type to "text" during initialization', () => {
widgetDataTableAdapter = new WidgetDataTableAdapter(mockEuropeCountriesData, mockSchemaDefinitionWithDifferentTypes);

widgetDataTableAdapter.getColumns().forEach(column =>
expect(column.type).toBe('text')
);
});

it('should return rows if all columns are linked to data', () => {
const rows = widgetDataTableAdapter.getRows();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ export class WidgetDataTableAdapter extends ObjectDataTableAdapter {
super(data, schema);
this.rows = super.getRows();
this.columns = super.getColumns();

this.setColumnsTypeToText();
}

getRows(): DataRow[] {
Expand All @@ -55,8 +53,4 @@ export class WidgetDataTableAdapter extends ObjectDataTableAdapter {

return availableColumnKeys.every(columnKey => this.rows.some(row => Object.keys(row.obj).includes(columnKey)));
}

private setColumnsTypeToText(): void {
super.setColumns(this.columns.map(column => ({ ...column, type: 'text' })));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,6 @@ export const mockSchemaDefinition: DataColumn[] = [
}
];

export const mockSchemaDefinitionWithDifferentTypes: DataColumn[] = [
{
type: 'json',
key: 'id',
title: 'Country ID',
sortable: true,
draggable: true
},
{
type: 'date',
key: 'name',
title: 'Country Name',
sortable: true,
draggable: true
}
];

export const mockInvalidSchemaDefinition: DataColumn[] = [
{
type: 'text',
Expand Down

0 comments on commit 11b4f51

Please sign in to comment.