@@ -67,4 +67,49 @@ describe('files: Rename nodes', { testIsolation: true }, () => {
6767 // See validity
6868 . should ( haveValidity ( / r e s e r v e d n a m e / i) )
6969 } )
70+
71+ it ( 'shows accessible loading information' , ( ) => {
72+ const { resolve, promise } = Promise . withResolvers ( )
73+
74+ getRowForFile ( 'file.txt' ) . should ( 'be.visible' )
75+
76+ // intercept the rename (MOVE)
77+ // the callback will wait until the promise resolve (so we have time to check the loading state)
78+ cy . intercept (
79+ 'MOVE' ,
80+ / \/ r e m o t e .p h p \/ d a v \/ f i l e s \/ / ,
81+ async ( ) => { await promise } ,
82+ ) . as ( 'moveFile' )
83+
84+ // Start the renaming
85+ triggerActionForFile ( 'file.txt' , 'rename' )
86+ getRowForFile ( 'file.txt' )
87+ . findByRole ( 'textbox' , { name : 'Filename' } )
88+ . should ( 'be.visible' )
89+ . type ( '{selectAll}new-name.txt{enter}' )
90+
91+ // Loading state is visible
92+ getRowForFile ( 'new-name.txt' )
93+ . findByRole ( 'img' , { name : 'File is loading' } )
94+ . should ( 'be.visible' )
95+ // checkbox is not visible
96+ getRowForFile ( 'new-name.txt' )
97+ . findByRole ( 'checkbox' , { name : / ^ T o g g l e s e l e c t i o n / } )
98+ . should ( 'not.exist' )
99+
100+ cy . log ( 'Resolve promise to preoceed with MOVE request' )
101+ . then ( ( ) => resolve ( null ) )
102+
103+ // Ensure the request is done (file renamed)
104+ cy . wait ( '@moveFile' )
105+
106+ // checkbox visible again
107+ getRowForFile ( 'new-name.txt' )
108+ . findByRole ( 'checkbox' , { name : / ^ T o g g l e s e l e c t i o n / } )
109+ . should ( 'exist' )
110+ // see the loading state is gone
111+ getRowForFile ( 'new-name.txt' )
112+ . findByRole ( 'img' , { name : 'File is loading' } )
113+ . should ( 'not.exist' )
114+ } )
70115} )
0 commit comments