Merge pull request #22065 from owncloud/systemtags-create-same-prefix
Allow creating tags where another one with same prefix exists
This commit is contained in:
commit
86581f6626
|
@ -320,7 +320,9 @@
|
||||||
*/
|
*/
|
||||||
_createSearchChoice: function(term) {
|
_createSearchChoice: function(term) {
|
||||||
term = term.trim();
|
term = term.trim();
|
||||||
if (this.collection.filterByName(term).length) {
|
if (this.collection.filter(function(entry) {
|
||||||
|
return entry.get('name') === term;
|
||||||
|
}).length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!this._newTag) {
|
if (!this._newTag) {
|
||||||
|
|
|
@ -85,6 +85,15 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() {
|
||||||
expect(result.userVisible).toEqual(true);
|
expect(result.userVisible).toEqual(true);
|
||||||
expect(result.userAssignable).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() {
|
it('creates the real tag and fires select event after user selects the dummy tag', function() {
|
||||||
var selectHandler = sinon.stub();
|
var selectHandler = sinon.stub();
|
||||||
view.on('select', selectHandler);
|
view.on('select', selectHandler);
|
||||||
|
|
Loading…
Reference in New Issue