Skip to content

Commit 8dd1696

Browse files
authored
Merge pull request #47443 from nextcloud/fix/files-non-visual-loading-info
fix(files): Node loading information should be accessible
2 parents 15bfc63 + e934080 commit 8dd1696

5 files changed

Lines changed: 57 additions & 4 deletions

File tree

apps/files/src/components/FileEntry/FileEntryCheckbox.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<template>
66
<td class="files-list__row-checkbox"
77
@keyup.esc.exact="resetSelection">
8-
<NcLoadingIcon v-if="isLoading" />
8+
<NcLoadingIcon v-if="isLoading" :name="loadingLabel" />
99
<NcCheckboxRadioSwitch v-else
1010
:aria-label="ariaLabel"
1111
:checked="isSelected"
@@ -83,6 +83,11 @@ export default defineComponent({
8383
? t('files', 'Toggle selection for file "{displayName}"', { displayName: this.source.basename })
8484
: t('files', 'Toggle selection for folder "{displayName}"', { displayName: this.source.basename })
8585
},
86+
loadingLabel() {
87+
return this.isFile
88+
? t('files', 'File is loading')
89+
: t('files', 'Folder is loading')
90+
},
8691
},
8792
8893
methods: {

cypress/e2e/files/files-renaming.cy.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,49 @@ describe('files: Rename nodes', { testIsolation: true }, () => {
6767
// See validity
6868
.should(haveValidity(/reserved name/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+
/\/remote.php\/dav\/files\//,
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: /^Toggle selection/ })
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: /^Toggle selection/ })
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
})

cypress/support/e2e.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import 'cypress-axe'
66
import './commands.ts'
77

8+
// Remove with Node 22
9+
import 'core-js/actual/promise/with-resolvers.js'
10+
811
// Fix ResizeObserver loop limit exceeded happening in Cypress only
912
// @see https://github.com/cypress-io/cypress/issues/20341
1013
Cypress.on('uncaught:exception', err => !err.message.includes('ResizeObserver loop limit exceeded'))

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)