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..0ccc6686c6d 100644
--- a/apps/files/src/components/ocDialogPrompt.vue
+++ b/apps/files/src/components/ocDialogPrompt.vue
@@ -1,12 +1,13 @@
-
+
{{ ocError }}
{{ ocContent }}
{
+ const chars = result.value.split('')
+ // Make sure we are at the end of the input
+ chars.forEach(() => this.setValue(selector, RIGHT_ARROW))
+ // Delete all the existing characters
+ chars.forEach(() => this.setValue(selector, BACK_SPACE))
+ })
+}
diff --git a/tests/acceptance/features/webUIFiles/createFolders.feature b/tests/acceptance/features/webUIFiles/createFolders.feature
index da734e41e35..eb37dc98eae 100644
--- a/tests/acceptance/features/webUIFiles/createFolders.feature
+++ b/tests/acceptance/features/webUIFiles/createFolders.feature
@@ -17,6 +17,14 @@ Feature: create folders
When the user reloads the current page of the webUI
Then folder "sub-folder" should be listed on the webUI
+ Scenario: Create a folder with default name
+ When the user creates a folder with default name using the webUI
+ Then folder "New folder" should be listed on the webUI
+
+ Scenario: Try to create a folder without name
+ When the user creates a folder without name using the webUI
+ Then the error message 'Folder name cannot be empty' should be displayed on the webUI dialog prompt
+
Scenario: Try to create a folder with existing name
When the user creates a folder with the invalid name "simple-folder" using the webUI
Then the error message 'simple-folder already exists' should be displayed on the webUI dialog prompt
diff --git a/tests/acceptance/pageObjects/filesPage.js b/tests/acceptance/pageObjects/filesPage.js
index 866cdb44ed9..4a3d62c7c36 100644
--- a/tests/acceptance/pageObjects/filesPage.js
+++ b/tests/acceptance/pageObjects/filesPage.js
@@ -27,8 +27,9 @@ module.exports = {
.assert.containsText('@breadcrumb', folder)
},
/**
+ * Create a folder with the given name
*
- * @param {string} name
+ * @param {string} name to set or null to use default value from dialog
* @param {boolean} expectToSucceed
*/
createFolder: function (name, expectToSucceed = true) {
@@ -38,7 +39,11 @@ module.exports = {
.waitForElementVisible('@newFolderButton')
.click('@newFolderButton')
.waitForElementVisible('@newFolderInput')
- .setValue('@newFolderInput', name)
+ if (name !== null) {
+ this.clearValueWithEvent('@newFolderInput')
+ this.setValue('@newFolderInput', name)
+ }
+ this
.click('@newFolderOkButton')
.waitForElementNotPresent('@createFolderLoadingIndicator')
if (expectToSucceed) {
@@ -152,7 +157,7 @@ module.exports = {
},
elements: {
newFileMenuButton: {
- selector: '#new-file-menu-btn'
+ selector: '#new-file-menu-btn:enabled'
},
deleteSelectedButton: {
selector: '#delete-selected-btn'
diff --git a/tests/acceptance/pageObjects/phoenixPage.js b/tests/acceptance/pageObjects/phoenixPage.js
index 2534248d093..a93895a2301 100644
--- a/tests/acceptance/pageObjects/phoenixPage.js
+++ b/tests/acceptance/pageObjects/phoenixPage.js
@@ -66,7 +66,7 @@ module.exports = {
selector: '#resolve-notification-button'
},
ocDialogPromptAlert: {
- selector: '#oc-dialog-prompt-alert'
+ selector: '.uk-modal.uk-open .oc-dialog-prompt-alert'
},
searchInputFieldHighResolution: {
selector: '(//input[contains(@class, "oc-search-input")])[1]',
diff --git a/tests/acceptance/stepDefinitions/filesContext.js b/tests/acceptance/stepDefinitions/filesContext.js
index 7f8af6c36d0..e3e15e1bd67 100644
--- a/tests/acceptance/stepDefinitions/filesContext.js
+++ b/tests/acceptance/stepDefinitions/filesContext.js
@@ -74,6 +74,14 @@ When('the user creates a folder with the name {string} using the webUI', functio
return client.page.filesPage().createFolder(folderName)
})
+When('the user creates a folder with default name using the webUI', function () {
+ return client.page.filesPage().createFolder(null, false)
+})
+
+When('the user creates a folder without name using the webUI', function () {
+ return client.page.filesPage().createFolder('', false)
+})
+
When('the user creates a folder with the invalid name {string} using the webUI', function (folderName) {
return client.page.filesPage().createFolder(folderName, false)
})