diff --git a/example/index.js b/example/index.js
index d9cd5df7..fe6c9872 100644
--- a/example/index.js
+++ b/example/index.js
@@ -37,6 +37,7 @@ const themes = [
languages.forEach((lang) => {
require(`brace/mode/${lang}`)
+ require(`brace/snippets/${lang}`)
})
themes.forEach((theme) => {
diff --git a/example/split.js b/example/split.js
index 796792bb..a71b80ce 100644
--- a/example/split.js
+++ b/example/split.js
@@ -39,6 +39,7 @@ const themes = [
languages.forEach((lang) => {
require(`brace/mode/${lang}`)
+ require(`brace/snippets/${lang}`)
})
themes.forEach((theme) => {
diff --git a/package.json b/package.json
index 88383c28..ea1eb6b7 100644
--- a/package.json
+++ b/package.json
@@ -55,7 +55,7 @@
"nyc": "^10.3.2",
"react-addons-test-utils": "^15.5.1",
"rimraf": "^2.5.2",
- "sinon": "^2.2.0",
+ "sinon": "^2.3.2",
"webpack": "^2.5.1",
"webpack-dev-server": "^2.4.5"
},
@@ -103,4 +103,4 @@
"url": "https://opencollective.com/react-ace",
"logo": "https://opencollective.com/opencollective/logo.txt"
}
-}
\ No newline at end of file
+}
diff --git a/src/ace.jsx b/src/ace.jsx
index 19631ea2..a1789159 100644
--- a/src/ace.jsx
+++ b/src/ace.jsx
@@ -74,6 +74,8 @@ export default class ReactAce extends Component {
const option = editorOptions[i];
if (availableOptions.hasOwnProperty(option)) {
this.editor.setOption(option, this.props[option]);
+ } else if (this.props[option]) {
+ console.warn(`ReaceAce: editor option ${option} was activated but not found. Did you need to import a related tool or did you possibly mispell the option?`)
}
}
diff --git a/src/split.jsx b/src/split.jsx
index c7f2ae7a..4da872cb 100644
--- a/src/split.jsx
+++ b/src/split.jsx
@@ -91,6 +91,8 @@ export default class SplitComponent extends Component {
const option = editorOptions[i];
if (availableOptions.hasOwnProperty(option)) {
editor.setOption(option, this.props[option]);
+ } else if (this.props[option]) {
+ console.warn(`ReaceAce: editor option ${option} was activated but not found. Did you need to import a related tool or did you possibly mispell the option?`)
}
}
this.handleOptions(this.props, editor);
diff --git a/tests/src/ace.spec.js b/tests/src/ace.spec.js
index e6f60daa..29263bcb 100644
--- a/tests/src/ace.spec.js
+++ b/tests/src/ace.spec.js
@@ -5,7 +5,6 @@ import ace from 'brace';
import { mount } from 'enzyme';
import AceEditor from '../../src/ace.jsx';
import brace from 'brace'; // eslint-disable-line no-unused-vars
-
describe('Ace Component', () => {
// Required for the document.getElementById used by Ace can work in the test environment
@@ -21,6 +20,14 @@ describe('Ace Component', () => {
expect(wrapper).to.exist;
});
+ it('should trigger console warn if editorOption is called', () => {
+ const stub = sinon.stub(console, 'warn');
+ const wrapper = mount(, mountOptions);
+ expect(wrapper).to.exist;
+ expect(console.warn.calledWith('ReaceAce: editor option enableBasicAutocompletion was activated but not found. Did you need to import a related tool or did you possibly mispell the option?') ).to.be.true;
+ stub.restore();
+ });
+
it('should render without problems with defaults properties, defaultValue and keyboardHandler', () => {
const wrapper = mount( {
expect(onFocusCallback.callCount).to.equal(1);
});
+
});
});
diff --git a/tests/src/split.spec.js b/tests/src/split.spec.js
index 4a47e5fc..19203f06 100644
--- a/tests/src/split.spec.js
+++ b/tests/src/split.spec.js
@@ -15,7 +15,7 @@ describe('Split Component', () => {
};
describe('General', () => {
-
+ sinon.restore()
it('should render without problems with defaults properties', () => {
const wrapper = mount(, mountOptions);
expect(wrapper).to.exist;
@@ -28,6 +28,14 @@ describe('Split Component', () => {
expect(beforeLoadCallback.getCall(0).args[0]).to.deep.equal(ace);
});
+ it('should trigger console warn if editorOption is called', () => {
+ const stub = sinon.stub(console, 'warn');
+ const wrapper = mount(, mountOptions);
+ expect(wrapper).to.exist;
+ expect(console.warn.calledWith('ReaceAce: editor option enableBasicAutocompletion was activated but not found. Did you need to import a related tool or did you possibly mispell the option?') ).to.be.true;
+ stub.restore();
+ });
+
it('should set the editor props to the Ace element', () => {
const editorProperties = {
react: 'setFromReact',