Repository: couchdb-fauxton Updated Branches: refs/heads/master d71ea8b16 -> 248e98071
getEditor() method added in This exposes the editor for reference elsewhere. Project: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/commit/248e9807 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/tree/248e9807 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/diff/248e9807 Branch: refs/heads/master Commit: 248e98071522562edb02663a618bb4dcdf6827cf Parents: d71ea8b Author: Ben Keen <[email protected]> Authored: Thu Jun 18 13:39:51 2015 -0700 Committer: Ben Keen <[email protected]> Committed: Thu Jun 18 13:39:51 2015 -0700 ---------------------------------------------------------------------- app/addons/components/react-components.react.jsx | 4 ++++ app/addons/components/tests/codeEditorSpec.react.jsx | 12 ++++++++++++ 2 files changed, 16 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/248e9807/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 1186c83..9ff9b45 100644 --- a/app/addons/components/react-components.react.jsx +++ b/app/addons/components/react-components.react.jsx @@ -381,6 +381,10 @@ function (app, FauxtonAPI, React, Components, ace, beautifyHelper) { return this.editor.getValue(); }, + getEditor: function () { + return this; + }, + render: function () { return ( <div ref="ace" className="js-editor" id={this.props.id}></div> http://git-wip-us.apache.org/repos/asf/couchdb-fauxton/blob/248e9807/app/addons/components/tests/codeEditorSpec.react.jsx ---------------------------------------------------------------------- diff --git a/app/addons/components/tests/codeEditorSpec.react.jsx b/app/addons/components/tests/codeEditorSpec.react.jsx index 4f1fcaf..ee3dbd5 100644 --- a/app/addons/components/tests/codeEditorSpec.react.jsx +++ b/app/addons/components/tests/codeEditorSpec.react.jsx @@ -96,5 +96,17 @@ define([ }); }); + describe('getEditor', function () { + beforeEach(function () { + codeEditorEl = TestUtils.renderIntoDocument( + <ReactComponents.CodeEditor defaultCode={code} />, + container + ); + }); + it('returns a reference to get access to the editor', function () { + assert.ok(codeEditorEl.getEditor()); + }); + }); + }); });
