aboutsummaryrefslogtreecommitdiffstats
path: root/cypress/e2e
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2024-12-06 16:09:57 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2024-12-10 10:55:00 +0000
commitb51e7b42fd6b99bbfd6539cc0b12f018575745cf (patch)
treeed1c9ee8cc971e486975b58043b8ec21878b31e6 /cypress/e2e
parente3b10c76eaaa8826c7224e79422aff941da4f32a (diff)
downloadnextcloud-server-b51e7b42fd6b99bbfd6539cc0b12f018575745cf.tar.gz
nextcloud-server-b51e7b42fd6b99bbfd6539cc0b12f018575745cf.zip
fix(files): cancel renaming on enter if no file name changes
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'cypress/e2e')
-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 1bb2a530fe8..b0a0f84bc99 100644
--- a/cypress/e2e/files/files-renaming.cy.ts
+++ b/cypress/e2e/files/files-renaming.cy.ts
@@ -155,4 +155,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')
+ })
})