aboutsummaryrefslogtreecommitdiffstats
path: root/cypress
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-12-06 16:09:57 +0100
committernextcloud-command <nextcloud-command@users.noreply.github.com>2024-12-10 10:31:59 +0000
commit232651774ec469b0da8790b97cb0438b497d355f (patch)
tree64d4121fd7349e63cc05ddd83962f4b5cf08887c /cypress
parent5af0d137e7ba016488e3717e28d698fda195dc24 (diff)
downloadnextcloud-server-232651774ec469b0da8790b97cb0438b497d355f.tar.gz
nextcloud-server-232651774ec469b0da8790b97cb0438b497d355f.zip
fix(files): cancel renaming on enter if no file name changes
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'cypress')
-rw-r--r--cypress/e2e/files/files-renaming.cy.ts39
1 files changed, 39 insertions, 0 deletions
diff --git a/cypress/e2e/files/files-renaming.cy.ts b/cypress/e2e/files/files-renaming.cy.ts
index 77f23a00459..752e8264ceb 100644
--- a/cypress/e2e/files/files-renaming.cy.ts
+++ b/cypress/e2e/files/files-renaming.cy.ts
@@ -143,4 +143,43 @@ describe('files: Rename nodes', { testIsolation: true }, () => {
.findByRole('textbox', { name: 'Filename' })
.should('not.exist')
})
+
+ it('cancel renaming on esc press', () => {
+ // All are visible by default
+ getRowForFile('file.txt').should('be.visible')
+
+ triggerActionForFile('file.txt', 'rename')
+
+ getRowForFile('file.txt')
+ .findByRole('textbox', { name: 'Filename' })
+ .should('be.visible')
+ .type('{selectAll}other.txt')
+ .should(haveValidity(''))
+ .type('{esc}')
+
+ // See it is not renamed
+ getRowForFile('other.txt').should('not.exist')
+ getRowForFile('file.txt')
+ .should('be.visible')
+ .find('input[type="text"]')
+ .should('not.exist')
+ })
+
+ it('cancel on enter if no new name is entered', () => {
+ // All are visible by default
+ getRowForFile('file.txt').should('be.visible')
+
+ triggerActionForFile('file.txt', 'rename')
+
+ getRowForFile('file.txt')
+ .findByRole('textbox', { name: 'Filename' })
+ .should('be.visible')
+ .type('{enter}')
+
+ // See it is not renamed
+ getRowForFile('file.txt')
+ .should('be.visible')
+ .find('input[type="text"]')
+ .should('not.exist')
+ })
})