diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-15 06:59:15 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-02-15 06:59:15 +0100 |
commit | 6cfe8caadb04a4d4189de3b64616ea060e8f41d7 (patch) | |
tree | af1d457ead71790348bd0b12f52d3a911405d175 | |
parent | e5681bf9a1f9006cfacaa89144f343bbc545ac3d (diff) | |
parent | 33ef240b39d261cd8a68f4240561a1850aa8e387 (diff) | |
download | nextcloud-server-6cfe8caadb04a4d4189de3b64616ea060e8f41d7.tar.gz nextcloud-server-6cfe8caadb04a4d4189de3b64616ea060e8f41d7.zip |
Merge pull request #22375 from owncloud/fix_22352
Search tags in UI case insensitive
-rw-r--r-- | core/js/systemtags/systemtagscollection.js | 2 | ||||
-rw-r--r-- | core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js | 54 |
2 files changed, 55 insertions, 1 deletions
diff --git a/core/js/systemtags/systemtagscollection.js b/core/js/systemtags/systemtagscollection.js index 0f8a7aa980e..8a5d309bacb 100644 --- a/core/js/systemtags/systemtagscollection.js +++ b/core/js/systemtags/systemtagscollection.js @@ -11,7 +11,7 @@ (function(OC) { function filterFunction(model, term) { - return model.get('name').substr(0, term.length) === term; + return model.get('name').substr(0, term.length).toLowerCase() === term.toLowerCase(); } /** diff --git a/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js b/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js index 08470fbdd8a..d62ef672f4d 100644 --- a/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js +++ b/core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js @@ -346,6 +346,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { new OC.SystemTags.SystemTagModel({id: '1', name: 'abc'}), new OC.SystemTags.SystemTagModel({id: '2', name: 'def'}), new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false}), + new OC.SystemTags.SystemTagModel({id: '4', name: 'Deg'}), ]); }); afterEach(function() { @@ -377,6 +378,32 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { } ]); }); + it('completes case insensitive', function() { + var callback = sinon.stub(); + opts.query({ + term: 'de', + callback: callback + }); + expect(fetchStub.calledOnce).toEqual(true); + + fetchStub.yieldTo('success', view.collection); + + expect(callback.calledOnce).toEqual(true); + expect(callback.getCall(0).args[0].results).toEqual([ + { + id: '2', + name: 'def', + userVisible: true, + userAssignable: true + }, + { + id: '4', + name: 'Deg', + userVisible: true, + userAssignable: true + } + ]); + }); }); }); @@ -446,6 +473,7 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { new OC.SystemTags.SystemTagModel({id: '1', name: 'abc'}), new OC.SystemTags.SystemTagModel({id: '2', name: 'def'}), new OC.SystemTags.SystemTagModel({id: '3', name: 'abd', userAssignable: false}), + new OC.SystemTags.SystemTagModel({id: '4', name: 'Deg'}), ]); }); afterEach(function() { @@ -471,6 +499,32 @@ describe('OC.SystemTags.SystemTagsInputField tests', function() { } ]); }); + it('completes case insensitive', function() { + var callback = sinon.stub(); + opts.query({ + term: 'de', + callback: callback + }); + expect(fetchStub.calledOnce).toEqual(true); + + fetchStub.yieldTo('success', view.collection); + + expect(callback.calledOnce).toEqual(true); + expect(callback.getCall(0).args[0].results).toEqual([ + { + id: '2', + name: 'def', + userVisible: true, + userAssignable: true + }, + { + id: '4', + name: 'Deg', + userVisible: true, + userAssignable: true + } + ]); + }); }); }); }); |