Skip to content

Commit

Permalink
feat: provide fileList names as newFileMenu handler argument
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Aug 29, 2023
1 parent 89d0902 commit 137bc2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
14 changes: 3 additions & 11 deletions __tests__/newFileMenu.spec.ts
Expand Up @@ -4,14 +4,6 @@ import { NewFileMenu, getNewFileMenu, type Entry } from '../lib/newFileMenu'
import logger from '../lib/utils/logger'
import { Folder, Permission, View } from '../lib'

Check warning on line 5 in __tests__/newFileMenu.spec.ts

View workflow job for this annotation

GitHub Actions / eslint

'View' is defined but never used

const view = new View({
id: 'files',
name: 'Files',
icon: '<svg></svg>',
getContents: async () => ({ folder: {}, contents: [] }),
order: 1,
})

describe('NewFileMenu init', () => {
test('Initializing NewFileMenu', () => {
logger.debug = vi.fn()
Expand Down Expand Up @@ -276,7 +268,7 @@ describe('NewFileMenu getEntries filter', () => {
permissions: Permission.ALL,
})

const entries = newFileMenu.getEntries(context, view)
const entries = newFileMenu.getEntries(context)
expect(entries).toHaveLength(2)
expect(entries[0]).toBe(entry1)
expect(entries[1]).toBe(entry2)
Expand Down Expand Up @@ -312,7 +304,7 @@ describe('NewFileMenu getEntries filter', () => {
permissions: Permission.READ,
})

const entries = newFileMenu.getEntries(context, view)
const entries = newFileMenu.getEntries(context)
expect(entries).toHaveLength(0)
})

Expand Down Expand Up @@ -346,7 +338,7 @@ describe('NewFileMenu getEntries filter', () => {
root: '/files/admin',
})

const entries = newFileMenu.getEntries(context, view)
const entries = newFileMenu.getEntries(context)
expect(entries).toHaveLength(1)
expect(entries[0]).toBe(entry1)
})
Expand Down
3 changes: 2 additions & 1 deletion lib/newFileMenu.ts
Expand Up @@ -48,8 +48,9 @@ export interface Entry {
/**
* Function to be run after creation
* @param {Folder} context the creation context. Usually the current folder
* @param {string[]} fileList list of file names present in the destination folder
*/
handler: (context: Folder) => void
handler: (context: Folder, fileList: string[]) => void
}

export class NewFileMenu {
Expand Down

0 comments on commit 137bc2d

Please sign in to comment.