Skip to content

Commit

Permalink
test: sorting test on releases summary
Browse files Browse the repository at this point in the history
  • Loading branch information
jordanl17 committed Nov 25, 2024
1 parent 6867587 commit f0fb2df
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface Column<TableData = unknown> {
width: number | null
style?: CSSProperties
sorting?: boolean
sortTransform?: (value: TableData) => number
sortTransform?: (value: TableData) => number | string
}

export interface TableHeaderProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const releaseDocuments: DocumentInRelease[] = [
memoKey: '456',
document: {
...documentsInRelease.document,
_updatedAt: new Date().toISOString(),
_id: '456',
_rev: 'abc',
title: 'Second document',
Expand Down Expand Up @@ -210,7 +211,6 @@ describe('ReleaseSummary', () => {
within(sortedCreatedAscFirstDocument).getByText('Second document')
within(sortedCreatedAscSecondDocument).getByText('First document')

fireEvent.click(within(screen.getByRole('table')).getByText('Edited'))
fireEvent.click(within(screen.getByRole('table')).getByText('Edited'))

const [sortedEditedDescFirstDocument, sortedEditedDescSecondDocument] =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ export const getDocumentTableColumnDefs: (
id: 'search',
width: null,
style: {minWidth: '50%', maxWidth: '50%'},
sortTransform(value) {
return value.previewValues.values.title?.toLowerCase() || 0
},
header: (props) => (
<Headers.TableHeaderSearch {...props} placeholder={t('search-documents-placeholder')} />
),
Expand Down

0 comments on commit f0fb2df

Please sign in to comment.