couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject fauxton commit: updated refs/heads/master to e221bcd
Date Mon, 18 Jan 2016 14:07:05 GMT
Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master f3dcd3a40 -> e221bcd01


format json in titles

in order to get a better readability

PR: #606
PR-URL: https://github.com/apache/couchdb-fauxton/pull/606
Reviewed-By: Benjamin Keen <ben.keen@gmail.com>


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

Branch: refs/heads/master
Commit: e221bcd01dd8a173f8e7830200cd3c4615a67d05
Parents: f3dcd3a
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Fri Jan 15 11:41:32 2016 +0100
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Mon Jan 18 15:08:31 2016 +0100

----------------------------------------------------------------------
 .../index-results.components.react.jsx          |  2 +-
 .../index-results.componentsSpec.react.jsx      | 36 ++++++++++++++++++++
 2 files changed, 37 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e221bcd0/app/addons/documents/index-results/index-results.components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/index-results.components.react.jsx b/app/addons/documents/index-results/index-results.components.react.jsx
index dcbec93..5052609 100644
--- a/app/addons/documents/index-results/index-results.components.react.jsx
+++ b/app/addons/documents/index-results/index-results.components.react.jsx
@@ -72,7 +72,7 @@ function (app, FauxtonAPI, React, Stores, Actions, Components, Documents,
Fauxto
       var row = this.props.data.selectedFields.map(function (k, i) {
 
         var key = 'tableview-data-cell-' + rowNumber + k + i + el[k];
-        var stringified = typeof el[k] === 'object' ? JSON.stringify(el[k]) : el[k];
+        var stringified = typeof el[k] === 'object' ? JSON.stringify(el[k], null, '  ') :
el[k];
 
         return (
           <td key={key} title={stringified}>

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/e221bcd0/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
b/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
index 1e05692..7182cb6 100644
--- a/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
+++ b/app/addons/documents/index-results/tests/index-results.componentsSpec.react.jsx
@@ -254,6 +254,42 @@ define([
 
     });
 
+    describe('cellcontent', function () {
+      beforeEach(function () {
+        container = document.createElement('div');
+        store.reset();
+      });
+
+      afterEach(function () {
+        React.unmountComponentAtNode(React.findDOMNode(instance).parentNode);
+        store.reset();
+      });
+
+      it('formats title elements for better readability', function () {
+        var doc = {object: {a: 1, foo: [1, 2, 3]}};
+
+        IndexResultsActions.sendMessageNewResultList({
+          collection: createDocColumn([doc]),
+          bulkCollection: new Documents.BulkDeleteDocCollection([], {databaseId: '1'}),
+        });
+
+        store.toggleTableView({enable: true});
+
+        IndexResultsActions.resultsListReset();
+
+        instance = TestUtils.renderIntoDocument(
+          <Views.List />,
+          container
+        );
+
+        var $el = $(instance.getDOMNode());
+        var $targetNode = $el.find('td.tableview-el-last').prev();
+
+        var formattedDoc = JSON.stringify(doc.object, null, '  ');
+        assert.equal($targetNode.attr('title'), formattedDoc);
+      });
+
+    });
     describe('wrapped autocomplete', function () {
       it('renders a filter icon if no text given', function () {
 


Mime
View raw message