You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by dc...@apache.org on 2014/08/14 01:26:00 UTC

[12/50] couchdb commit: updated refs/heads/1.6.x to eeb31cb

Fauxton: Do not add empty filters

Do not add filters, when someone submits the form and did not
enter anything


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

Branch: refs/heads/1.6.x
Commit: 2abdb2cca937ca4551edb92bba8066672033042f
Parents: d8bd7ee
Author: Robert Kowalski <ro...@kowalski.gd>
Authored: Fri May 16 21:25:00 2014 +0200
Committer: Robert Kowalski <ro...@kowalski.gd>
Committed: Fri May 16 21:25:00 2014 +0200

----------------------------------------------------------------------
 src/fauxton/app/addons/fauxton/components.js           | 6 +++++-
 src/fauxton/app/addons/fauxton/tests/filterViewSpec.js | 6 ++++++
 2 files changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/2abdb2cc/src/fauxton/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/fauxton/components.js b/src/fauxton/app/addons/fauxton/components.js
index 52e7e8b..79a9320 100644
--- a/src/fauxton/app/addons/fauxton/components.js
+++ b/src/fauxton/app/addons/fauxton/components.js
@@ -354,7 +354,11 @@ function(app, FauxtonAPI, ace, spin) {
     filterLogs: function (event) {
       event.preventDefault();
       var $filter = this.$('input[name="filter"]'),
-          filter = $filter.val();
+          filter = $.trim($filter.val());
+
+      if (!filter) {
+        return;
+      }
 
       this.eventListener.trigger(this.eventNamespace + ":filter", filter);
 

http://git-wip-us.apache.org/repos/asf/couchdb/blob/2abdb2cc/src/fauxton/app/addons/fauxton/tests/filterViewSpec.js
----------------------------------------------------------------------
diff --git a/src/fauxton/app/addons/fauxton/tests/filterViewSpec.js b/src/fauxton/app/addons/fauxton/tests/filterViewSpec.js
index 3fb1748..fec970d 100644
--- a/src/fauxton/app/addons/fauxton/tests/filterViewSpec.js
+++ b/src/fauxton/app/addons/fauxton/tests/filterViewSpec.js
@@ -77,5 +77,11 @@ define([
 
       assert.equal(0, filterView.$('.js-remove-filter').length);
     });
+
+    it('should not add empty filters', function () {
+      filterView.$('[name="filter"]').val('');
+      filterView.$('.js-log-filter-form').submit();
+      assert.equal(0, filterView.$('.js-remove-filter').length);
+    });
   });
 });