summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Zallmann <tzallmann@gitlab.com>2019-03-22 09:38:35 +0000
committerTim Zallmann <tzallmann@gitlab.com>2019-03-22 09:38:35 +0000
commite14b4b051ef4fda565b50b8d92644ab046dfcdbf (patch)
tree704ff7dfbb0e5106fde2ae6a8d7abe5e891432c2
parent5765c5989a23e6db0f54440bc9bbdb37f5eb3677 (diff)
parent1a2bdb4366ab819a43e2df48124073c836564e37 (diff)
downloadgitlab-ce-e14b4b051ef4fda565b50b8d92644ab046dfcdbf.tar.gz
Merge branch '57540-filename-trailing-space' into 'master'
Implemented trimming for item's name in Web IDE Closes #57540 See merge request gitlab-org/gitlab-ce!26270
-rw-r--r--app/assets/javascripts/ide/components/new_dropdown/modal.vue2
-rw-r--r--changelogs/unreleased/57540-filename-trailing-space.yml5
-rw-r--r--spec/javascripts/ide/components/new_dropdown/modal_spec.js12
3 files changed, 18 insertions, 1 deletions
diff --git a/app/assets/javascripts/ide/components/new_dropdown/modal.vue b/app/assets/javascripts/ide/components/new_dropdown/modal.vue
index ba6bbdfef4b..412b07553dc 100644
--- a/app/assets/javascripts/ide/components/new_dropdown/modal.vue
+++ b/app/assets/javascripts/ide/components/new_dropdown/modal.vue
@@ -29,7 +29,7 @@ export default {
return this.name || (entryPath ? `${entryPath}/` : '');
},
set(val) {
- this.name = val;
+ this.name = val.trim();
},
},
modalTitle() {
diff --git a/changelogs/unreleased/57540-filename-trailing-space.yml b/changelogs/unreleased/57540-filename-trailing-space.yml
new file mode 100644
index 00000000000..db85fb350db
--- /dev/null
+++ b/changelogs/unreleased/57540-filename-trailing-space.yml
@@ -0,0 +1,5 @@
+---
+title: Implemented whitespace-trimming for file names in Web IDE
+merge_request: 26270
+author:
+type: fixed
diff --git a/spec/javascripts/ide/components/new_dropdown/modal_spec.js b/spec/javascripts/ide/components/new_dropdown/modal_spec.js
index d1a0964ccdd..0556feae46a 100644
--- a/spec/javascripts/ide/components/new_dropdown/modal_spec.js
+++ b/spec/javascripts/ide/components/new_dropdown/modal_spec.js
@@ -109,6 +109,18 @@ describe('new file modal component', () => {
expect(vm.entryName).toBe('index.js');
});
+
+ it('removes leading/trailing spaces when found in the new name', () => {
+ vm.entryName = ' index.js ';
+
+ expect(vm.entryName).toBe('index.js');
+ });
+
+ it('does not remove internal spaces in the file name', () => {
+ vm.entryName = ' In Praise of Idleness.txt ';
+
+ expect(vm.entryName).toBe('In Praise of Idleness.txt');
+ });
});
});