Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master e68878980 -> d69b0edac


Shouldn't throw Ace Editor js error

To reproduce:
1. Select a database and select the "+ New View" option from the
dropdown on the All Documents item.
2. Click on "Databases" in the left sidebar.

Before, this caused a JS error to occur.

Nightwatch test added to confirm this fix.

Closes COUCHDB-2468


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

Branch: refs/heads/master
Commit: d69b0edaca69cdb5a49c2403f3e722a4b484e028
Parents: e688789
Author: Benjamin Keen <[email protected]>
Authored: Tue Nov 18 15:25:27 2014 -0800
Committer: Benjamin Keen <[email protected]>
Committed: Wed Nov 19 11:03:28 2014 -0800

----------------------------------------------------------------------
 app/addons/documents/routes-documents.js        |  3 ++
 .../tests/nightwatch/navigateToNewView.js       | 36 ++++++++++++++++++++
 2 files changed, 39 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/d69b0eda/app/addons/documents/routes-documents.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/routes-documents.js 
b/app/addons/documents/routes-documents.js
index 69a13ec..bb07402 100644
--- a/app/addons/documents/routes-documents.js
+++ b/app/addons/documents/routes-documents.js
@@ -520,6 +520,9 @@ function(app, FauxtonAPI, Documents, Changes, Index, 
DocEditor, Databases, Resou
     },
 
     cleanup: function () {
+      if (this.viewEditor) {
+        this.removeView('#dashboard-upper-content');
+      }
       if (this.documentsView) {
         this.removeView('#dashboard-lower-content');
       }

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/d69b0eda/app/addons/documents/tests/nightwatch/navigateToNewView.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/navigateToNewView.js 
b/app/addons/documents/tests/nightwatch/navigateToNewView.js
new file mode 100644
index 0000000..b59c5d2
--- /dev/null
+++ b/app/addons/documents/tests/nightwatch/navigateToNewView.js
@@ -0,0 +1,36 @@
+// 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 = {
+
+  // this tests that the user is able to just navigate to and from the New 
View page without errors [it confirms
+  // a bug fix for where the Ace Editor threw a JS error preventing the 
subsequent page from loading]
+  'Navigate to and from New View Page' : function (client) {
+    var waitTime = 10000,
+      newDatabaseName = client.globals.testDatabaseName,
+      baseUrl = client.globals.baseUrl;
+
+    client
+      .loginToGUI()
+      .url(baseUrl + '/#/database/' + newDatabaseName + '/_all_docs')
+      .waitForElementPresent('#new-all-docs-button', waitTime, false)
+      .click('#new-all-docs-button')
+      .waitForElementPresent('#new-all-docs-button a[href="#/database/' + 
newDatabaseName + '/new_view"]', waitTime, false)
+      .click('#new-all-docs-button a[href="#/database/' + newDatabaseName + 
'/new_view"]')
+      .waitForElementPresent('#define-view', waitTime, false)
+      .verify.urlEquals(baseUrl+'/#/database/' + newDatabaseName + '/new_view')
+
+      // now redirect back to the database page and check it's loaded properly
+      .click('#nav-links a[href="#/_all_dbs"]')
+      .waitForElementPresent('#dashboard-content .databases', waitTime, false);
+  }
+};

Reply via email to