You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ro...@apache.org on 2016/09/28 10:54:26 UTC

fauxton commit: updated refs/heads/master to 1755469

Repository: couchdb-fauxton
Updated Branches:
  refs/heads/master 717512f5f -> 175546946


views: remove fauxton side check for js warnings / errors

these should be checked in one single place, the database.

this way we don't have to maintain two separate whitelists for
errors.

PR: #780
PR-URL: https://github.com/apache/couchdb-fauxton/pull/780
Reviewed-By: garren smith <ga...@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/17554694
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/17554694
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/17554694

Branch: refs/heads/master
Commit: 1755469468af811033d79a2e003b3e90221ffd34
Parents: 717512f
Author: Robert Kowalski <ro...@apache.org>
Authored: Tue Sep 27 18:52:09 2016 +0200
Committer: Robert Kowalski <ro...@apache.org>
Committed: Wed Sep 28 12:54:20 2016 +0200

----------------------------------------------------------------------
 app/addons/documents/index-editor/actions.js    |  6 +++++
 .../documents/index-editor/components.react.jsx | 15 ------------
 .../tests/viewIndex.componentsSpec.react.jsx    | 18 ---------------
 .../documents/tests/nightwatch/viewCreate.js    | 24 ++++++++++++++++++++
 4 files changed, 30 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/17554694/app/addons/documents/index-editor/actions.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/actions.js b/app/addons/documents/index-editor/actions.js
index 48d1c21..6de2928 100644
--- a/app/addons/documents/index-editor/actions.js
+++ b/app/addons/documents/index-editor/actions.js
@@ -90,6 +90,12 @@ function saveView (viewInfo) {
     FauxtonAPI.dispatch({ type: ActionTypes.VIEW_SAVED });
     var fragment = FauxtonAPI.urls('view', 'showView', viewInfo.database.safeID(), designDoc.safeID(), app.utils.safeURLName(viewInfo.viewName));
     FauxtonAPI.navigate(fragment, { trigger: true });
+  }, (xhr) => {
+    FauxtonAPI.addNotification({
+      msg: `${xhr.responseJSON.reason}`,
+      type: 'error',
+      clear: true
+    });
   });
 }
 

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/17554694/app/addons/documents/index-editor/components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/components.react.jsx b/app/addons/documents/index-editor/components.react.jsx
index ff01e3a..4b461e0 100644
--- a/app/addons/documents/index-editor/components.react.jsx
+++ b/app/addons/documents/index-editor/components.react.jsx
@@ -271,12 +271,6 @@ var EditorController = React.createClass({
     }
   },
 
-  hasErrors: function () {
-    var mapEditorErrors = this.refs.mapEditor.getEditor().hasErrors();
-    var customReduceErrors = (store.hasCustomReduce()) ? this.refs.reduceEditor.getEditor().hasErrors() : false;
-    return mapEditorErrors || customReduceErrors;
-  },
-
   saveView: function (e) {
     e.preventDefault();
 
@@ -284,15 +278,6 @@ var EditorController = React.createClass({
       return;
     }
 
-    if (this.hasErrors()) {
-      FauxtonAPI.addNotification({
-        msg: 'Please fix the Javascript errors and try again.',
-        type: 'error',
-        clear: true
-      });
-      return;
-    }
-
     Actions.saveView({
       database: this.state.database,
       newView: this.state.isNewView,

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/17554694/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx b/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx
index a12409c..d36ee3a 100644
--- a/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx
+++ b/app/addons/documents/index-editor/tests/viewIndex.componentsSpec.react.jsx
@@ -259,24 +259,6 @@ describe('Editor', function () {
     sandbox.restore();
   });
 
-  it('returns false on invalid map editor code', function () {
-    var stub = sandbox.stub(editorEl.refs.mapEditor.getEditor(), 'hasErrors');
-    stub.returns(false);
-    assert.notOk(editorEl.hasErrors());
-  });
-
-  it('returns true on valid map editor code', function () {
-    var stub = sandbox.stub(editorEl.refs.mapEditor.getEditor(), 'hasErrors');
-    stub.returns(true);
-    assert.ok(editorEl.hasErrors());
-  });
-
-  it('returns false on non-custom reduce', function () {
-    var stub = sandbox.stub(Stores.indexEditorStore, 'hasCustomReduce');
-    stub.returns(false);
-    assert.notOk(editorEl.hasErrors());
-  });
-
   it('calls changeViewName on view name change', function () {
     var viewName = 'new-name';
     var spy = sandbox.spy(Actions, 'changeViewName');

http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/17554694/app/addons/documents/tests/nightwatch/viewCreate.js
----------------------------------------------------------------------
diff --git a/app/addons/documents/tests/nightwatch/viewCreate.js b/app/addons/documents/tests/nightwatch/viewCreate.js
index 3c8e2bf..9fd27f9 100644
--- a/app/addons/documents/tests/nightwatch/viewCreate.js
+++ b/app/addons/documents/tests/nightwatch/viewCreate.js
@@ -14,6 +14,30 @@
 
 module.exports = {
 
+  'creates design docs with js hint errors': function (client) {
+    const waitTime = client.globals.maxWaitTime;
+    const baseUrl = client.globals.test_settings.launch_url;
+
+    /*jshint multistr: true */
+    openDifferentDropdownsAndClick(client, '#header-dropdown-menu')
+      .waitForElementPresent('#new-ddoc', waitTime, false)
+      .setValue('#new-ddoc', 'test_design_doc-selenium-0')
+      .clearValue('#index-name')
+      .setValue('#index-name', 'furbie')
+      .execute('\
+        var editor = ace.edit("map-function");\
+        editor.getSession().setValue("function (doc) { if (doc != \'\') { emit(\'blerg\'); } else { emit(\'nana\'); }  }");\
+      ')
+      .execute('$("#save-view")[0].scrollIntoView();')
+      .waitForElementPresent('#save-view', waitTime, false)
+      .clickWhenVisible('#save-view', waitTime, false)
+      .checkForDocumentCreated('_design/test_design_doc-selenium-0')
+      .waitForElementPresent('.prettyprint', waitTime, false)
+      .waitForElementNotPresent('.loading-lines', waitTime, false)
+      .assert.containsText('.prettyprint', 'blerg')
+    .end();
+  },
+
   'Creates a Design Doc using the dropdown at "all documents"': function (client) {
     var waitTime = client.globals.maxWaitTime;
     var baseUrl = client.globals.test_settings.launch_url;