Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 110CF200B92 for ; Wed, 28 Sep 2016 12:54:29 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 0B8BA160AD4; Wed, 28 Sep 2016 10:54:29 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9EF26160AB4 for ; Wed, 28 Sep 2016 12:54:27 +0200 (CEST) Received: (qmail 41450 invoked by uid 500); 28 Sep 2016 10:54:26 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 41441 invoked by uid 99); 28 Sep 2016 10:54:26 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 28 Sep 2016 10:54:26 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 3F108DFF5A; Wed, 28 Sep 2016 10:54:26 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: robertkowalski@apache.org To: commits@couchdb.apache.org Message-Id: <2a3e9c33f92840ab9b0450d707c4c9a0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: fauxton commit: updated refs/heads/master to 1755469 Date: Wed, 28 Sep 2016 10:54:26 +0000 (UTC) archived-at: Wed, 28 Sep 2016 10:54:29 -0000 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 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 Authored: Tue Sep 27 18:52:09 2016 +0200 Committer: Robert Kowalski 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;