@@ -24,6 +24,11 @@ import { expect } from '@jest/globals'
2424import { File , Folder , Node , Permission , View , FileAction } from '@nextcloud/files'
2525
2626const view = {
27+ id : 'trashbin' ,
28+ name : 'Trashbin' ,
29+ } as View
30+
31+ const viewFiles = {
2732 id : 'files' ,
2833 name : 'Files' ,
2934} as View
@@ -36,11 +41,12 @@ describe('View in folder action conditions tests', () => {
3641 expect ( action . iconSvgInline ( [ ] , view ) ) . toBe ( '<svg>SvgMock</svg>' )
3742 expect ( action . default ) . toBeUndefined ( )
3843 expect ( action . order ) . toBe ( 80 )
44+ expect ( action . enabled ) . toBeDefined ( )
3945 } )
4046} )
4147
4248describe ( 'View in folder action enabled tests' , ( ) => {
43- test ( 'Enabled for files ' , ( ) => {
49+ test ( 'Enabled for trashbin ' , ( ) => {
4450 const file = new File ( {
4551 id : 1 ,
4652 source : 'https://cloud.domain.com/remote.php/dav/files/admin/foobar.txt' ,
@@ -53,6 +59,19 @@ describe('View in folder action enabled tests', () => {
5359 expect ( action . enabled ! ( [ file ] , view ) ) . toBe ( true )
5460 } )
5561
62+ test ( 'Disabled for files' , ( ) => {
63+ const file = new File ( {
64+ id : 1 ,
65+ source : 'https://cloud.domain.com/remote.php/dav/files/admin/foobar.txt' ,
66+ owner : 'admin' ,
67+ mime : 'text/plain' ,
68+ permissions : Permission . ALL ,
69+ } )
70+
71+ expect ( action . enabled ) . toBeDefined ( )
72+ expect ( action . enabled ! ( [ file ] , viewFiles ) ) . toBe ( false )
73+ } )
74+
5675 test ( 'Disabled without permissions' , ( ) => {
5776 const file = new File ( {
5877 id : 1 ,
0 commit comments