You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2015/09/17 23:15:11 UTC

fauxton commit: updated refs/heads/master to a8d8886

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master a84deac1d -> a8d8886e8


Passes the database info to doc editor buttons

This just saves extensions having to wait for the doc to load to get
the database name.


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

Branch: refs/heads/master
Commit: a8d8886e876f7254cdf7c7cf35d441c86d2d024b
Parents: a84deac
Author: Ben Keen <be...@gmail.com>
Authored: Thu Sep 17 13:31:58 2015 -0700
Committer: Ben Keen <be...@gmail.com>
Committed: Thu Sep 17 13:31:58 2015 -0700

----------------------------------------------------------------------
 app/addons/documents/doc-editor/components.react.jsx      |  4 ++--
 .../doc-editor/tests/doc-editor.componentsSpec.react.jsx  | 10 +++++++++-
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a8d8886e/app/addons/documents/doc-editor/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/components.react.jsx b/app/addons/documents/doc-editor/components.react.jsx
index e4a4a79..252654c 100644
--- a/app/addons/documents/doc-editor/components.react.jsx
+++ b/app/addons/documents/doc-editor/components.react.jsx
@@ -25,7 +25,7 @@ define([
         cloneDocModalVisible: store.isCloneDocModalVisible(),
         uploadModalVisible: store.isUploadModalVisible(),
         deleteDocModalVisible: store.isDeleteDocModalVisible(),
-        numFilesUploaded: store.getNumFilesUploaded(),
+        numFilesUploaded: store.getNumFilesUploaded()
       };
     },
 
@@ -158,7 +158,7 @@ define([
     getExtensionIcons: function () {
       var extensions = FauxtonAPI.getExtensions('DocEditor:icons');
       return _.map(extensions, function (Extension, i) {
-        return (<Extension doc={this.state.doc} key={i} />);
+        return (<Extension doc={this.state.doc} key={i} database={this.props.database} />);
       }, this);
     },
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/a8d8886e/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx b/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx
index 15258e2..c8d3d83 100644
--- a/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx
+++ b/app/addons/documents/doc-editor/tests/doc-editor.componentsSpec.react.jsx
@@ -55,6 +55,7 @@ define([
   };
 
   var database = {
+    id: 'id',
     safeID: function () { return 'id'; }
   };
 
@@ -190,7 +191,10 @@ define([
       var CustomButton = React.createClass({
         render: function () {
           return (
-            <button>Oh no she di'n't!</button>
+            <div>
+              <button>Oh no she di'n't!</button>
+              <span id="testDatabaseName">{this.props.database.id}</span>
+            </div>
           );
         }
       });
@@ -199,6 +203,10 @@ define([
       var container = document.createElement('div');
       var el = TestUtils.renderIntoDocument(<Components.DocEditorController database={database} />, container);
       assert.isTrue(/Oh\sno\sshe\sdi'n't!/.test(el.getDOMNode().outerHTML));
+
+      // confirm the database name was also included
+      assert.equal($(el.getDOMNode()).find("#testDatabaseName").html(), database.id);
+
       React.unmountComponentAtNode(container);
     });
   });