Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 5ee99031f -> 4ee96f6c7


fix table view for include docs

display doc content if include docs is selected

PR: #588
PR-URL: https://github.com/apache/couchdb-fauxton/pull/588
Reviewed-By: Benjamin Keen <[email protected]>


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

Branch: refs/heads/master
Commit: 4ee96f6c7d2f4978a6d537cb2c90d745bb198186
Parents: 5ee9903
Author: Robert Kowalski <[email protected]>
Authored: Wed Dec 2 17:55:03 2015 +0100
Committer: Robert Kowalski <[email protected]>
Committed: Thu Dec 3 18:05:51 2015 +0100

----------------------------------------------------------------------
 .../index-results.components.react.jsx          |  2 +-
 .../documents/tests/nightwatch/tableView.js     | 68 ++++++++++++++++++++
 2 files changed, 69 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/4ee96f6c/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 92cdfdc..089b83d 100644
--- a/app/addons/documents/index-results/index-results.components.react.jsx
+++ b/app/addons/documents/index-results/index-results.components.react.jsx
@@ -58,7 +58,7 @@ function (app, FauxtonAPI, React, Stores, Actions, 
Components, Documents) {
 
     getRowContents: function (element, rownumber) {
       var row = this.props.schema.map(function (k, i) {
-        var el = element.content;
+        var el = element.content.doc || element.content;
         var key = 'tableview-data-cell-' + rownumber + k + i + el[k];
         var stringified = typeof el[k] === 'object' ? JSON.stringify(el[k]) : 
el[k];
         var className = k === '_id' ? 'tableview-data-cell-id' : null;

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/4ee96f6c/app/addons/documents/tests/nightwatch/tableView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/tableView.js 
b/app/addons/documents/tests/nightwatch/tableView.js
new file mode 100644
index 0000000..4fc704d
--- /dev/null
+++ b/app/addons/documents/tests/nightwatch/tableView.js
@@ -0,0 +1,68 @@
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy 
of
+// the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations 
under
+// the License.
+
+module.exports = {
+
+  'Shows data in the table for all docs (include docs enabled)': function 
(client) {
+    var waitTime = client.globals.maxWaitTime,
+      newDatabaseName = client.globals.testDatabaseName,
+      newDocumentName1 = 'bulktest1',
+      newDocumentName2 = 'bulktest2',
+      baseUrl = client.globals.test_settings.launch_url;
+
+    client
+      .loginToGUI()
+      .createDocument(newDocumentName1, newDatabaseName)
+      .createDocument(newDocumentName2, newDatabaseName)
+      .url(baseUrl + '/#/database/' + newDatabaseName + 
'/_all_docs?include_docs=true')
+
+      // ensures page content has loaded before proceeding
+      .waitForElementVisible('.prettyprint', waitTime, false)
+      .clickWhenVisible('.control-view')
+      .clickWhenVisible('.alternative-header .dropdown-menu li:last-child a')
+      .getText('.table', function (result) {
+        var data = result.value;
+
+        this.verify.ok(data.indexOf('testingValue') !== -1,
+          'Check if doc content is shown in table');
+      })
+
+      .end();
+  },
+
+  'Shows data in the table for all docs (include docs disabled)': function 
(client) {
+    var waitTime = client.globals.maxWaitTime,
+      newDatabaseName = client.globals.testDatabaseName,
+      newDocumentName1 = 'bulktest1',
+      newDocumentName2 = 'bulktest2',
+      baseUrl = client.globals.test_settings.launch_url;
+
+    client
+      .loginToGUI()
+      .createDocument(newDocumentName1, newDatabaseName)
+      .createDocument(newDocumentName2, newDatabaseName)
+      .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
+
+      // ensures page content has loaded before proceeding
+      .waitForElementVisible('.prettyprint', waitTime, false)
+      .clickWhenVisible('.control-view')
+      .clickWhenVisible('.alternative-header .dropdown-menu li:last-child a')
+      .getText('.table', function (result) {
+        var data = result.value;
+
+        this.verify.ok(data.indexOf('bulktest1') !== -1,
+          'Check if doc content is shown in table');
+      })
+
+      .end();
+  },
+};

Reply via email to