couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [02/15] fauxton commit: updated refs/heads/import-master to 8cb432c
Date Sat, 07 Jun 2014 21:04:26 GMT
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-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/37e449ad
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/37e449ad
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/37e449ad

Branch: refs/heads/import-master
Commit: 37e449ad5f951799ca71233de50bd0774deff696
Parents: ccc03b6
Author: Robert Kowalski <rok@kowalski.gd>
Authored: Fri May 16 21:25:00 2014 +0200
Committer: Robert Kowalski <rok@kowalski.gd>
Committed: Fri May 16 21:25:00 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/37e449ad/app/addons/fauxton/components.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/components.js b/app/addons/fauxton/components.js
index 52e7e8b..79a9320 100644
--- a/app/addons/fauxton/components.js
+++ b/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-fauxton/blob/37e449ad/app/addons/fauxton/tests/filterViewSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/fauxton/tests/filterViewSpec.js b/app/addons/fauxton/tests/filterViewSpec.js
index 3fb1748..fec970d 100644
--- a/app/addons/fauxton/tests/filterViewSpec.js
+++ b/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);
+    });
   });
 });


Mime
View raw message