Skip to content

Commit

Permalink
Merge pull request #1143 from nextcloud-libraries/feat/file-list-acti…
Browse files Browse the repository at this point in the history
…on-no-icon
  • Loading branch information
skjnldsv authored Dec 12, 2024
2 parents 52dd3c8 + a2c5284 commit 35ae28e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions __tests__/fileListAction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ describe('Invalid FileListAction creation', () => {
test('Invalid iconSvgInline', () => {
expect(() => new FileListAction({
id: 'test',
iconSvgInline: null,
displayName: () => 'Test',
order: 0,
exec: async () => {},
Expand Down
4 changes: 2 additions & 2 deletions lib/fileListAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ interface FileListActionData {
displayName: (view: View) => string

/** Raw svg string */
iconSvgInline: (view: View) => string
iconSvgInline?: (view: View) => string

/** Sort order */
order: number
Expand Down Expand Up @@ -82,7 +82,7 @@ export class FileListAction {
throw new Error('Invalid displayName function')
}

if (!action.iconSvgInline || typeof action.iconSvgInline !== 'function') {
if ('iconSvgInline' in action && typeof action.iconSvgInline !== 'function') {
throw new Error('Invalid iconSvgInline function')
}

Expand Down

0 comments on commit 35ae28e

Please sign in to comment.