couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From benk...@apache.org
Subject fauxton commit: updated refs/heads/master to aa52e40
Date Mon, 21 Mar 2016 18:03:31 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 3ff6ff622 -> aa52e40d4


QueryButtons component now passed close handler

Needed to be able to reuse the component elsewhere.


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

Branch: refs/heads/master
Commit: aa52e40d432ecaeeaf04e31ed2597efd6d51078c
Parents: 3ff6ff6
Author: Ben Keen <ben.keen@gmail.com>
Authored: Wed Mar 9 12:36:54 2016 -0800
Committer: Ben Keen <ben.keen@gmail.com>
Committed: Mon Mar 21 11:03:11 2016 -0700

----------------------------------------------------------------------
 .../queryoptions/queryoptions.react.jsx         | 12 ++++++++++--
 .../tests/queryoptions.componentsSpec.react.jsx | 20 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/aa52e40d/app/addons/documents/queryoptions/queryoptions.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/queryoptions.react.jsx b/app/addons/documents/queryoptions/queryoptions.react.jsx
index 74e8dd2..aab20b6 100644
--- a/app/addons/documents/queryoptions/queryoptions.react.jsx
+++ b/app/addons/documents/queryoptions/queryoptions.react.jsx
@@ -274,8 +274,12 @@ A key value is the first parameter emitted in a map function. For example
emit("
   });
 
   var QueryButtons = React.createClass({
+    propTypes: {
+      onCancel: React.PropTypes.func.isRequired
+    },
+
     hideTray: function (e) {
-      Actions.toggleQueryBarVisibility(false);
+      this.props.onCancel();
     },
 
     render: function () {
@@ -343,6 +347,10 @@ A key value is the first parameter emitted in a map function. For example
emit("
       Actions.toggleQueryBarVisibility(!this.props.contentVisible);
     },
 
+    closeTray: function () {
+      Actions.toggleQueryBarVisibility(false);
+    },
+
     componentDidMount: function () {
       $('body').on('click.QueryTray', function (e) {
         if ($(e.target).closest('#query-options').length) {
@@ -396,7 +404,7 @@ A key value is the first parameter emitted in a map function. For example
emit("
               updateSkip={Actions.updateSkip}
               updateLimit={Actions.updateLimit}
               limit={this.props.limit} />
-            <QueryButtons />
+            <QueryButtons onCancel={this.closeTray} />
           </form>
         </TrayContents>
       );

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/aa52e40d/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
b/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
index 47ed9c8..66ebea4 100644
--- a/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
+++ b/app/addons/documents/queryoptions/tests/queryoptions.componentsSpec.react.jsx
@@ -170,6 +170,26 @@ define([
         assert.equal(val, '3');
       });
     });
+
   });
 
+  describe('QueryButtons', function () {
+    var container;
+
+    beforeEach(function () {
+      container = document.createElement('div');
+    });
+
+    afterEach(function () {
+      ReactDOM.unmountComponentAtNode(container);
+    });
+
+    describe('cancel event fires', function () {
+      var spy = sinon.spy();
+      var component = TestUtils.renderIntoDocument(<Views.QueryButtons onCancel={spy}
/>, container);
+      TestUtils.Simulate.click($(ReactDOM.findDOMNode(component)).find('a')[0]);
+      assert.ok(spy.calledOnce);
+    });
+
+  });
 });


Mime
View raw message