Skip to content

Commit

Permalink
Fix table order 361 (#362)
Browse files Browse the repository at this point in the history
* style: fix line height of input

* style: input 100% 🎨

* fix: table order #361
  • Loading branch information
iurynogueira authored Dec 8, 2022
1 parent 48f8db8 commit 46e0424
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,15 @@ describe('TableComponent', () => {
});
});

it('should be defined the value of order when sort column', async () => {
const orderBy = columns[0].key;
fireEvent.click(screen.getByTestId('sort-by-' + orderBy));
expect(defaultProps.config.order).toStrictEqual({
column: orderBy,
desc: true,
});
});

it('should emit event sort with desc true when click in sort icon two times', async () => {
const orderBy = columns[0].key;
fireEvent.click(screen.getByTestId('sort-by-' + orderBy));
Expand Down
4 changes: 4 additions & 0 deletions projects/ion/src/lib/smart-table/smart-table.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ export class SmartTableComponent implements OnInit {
}

public sort(column: Column): void {
this.config.order = {
column: column.key,
desc: column.desc,
};
this.events.emit({
event: EventTable.SORT,
change_page: this.pagination,
Expand Down
4 changes: 4 additions & 0 deletions projects/ion/src/lib/table/utilsTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ export interface ConfigTable<T> {
check?: boolean;
pagination?: PaginationConfig;
loading?: boolean;
order?: {
column: string;
desc: boolean | undefined;
};
}

export class TableUtils<T = SafeAny> {
Expand Down

0 comments on commit 46e0424

Please sign in to comment.