Skip to content

Commit

Permalink
test: Adjust tests for new @nextcloud/files functions
Browse files Browse the repository at this point in the history
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed Jun 21, 2024
1 parent b0429b2 commit fd44704
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions lib/components/FilePicker/FileList.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const exampleNodes = [
root: '/',
size: 321,
attributes: {
favorite: true,
favorite: 1,
},
}),
new Folder({
Expand Down Expand Up @@ -157,10 +157,10 @@ describe('FilePicker FileList', () => {
const rows = wrapper.findAll('[data-testid="file-list-row"]')
// all nodes are shown
expect(rows.length).toBe(nodes.length)
// folder are sorted first
expect(rows.at(0).attributes('data-filename')).toBe('directory')
// by default favorites are sorted before other files
expect(rows.at(1).attributes('data-filename')).toBe('favorite.txt')
expect(rows.at(0).attributes('data-filename')).toBe('favorite.txt')
// folder are sorted first
expect(rows.at(1).attributes('data-filename')).toBe('directory')
// other files are ascending
expect(rows.at(2).attributes('data-filename')).toBe('a-file.txt')
expect(rows.at(3).attributes('data-filename')).toBe('b-file.txt')
Expand Down Expand Up @@ -192,10 +192,10 @@ describe('FilePicker FileList', () => {
const rows = wrapper.findAll('.file-picker__row')
// all nodes are shown
expect(rows.length).toBe(nodes.length)
// folder are sorted first
expect(rows.at(0).attributes('data-filename')).toBe('directory')
// by default favorites are sorted before other files
expect(rows.at(1).attributes('data-filename')).toBe('favorite.txt')
expect(rows.at(0).attributes('data-filename')).toBe('favorite.txt')
// folder are sorted first
expect(rows.at(1).attributes('data-filename')).toBe('directory')
// other files are descending
expect(rows.at(2).attributes('data-filename')).toBe('b-file.txt')
expect(rows.at(3).attributes('data-filename')).toBe('a-file.txt')
Expand Down
2 changes: 1 addition & 1 deletion lib/components/FilePicker/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ const { sortFavoritesFirst, cropImagePreviews } = useFilesSettings()
*/
const sortedFiles = computed(() => {
return sortNodes(props.files, {
sortFavoritesFirst: sortFavoritesFirst.value,
sortFoldersFirst: true,
sortFavoritesFirst: sortFavoritesFirst.value,
sortingOrder: sortingConfig.value.order === 'descending' ? 'desc' : 'asc',
sortingMode: sortingConfig.value.sortBy as FilesSortingMode,
})
Expand Down

0 comments on commit fd44704

Please sign in to comment.