diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-21 11:15:49 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-03-21 11:15:49 +0100 |
commit | 86581f66265be0dddb97f67ac867a5cb92d335e0 (patch) | |
tree | 956fabb936a04c890c174124f9c8a0c93d85dc93 /core/js | |
parent | 8852fdaee3ee9b6bb52cbafcf358199321eb2307 (diff) | |
parent | 22be3867f132537de16a88d15c2d286604f89593 (diff) | |
download | nextcloud-server-86581f66265be0dddb97f67ac867a5cb92d335e0.tar.gz nextcloud-server-86581f66265be0dddb97f67ac867a5cb92d335e0.zip |
Merge pull request #22065 from owncloud/systemtags-create-same-prefix
Allow creating tags where another one with same prefix exists
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/systemtags/systemtagsinputfield.js | 4 | ||||
-rw-r--r-- | core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js | 9 |
2 files changed, 12 insertions, 1 deletions
diff --git a/core/js/systemtags/systemtagsinputfield.js b/core/js/systemtags/systemtagsinputfield.js index 148d52b57dd..45dc5b7b03e 100644 --- a/core/js/systemtags/systemtagsinputfield.js +++ b/core/js/systemtags/systemtagsinputfield.js @@ -320,7 +320,9 @@ */ _createSearchChoice: function(term) { term = term.trim(); - if (this.collection.filterByName(term).length) { + if (this.collection.filter(function(entry) { + return entry.get('name') === term; + }).length) { return; } if (!this._newTag) { diff --git a/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js b/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js index aadf0de53f2..22bf0d2c82a 100644 --- a/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js +++ b/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js @@ -85,6 +85,15 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { expect(result.userVisible).toEqual(true); expect(result.userAssignable).toEqual(true); }); + it('creates dummy tag when user types non-matching name even with prefix of existing tag', function() { + var opts = select2Stub.getCall(0).args[0]; + var result = opts.createSearchChoice('ab'); + expect(result.id).toEqual(-1); + expect(result.name).toEqual('ab'); + expect(result.isNew).toEqual(true); + expect(result.userVisible).toEqual(true); + expect(result.userAssignable).toEqual(true); + }); it('creates the real tag and fires select event after user selects the dummy tag', function() { var selectHandler = sinon.stub(); view.on('select', selectHandler); |