Commit 7e78bc41 authored by Denys Mishunov's avatar Denys Mishunov

Renamed decorateInstance to convertMonacoToELInstance

As per review
parent 38f794b9
...@@ -134,7 +134,7 @@ export default class EditorLite { ...@@ -134,7 +134,7 @@ export default class EditorLite {
return diffModel; return diffModel;
} }
static decorateInstance = (inst) => { static convertMonacoToELInstance = (inst) => {
const decoratedInstance = inst; const decoratedInstance = inst;
decoratedInstance.updateModelLanguage = (path) => { decoratedInstance.updateModelLanguage = (path) => {
const lang = EditorLite.getModelLanguage(path); const lang = EditorLite.getModelLanguage(path);
...@@ -194,7 +194,7 @@ export default class EditorLite { ...@@ -194,7 +194,7 @@ export default class EditorLite {
let model; let model;
const createEditorFn = diff ? 'createDiffEditor' : 'create'; const createEditorFn = diff ? 'createDiffEditor' : 'create';
const instance = EditorLite.decorateInstance( const instance = EditorLite.convertMonacoToELInstance(
monacoEditor[createEditorFn].call(this, el, { monacoEditor[createEditorFn].call(this, el, {
...this.options, ...this.options,
...instanceOptions, ...instanceOptions,
......
...@@ -58,7 +58,7 @@ describe('Base editor', () => { ...@@ -58,7 +58,7 @@ describe('Base editor', () => {
modelSpy = jest.spyOn(monacoEditor, 'createModel').mockImplementation(() => res); modelSpy = jest.spyOn(monacoEditor, 'createModel').mockImplementation(() => res);
}; };
const mockDecorateInstance = (decorations) => { const mockDecorateInstance = (decorations) => {
jest.spyOn(EditorLite, 'decorateInstance').mockImplementation((inst) => { jest.spyOn(EditorLite, 'convertMonacoToELInstance').mockImplementation((inst) => {
return Object.assign(inst, decorations); return Object.assign(inst, decorations);
}); });
}; };
...@@ -82,7 +82,7 @@ describe('Base editor', () => { ...@@ -82,7 +82,7 @@ describe('Base editor', () => {
expect(modelSpy).not.toHaveBeenCalled(); expect(modelSpy).not.toHaveBeenCalled();
expect(instanceSpy).not.toHaveBeenCalled(); expect(instanceSpy).not.toHaveBeenCalled();
expect(EditorLite.decorateInstance).not.toHaveBeenCalled(); expect(EditorLite.convertMonacoToELInstance).not.toHaveBeenCalled();
}); });
it('creates model to be supplied to Monaco editor', () => { it('creates model to be supplied to Monaco editor', () => {
...@@ -592,7 +592,7 @@ describe('Base editor', () => { ...@@ -592,7 +592,7 @@ describe('Base editor', () => {
const useSpy = jest.fn().mockImplementation(() => { const useSpy = jest.fn().mockImplementation(() => {
calls.push('use'); calls.push('use');
}); });
jest.spyOn(EditorLite, 'decorateInstance').mockImplementation((inst) => { jest.spyOn(EditorLite, 'convertMonacoToELInstance').mockImplementation((inst) => {
const decoratedInstance = inst; const decoratedInstance = inst;
decoratedInstance.use = useSpy; decoratedInstance.use = useSpy;
return decoratedInstance; return decoratedInstance;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment