From a1df595ed5697c515d5c7c5cc4a348cf5cf60879 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 9 Sep 2019 12:10:54 +0200 Subject: [PATCH 1/4] Adjust UX in new folder/file creation dialog - empty name now shows an error - added default value - added placeholder text --- apps/files/src/components/FilesAppBar.vue | 36 ++++++++++++++----- apps/files/src/components/ocDialogPrompt.vue | 1 + .../features/webUIFiles/createFolders.feature | 8 +++++ tests/acceptance/pageObjects/filesPage.js | 9 +++-- .../stepDefinitions/filesContext.js | 8 +++++ 5 files changed, 51 insertions(+), 11 deletions(-) diff --git a/apps/files/src/components/FilesAppBar.vue b/apps/files/src/components/FilesAppBar.vue index 02a150f5d16..3cddf7aeb02 100644 --- a/apps/files/src/components/FilesAppBar.vue +++ b/apps/files/src/components/FilesAppBar.vue @@ -27,8 +27,8 @@ - Create new folder… - Create new file… + Create new folder… + Create new file… @@ -55,8 +55,8 @@ - - + + @@ -100,10 +100,16 @@ export default { searchLabel () { return this.$gettext('Search') }, - _createFolderDialogTitle () { + $_createFolderDialogPlaceholder () { + return this.$gettext('Enter new folder name…') + }, + $_createFolderDialogTitle () { return this.$gettext('Create new folder…') }, - _createFileDialogTitle () { + $_createFileDialogPlaceholder () { + return this.$gettext('Enter new file name…') + }, + $_createFileDialogTitle () { return this.$gettext('Create new file…') }, _cannotCreateDialogText () { @@ -259,6 +265,10 @@ export default { }) }) }, + showCreateFolderDialog () { + this.createFolder = true + this.newFolderName = this.$gettext('New folder') + }, addNewFolder (folderName) { if (folderName !== '') { this.fileFolderCreationLoading = true @@ -270,7 +280,6 @@ export default { p.then(() => { this.createFolder = false - this.newFolderName = '' this.$_ocFilesFolder_getFolder() }) .catch(error => { @@ -286,6 +295,10 @@ export default { } }, checkNewFolderName (folderName) { + if (folderName === '') { + return this.$gettext('Folder name cannot be empty') + } + if (/[/]/.test(folderName)) { return this.$gettext('Folder name cannot contain "/"') } @@ -311,6 +324,10 @@ export default { return null }, + showCreateFileDialog () { + this.createFile = true + this.newFileName = this.$gettext('New file') + '.txt' + }, addNewFile (fileName) { if (fileName !== '') { this.fileFolderCreationLoading = true @@ -321,7 +338,6 @@ export default { } p.then(() => { this.createFile = false - this.newFileName = '' this.$_ocFilesFolder_getFolder() }) .catch(error => { @@ -337,6 +353,10 @@ export default { } }, checkNewFileName (fileName) { + if (fileName === '') { + return this.$gettext('File name cannot be empty') + } + if (/[/]/.test(fileName)) { return this.$gettext('File name cannot contain "/"') } diff --git a/apps/files/src/components/ocDialogPrompt.vue b/apps/files/src/components/ocDialogPrompt.vue index dd6000eab5d..80338ba3b51 100644 --- a/apps/files/src/components/ocDialogPrompt.vue +++ b/apps/files/src/components/ocDialogPrompt.vue @@ -7,6 +7,7 @@ {{ ocContent }} Date: Tue, 10 Sep 2019 11:32:31 +0200 Subject: [PATCH 2/4] Make sure the oc-dialog alert prompt can be found Use class name instead of id for the oc-dialog alert prompt element, because Selenium would not see the element if there are multiple elements with the same id, even if the others are invisible. --- apps/files/src/components/ocDialogPrompt.vue | 2 +- tests/acceptance/pageObjects/phoenixPage.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/files/src/components/ocDialogPrompt.vue b/apps/files/src/components/ocDialogPrompt.vue index 80338ba3b51..0ccc6686c6d 100644 --- a/apps/files/src/components/ocDialogPrompt.vue +++ b/apps/files/src/components/ocDialogPrompt.vue @@ -1,7 +1,7 @@