You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by be...@apache.org on 2015/05/25 17:48:24 UTC
[1/2] fauxton commit: updated refs/heads/master to 17e4d04
Repository: couchdb-fauxton
Updated Branches:
refs/heads/master b65b98574 -> 17e4d040a
Option to show only editor in CodeEditor component
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/1d1d82f4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/1d1d82f4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/1d1d82f4
Branch: refs/heads/master
Commit: 1d1d82f4b2e0fc347fe4562e4d631205970401e5
Parents: 91fc5e3
Author: Ben Keen <be...@gmail.com>
Authored: Fri May 22 14:34:04 2015 -0700
Committer: Ben Keen <be...@gmail.com>
Committed: Mon May 25 08:13:15 2015 -0700
----------------------------------------------------------------------
.../components/react-components.react.jsx | 5 +
app/addons/components/tests/codeEditorSpec.js | 115 -------------------
app/addons/components/tests/codeEditorSpec.jsx | 19 +++
3 files changed, 24 insertions(+), 115 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d1d82f4/app/addons/components/react-components.react.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/react-components.react.jsx b/app/addons/components/react-components.react.jsx
index bf8c6af..427f811 100644
--- a/app/addons/components/react-components.react.jsx
+++ b/app/addons/components/react-components.react.jsx
@@ -71,6 +71,7 @@ function (app, FauxtonAPI, React, Components, ace, beautifyHelper) {
theme: 'idle_fingers',
fontSize: 13,
code: '',
+ showEditorOnly: false,
showGutter: true,
highlightActiveLine: true,
showPrintMargin: false,
@@ -254,6 +255,10 @@ function (app, FauxtonAPI, React, Components, ace, beautifyHelper) {
},
render: function () {
+ if (this.props.showEditorOnly) {
+ return (<div ref="ace" className="js-editor" id={this.props.id}></div>);
+ }
+
return (
<div className="control-group">
{this.getTitleFragment()}
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d1d82f4/app/addons/components/tests/codeEditorSpec.js
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/codeEditorSpec.js b/app/addons/components/tests/codeEditorSpec.js
deleted file mode 100644
index 62e7c3a..0000000
--- a/app/addons/components/tests/codeEditorSpec.js
+++ /dev/null
@@ -1,115 +0,0 @@
-// 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.
-define([
- 'api',
- 'addons/components/react-components.react',
-
- 'testUtils',
- 'react'
-], function (FauxtonAPI, ReactComponents, utils, React) {
-
- var assert = utils.assert;
- var TestUtils = React.addons.TestUtils;
- var code = 'function (doc) {\n emit(doc._id, 1);\n}';
- var code2 = 'function (doc) {\n if(doc._id) { \n emit(doc._id, 2); \n } \n}';
-
- describe('Code Editor', function () {
- var container, codeEditorEl, spy;
-
- beforeEach(function () {
- spy = sinon.spy();
- container = document.createElement('div');
- codeEditorEl = TestUtils.renderIntoDocument(
- React.createElement(ReactComponents.CodeEditor, {code: code, change: spy}),
- container
- );
- });
-
- afterEach(function () {
- React.unmountComponentAtNode(container);
- });
-
- describe('Tracking edits', function () {
-
- it('no change on mount', function () {
- assert.notOk(codeEditorEl.hasChanged());
- });
-
- it('detects change on user input', function () {
- codeEditorEl.editor.setValue(code2, -1);
-
- assert.ok(codeEditorEl.hasChanged());
- });
-
- });
-
- describe('onBlur', function () {
-
- it('calls changed function', function () {
- codeEditorEl.editor._emit('blur');
- assert.ok(spy.calledOnce);
- });
-
- });
-
- describe('setHeightToLineCount', function () {
-
- beforeEach(function () {
- codeEditorEl = TestUtils.renderIntoDocument(
- React.createElement(ReactComponents.CodeEditor, {code: code, isFullPageEditor: false, setHeightWithJS: true}),
- container
- );
-
- });
-
- it('sets line height correctly for non full page', function () {
- var spy = sinon.spy(codeEditorEl.editor, 'setOptions');
-
- codeEditorEl.setHeightToLineCount();
- assert.ok(spy.calledOnce);
- assert.equal(spy.getCall(0).args[0].maxLines, 3);
- });
-
- });
-
- describe('removeIncorrectAnnotations', function () {
-
- beforeEach(function () {
- codeEditorEl = TestUtils.renderIntoDocument(
- React.createElement(ReactComponents.CodeEditor, {code: code}),
- container
- );
-
- });
-
- it('removes default errors that do not apply to CouchDB Views', function () {
- assert.equal(codeEditorEl.getAnnotations(), 0);
- });
-
- });
-
- describe('setEditorValue', function () {
-
- it('sets new code', function () {
- codeEditorEl = TestUtils.renderIntoDocument(
- React.createElement(ReactComponents.CodeEditor, {code: code}),
- container
- );
-
- codeEditorEl.setEditorValue(code2);
- assert.deepEqual(codeEditorEl.getValue(), code2);
- });
-
- });
-
- });
-});
http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/1d1d82f4/app/addons/components/tests/codeEditorSpec.jsx
----------------------------------------------------------------------
diff --git a/app/addons/components/tests/codeEditorSpec.jsx b/app/addons/components/tests/codeEditorSpec.jsx
index 849f36c..73f9ce1 100644
--- a/app/addons/components/tests/codeEditorSpec.jsx
+++ b/app/addons/components/tests/codeEditorSpec.jsx
@@ -111,5 +111,24 @@ define([
});
+ describe('showEditorOnly', function () {
+
+ it('only shows editor when showEditorOnly=true', function () {
+ codeEditorEl = TestUtils.renderIntoDocument(
+ <ReactComponents.CodeEditor code={code} showEditorOnly={true} />,
+ container
+ );
+ assert.notOk($(codeEditorEl.getDOMNode()).hasClass('control-group'));
+ });
+
+ it('shows everything by default', function () {
+ var codeEditorEl = TestUtils.renderIntoDocument(
+ <ReactComponents.CodeEditor code={code} />,
+ container
+ );
+ assert.ok($(codeEditorEl.getDOMNode()).hasClass('control-group'));
+ });
+
+ });
});
});
[2/2] fauxton commit: updated refs/heads/master to 17e4d04
Posted by be...@apache.org.
Merge branch 'codeeditor-tweak'
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/17e4d040
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/17e4d040
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/17e4d040
Branch: refs/heads/master
Commit: 17e4d040a267d6d4b7b728bfe7489bfd84b6c7f4
Parents: b65b985 1d1d82f
Author: Ben Keen <be...@gmail.com>
Authored: Mon May 25 08:47:56 2015 -0700
Committer: Ben Keen <be...@gmail.com>
Committed: Mon May 25 08:47:56 2015 -0700
----------------------------------------------------------------------
.../components/react-components.react.jsx | 5 +
app/addons/components/tests/codeEditorSpec.js | 115 -------------------
app/addons/components/tests/codeEditorSpec.jsx | 19 +++
3 files changed, 24 insertions(+), 115 deletions(-)
----------------------------------------------------------------------