couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject [06/10] fauxton commit: updated refs/heads/2158-changes-filter to b1121db
Date Thu, 17 Jul 2014 17:14:18 GMT
make filtering case insensitive


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/f53e55b1
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/f53e55b1
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/f53e55b1

Branch: refs/heads/2158-changes-filter
Commit: f53e55b1652c462c46d94f2147089cf04621e0dd
Parents: 5ca3f3c
Author: Robert Kowalski <rok@kowalski.gd>
Authored: Thu May 29 15:36:09 2014 +0200
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Thu Jul 17 19:13:37 2014 +0200

----------------------------------------------------------------------
 app/addons/fauxton/components.js             |  2 +-
 app/addons/fauxton/tests/filteredViewSpec.js | 41 +++++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f53e55b1/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 1853ece..2ff90b6 100644
--- a/app/addons/fauxton/components.js
+++ b/app/addons/fauxton/components.js
@@ -351,7 +351,7 @@ function(app, FauxtonAPI, ace, spin) {
           var match = false;
 
           _.each(element, function (value) {
-            if (new RegExp(filter).test(value.toString())) {
+            if (new RegExp(filter, 'i').test(value.toString())) {
               match = true;
             }
           });

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/f53e55b1/app/addons/fauxton/tests/filteredViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/filteredViewSpec.js b/app/addons/fauxton/tests/filteredViewSpec.js
new file mode 100644
index 0000000..c24d439
--- /dev/null
+++ b/app/addons/fauxton/tests/filteredViewSpec.js
@@ -0,0 +1,41 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+define([
+       'app',
+       'addons/fauxton/components',
+       'testUtils'
+], function (app, Components, testUtils) {
+  var assert = testUtils.assert;
+
+  describe('FilteredView', function () {
+    var filteredView;
+
+
+    beforeEach(function () {
+      filteredView = new Components.FilteredView();
+    });
+
+    afterEach(function () {
+    });
+
+    it('should be case insensitive', function () {
+      filteredView.filters = ['ente'];
+      var res = filteredView.createFilteredData([
+        {id: 'LALA', bar: 'ENTE'},
+        {id: '1', bar: '1', deleted: true},
+        {id: '2', bar: '2'}
+      ]);
+      assert.equal(res.length, 1);
+    });
+  });
+});


Mime
View raw message