summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@owncloud.com>2016-02-14 20:41:39 +0100
committerRoeland Jago Douma <rullzer@owncloud.com>2016-02-14 20:41:39 +0100
commit33ef240b39d261cd8a68f4240561a1850aa8e387 (patch)
treebab5e8fbf84db4b6738aa69db312dde03c3d8b7f /core
parentac367b97f0567481d3496a213c04eeb5cf654a9f (diff)
downloadnextcloud-server-33ef240b39d261cd8a68f4240561a1850aa8e387.tar.gz
nextcloud-server-33ef240b39d261cd8a68f4240561a1850aa8e387.zip
Search tags case insensitive
fixes: #22352 * Added unit tests
Diffstat (limited to 'core')
-rw-r--r--core/js/systemtags/systemtagscollection.js2
-rw-r--r--core/js/tests/specs/systemtags/systemtagsinputfieldSpec.js54
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
+ }
+ ]);
+ });
});
});
});