Commit bbf96ce6 authored by Peter Hegman's avatar Peter Hegman

Merge branch '292943-test-coverage' into 'master'

Extended tests coverage for SE instance

See merge request gitlab-org/gitlab!74907
parents 4c6abd99 b3394407
...@@ -73,9 +73,7 @@ export default class EditorInstance { ...@@ -73,9 +73,7 @@ export default class EditorInstance {
if (methodExtension) { if (methodExtension) {
const extension = extensionsStore.get(methodExtension); const extension = extensionsStore.get(methodExtension);
return (...args) => { return (...args) => extension.api[prop].call(seInstance, receiver, ...args);
return extension.api[prop].call(seInstance, ...args, receiver);
};
} }
return Reflect.get(seInstance[prop] ? seInstance : target, prop, receiver); return Reflect.get(seInstance[prop] ? seInstance : target, prop, receiver);
}, },
......
export class MyClassExtension { export class SEClassExtension {
// eslint-disable-next-line class-methods-use-this // eslint-disable-next-line class-methods-use-this
provides() { provides() {
return { return {
...@@ -8,7 +8,7 @@ export class MyClassExtension { ...@@ -8,7 +8,7 @@ export class MyClassExtension {
} }
} }
export function MyFnExtension() { export function SEFnExtension() {
return { return {
fnExtMethod: () => 'fn own method', fnExtMethod: () => 'fn own method',
provides: () => { provides: () => {
...@@ -19,7 +19,7 @@ export function MyFnExtension() { ...@@ -19,7 +19,7 @@ export function MyFnExtension() {
}; };
} }
export const MyConstExt = () => { export const SEConstExt = () => {
return { return {
provides: () => { provides: () => {
return { return {
...@@ -29,6 +29,33 @@ export const MyConstExt = () => { ...@@ -29,6 +29,33 @@ export const MyConstExt = () => {
}; };
}; };
export function SEWithSetupExt() {
return {
onSetup: (setupOptions = {}, instance) => {
if (setupOptions && !Array.isArray(setupOptions)) {
Object.entries(setupOptions).forEach(([key, value]) => {
Object.assign(instance, {
[key]: value,
});
});
}
},
provides: () => {
return {
returnInstanceAndProps: (instance, stringProp, objProp = {}) => {
return [stringProp, objProp, instance];
},
returnInstance: (instance) => {
return instance;
},
giveMeContext: () => {
return this;
},
};
},
};
}
export const conflictingExtensions = { export const conflictingExtensions = {
WithInstanceExt: () => { WithInstanceExt: () => {
return { return {
......
...@@ -22,15 +22,15 @@ describe('Editor Extension', () => { ...@@ -22,15 +22,15 @@ describe('Editor Extension', () => {
it.each` it.each`
definition | setupOptions | expectedName definition | setupOptions | expectedName
${helpers.MyClassExtension} | ${undefined} | ${'MyClassExtension'} ${helpers.SEClassExtension} | ${undefined} | ${'SEClassExtension'}
${helpers.MyClassExtension} | ${{}} | ${'MyClassExtension'} ${helpers.SEClassExtension} | ${{}} | ${'SEClassExtension'}
${helpers.MyClassExtension} | ${dummyObj} | ${'MyClassExtension'} ${helpers.SEClassExtension} | ${dummyObj} | ${'SEClassExtension'}
${helpers.MyFnExtension} | ${undefined} | ${'MyFnExtension'} ${helpers.SEFnExtension} | ${undefined} | ${'SEFnExtension'}
${helpers.MyFnExtension} | ${{}} | ${'MyFnExtension'} ${helpers.SEFnExtension} | ${{}} | ${'SEFnExtension'}
${helpers.MyFnExtension} | ${dummyObj} | ${'MyFnExtension'} ${helpers.SEFnExtension} | ${dummyObj} | ${'SEFnExtension'}
${helpers.MyConstExt} | ${undefined} | ${'MyConstExt'} ${helpers.SEConstExt} | ${undefined} | ${'SEConstExt'}
${helpers.MyConstExt} | ${{}} | ${'MyConstExt'} ${helpers.SEConstExt} | ${{}} | ${'SEConstExt'}
${helpers.MyConstExt} | ${dummyObj} | ${'MyConstExt'} ${helpers.SEConstExt} | ${dummyObj} | ${'SEConstExt'}
`( `(
'correctly creates extension for definition = $definition and setupOptions = $setupOptions', 'correctly creates extension for definition = $definition and setupOptions = $setupOptions',
({ definition, setupOptions, expectedName }) => { ({ definition, setupOptions, expectedName }) => {
...@@ -51,9 +51,9 @@ describe('Editor Extension', () => { ...@@ -51,9 +51,9 @@ describe('Editor Extension', () => {
describe('api', () => { describe('api', () => {
it.each` it.each`
definition | expectedKeys definition | expectedKeys
${helpers.MyClassExtension} | ${['shared', 'classExtMethod']} ${helpers.SEClassExtension} | ${['shared', 'classExtMethod']}
${helpers.MyFnExtension} | ${['fnExtMethod']} ${helpers.SEFnExtension} | ${['fnExtMethod']}
${helpers.MyConstExt} | ${['constExtMethod']} ${helpers.SEConstExt} | ${['constExtMethod']}
`('correctly returns API for $definition', ({ definition, expectedKeys }) => { `('correctly returns API for $definition', ({ definition, expectedKeys }) => {
const extension = new EditorExtension({ definition }); const extension = new EditorExtension({ definition });
const expectedApi = Object.fromEntries( const expectedApi = Object.fromEntries(
......
...@@ -6,23 +6,29 @@ import { ...@@ -6,23 +6,29 @@ import {
EDITOR_EXTENSION_NOT_REGISTERED_ERROR, EDITOR_EXTENSION_NOT_REGISTERED_ERROR,
EDITOR_EXTENSION_NOT_SPECIFIED_FOR_UNUSE_ERROR, EDITOR_EXTENSION_NOT_SPECIFIED_FOR_UNUSE_ERROR,
} from '~/editor/constants'; } from '~/editor/constants';
import Instance from '~/editor/source_editor_instance'; import SourceEditorInstance from '~/editor/source_editor_instance';
import { sprintf } from '~/locale'; import { sprintf } from '~/locale';
import { MyClassExtension, conflictingExtensions, MyFnExtension, MyConstExt } from './helpers'; import {
SEClassExtension,
conflictingExtensions,
SEFnExtension,
SEConstExt,
SEWithSetupExt,
} from './helpers';
describe('Source Editor Instance', () => { describe('Source Editor Instance', () => {
let seInstance; let seInstance;
const defSetupOptions = { foo: 'bar' }; const defSetupOptions = { foo: 'bar' };
const fullExtensionsArray = [ const fullExtensionsArray = [
{ definition: MyClassExtension }, { definition: SEClassExtension },
{ definition: MyFnExtension }, { definition: SEFnExtension },
{ definition: MyConstExt }, { definition: SEConstExt },
]; ];
const fullExtensionsArrayWithOptions = [ const fullExtensionsArrayWithOptions = [
{ definition: MyClassExtension, setupOptions: defSetupOptions }, { definition: SEClassExtension, setupOptions: defSetupOptions },
{ definition: MyFnExtension, setupOptions: defSetupOptions }, { definition: SEFnExtension, setupOptions: defSetupOptions },
{ definition: MyConstExt, setupOptions: defSetupOptions }, { definition: SEConstExt, setupOptions: defSetupOptions },
]; ];
const fooFn = jest.fn(); const fooFn = jest.fn();
...@@ -40,26 +46,26 @@ describe('Source Editor Instance', () => { ...@@ -40,26 +46,26 @@ describe('Source Editor Instance', () => {
}); });
it('sets up the registry for the methods coming from extensions', () => { it('sets up the registry for the methods coming from extensions', () => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
expect(seInstance.methods).toBeDefined(); expect(seInstance.methods).toBeDefined();
seInstance.use({ definition: MyClassExtension }); seInstance.use({ definition: SEClassExtension });
expect(seInstance.methods).toEqual({ expect(seInstance.methods).toEqual({
shared: 'MyClassExtension', shared: 'SEClassExtension',
classExtMethod: 'MyClassExtension', classExtMethod: 'SEClassExtension',
}); });
seInstance.use({ definition: MyFnExtension }); seInstance.use({ definition: SEFnExtension });
expect(seInstance.methods).toEqual({ expect(seInstance.methods).toEqual({
shared: 'MyClassExtension', shared: 'SEClassExtension',
classExtMethod: 'MyClassExtension', classExtMethod: 'SEClassExtension',
fnExtMethod: 'MyFnExtension', fnExtMethod: 'SEFnExtension',
}); });
}); });
describe('proxy', () => { describe('proxy', () => {
it('returns prop from an extension if extension provides it', () => { it('returns prop from an extension if extension provides it', () => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
seInstance.use({ definition: DummyExt }); seInstance.use({ definition: DummyExt });
expect(fooFn).not.toHaveBeenCalled(); expect(fooFn).not.toHaveBeenCalled();
...@@ -67,8 +73,58 @@ describe('Source Editor Instance', () => { ...@@ -67,8 +73,58 @@ describe('Source Editor Instance', () => {
expect(fooFn).toHaveBeenCalled(); expect(fooFn).toHaveBeenCalled();
}); });
it.each`
stringPropToPass | objPropToPass | setupOptions
${undefined} | ${undefined} | ${undefined}
${'prop'} | ${undefined} | ${undefined}
${'prop'} | ${[]} | ${undefined}
${'prop'} | ${{}} | ${undefined}
${'prop'} | ${{ alpha: 'beta' }} | ${undefined}
${'prop'} | ${{ alpha: 'beta' }} | ${defSetupOptions}
${'prop'} | ${undefined} | ${defSetupOptions}
${undefined} | ${undefined} | ${defSetupOptions}
${''} | ${{}} | ${defSetupOptions}
`(
'correctly passes arguments ("$stringPropToPass", "$objPropToPass") and instance (with "$setupOptions" setupOptions) to extension methods',
({ stringPropToPass, objPropToPass, setupOptions }) => {
seInstance = new SourceEditorInstance();
seInstance.use({ definition: SEWithSetupExt, setupOptions });
const [stringProp, objProp, instance] = seInstance.returnInstanceAndProps(
stringPropToPass,
objPropToPass,
);
const expectedObjProps = objPropToPass || {};
expect(instance).toBe(seInstance);
expect(stringProp).toBe(stringPropToPass);
expect(objProp).toEqual(expectedObjProps);
if (setupOptions) {
Object.keys(setupOptions).forEach((key) => {
expect(instance[key]).toBe(setupOptions[key]);
});
}
},
);
it('correctly passes instance to the methods even if no additional props have been passed', () => {
seInstance = new SourceEditorInstance();
seInstance.use({ definition: SEWithSetupExt });
const instance = seInstance.returnInstance();
expect(instance).toBe(seInstance);
});
it("correctly sets the context of the 'this' keyword for the extension's methods", () => {
seInstance = new SourceEditorInstance();
seInstance.use({ definition: SEWithSetupExt });
expect(seInstance.giveMeContext().constructor).toEqual(SEWithSetupExt);
});
it('returns props from SE instance itself if no extension provides the prop', () => { it('returns props from SE instance itself if no extension provides the prop', () => {
seInstance = new Instance({ seInstance = new SourceEditorInstance({
use: fooFn, use: fooFn,
}); });
jest.spyOn(seInstance, 'use').mockImplementation(() => {}); jest.spyOn(seInstance, 'use').mockImplementation(() => {});
...@@ -80,7 +136,7 @@ describe('Source Editor Instance', () => { ...@@ -80,7 +136,7 @@ describe('Source Editor Instance', () => {
}); });
it('returns props from Monaco instance when the prop does not exist on the SE instance', () => { it('returns props from Monaco instance when the prop does not exist on the SE instance', () => {
seInstance = new Instance({ seInstance = new SourceEditorInstance({
fooFn, fooFn,
}); });
...@@ -92,13 +148,13 @@ describe('Source Editor Instance', () => { ...@@ -92,13 +148,13 @@ describe('Source Editor Instance', () => {
describe('public API', () => { describe('public API', () => {
it.each(['use', 'unuse'], 'provides "%s" as public method by default', (method) => { it.each(['use', 'unuse'], 'provides "%s" as public method by default', (method) => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
expect(seInstance[method]).toBeDefined(); expect(seInstance[method]).toBeDefined();
}); });
describe('use', () => { describe('use', () => {
it('extends the SE instance with methods provided by an extension', () => { it('extends the SE instance with methods provided by an extension', () => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
seInstance.use({ definition: DummyExt }); seInstance.use({ definition: DummyExt });
expect(fooFn).not.toHaveBeenCalled(); expect(fooFn).not.toHaveBeenCalled();
...@@ -108,15 +164,15 @@ describe('Source Editor Instance', () => { ...@@ -108,15 +164,15 @@ describe('Source Editor Instance', () => {
it.each` it.each`
extensions | expectedProps extensions | expectedProps
${{ definition: MyClassExtension }} | ${['shared', 'classExtMethod']} ${{ definition: SEClassExtension }} | ${['shared', 'classExtMethod']}
${{ definition: MyFnExtension }} | ${['fnExtMethod']} ${{ definition: SEFnExtension }} | ${['fnExtMethod']}
${{ definition: MyConstExt }} | ${['constExtMethod']} ${{ definition: SEConstExt }} | ${['constExtMethod']}
${fullExtensionsArray} | ${['shared', 'classExtMethod', 'fnExtMethod', 'constExtMethod']} ${fullExtensionsArray} | ${['shared', 'classExtMethod', 'fnExtMethod', 'constExtMethod']}
${fullExtensionsArrayWithOptions} | ${['shared', 'classExtMethod', 'fnExtMethod', 'constExtMethod']} ${fullExtensionsArrayWithOptions} | ${['shared', 'classExtMethod', 'fnExtMethod', 'constExtMethod']}
`( `(
'Should register $expectedProps when extension is "$extensions"', 'Should register $expectedProps when extension is "$extensions"',
({ extensions, expectedProps }) => { ({ extensions, expectedProps }) => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
expect(seInstance.extensionsAPI).toHaveLength(0); expect(seInstance.extensionsAPI).toHaveLength(0);
seInstance.use(extensions); seInstance.use(extensions);
...@@ -127,15 +183,15 @@ describe('Source Editor Instance', () => { ...@@ -127,15 +183,15 @@ describe('Source Editor Instance', () => {
it.each` it.each`
definition | preInstalledExtDefinition | expectedErrorProp definition | preInstalledExtDefinition | expectedErrorProp
${conflictingExtensions.WithInstanceExt} | ${MyClassExtension} | ${'use'} ${conflictingExtensions.WithInstanceExt} | ${SEClassExtension} | ${'use'}
${conflictingExtensions.WithInstanceExt} | ${null} | ${'use'} ${conflictingExtensions.WithInstanceExt} | ${null} | ${'use'}
${conflictingExtensions.WithAnotherExt} | ${null} | ${undefined} ${conflictingExtensions.WithAnotherExt} | ${null} | ${undefined}
${conflictingExtensions.WithAnotherExt} | ${MyClassExtension} | ${'shared'} ${conflictingExtensions.WithAnotherExt} | ${SEClassExtension} | ${'shared'}
${MyClassExtension} | ${conflictingExtensions.WithAnotherExt} | ${'shared'} ${SEClassExtension} | ${conflictingExtensions.WithAnotherExt} | ${'shared'}
`( `(
'logs the naming conflict error when registering $definition', 'logs the naming conflict error when registering $definition',
({ definition, preInstalledExtDefinition, expectedErrorProp }) => { ({ definition, preInstalledExtDefinition, expectedErrorProp }) => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
jest.spyOn(console, 'error').mockImplementation(() => {}); jest.spyOn(console, 'error').mockImplementation(() => {});
if (preInstalledExtDefinition) { if (preInstalledExtDefinition) {
...@@ -175,7 +231,7 @@ describe('Source Editor Instance', () => { ...@@ -175,7 +231,7 @@ describe('Source Editor Instance', () => {
`( `(
'Should throw $thrownError when extension is "$extensions"', 'Should throw $thrownError when extension is "$extensions"',
({ extensions, thrownError }) => { ({ extensions, thrownError }) => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
const useExtension = () => { const useExtension = () => {
seInstance.use(extensions); seInstance.use(extensions);
}; };
...@@ -188,24 +244,24 @@ describe('Source Editor Instance', () => { ...@@ -188,24 +244,24 @@ describe('Source Editor Instance', () => {
beforeEach(() => { beforeEach(() => {
extensionStore = new Map(); extensionStore = new Map();
seInstance = new Instance({}, extensionStore); seInstance = new SourceEditorInstance({}, extensionStore);
}); });
it('stores _instances_ of the used extensions in a global registry', () => { it('stores _instances_ of the used extensions in a global registry', () => {
const extension = seInstance.use({ definition: MyClassExtension }); const extension = seInstance.use({ definition: SEClassExtension });
expect(extensionStore.size).toBe(1); expect(extensionStore.size).toBe(1);
expect(extensionStore.entries().next().value).toEqual(['MyClassExtension', extension]); expect(extensionStore.entries().next().value).toEqual(['SEClassExtension', extension]);
}); });
it('does not duplicate entries in the registry', () => { it('does not duplicate entries in the registry', () => {
jest.spyOn(extensionStore, 'set'); jest.spyOn(extensionStore, 'set');
const extension1 = seInstance.use({ definition: MyClassExtension }); const extension1 = seInstance.use({ definition: SEClassExtension });
seInstance.use({ definition: MyClassExtension }); seInstance.use({ definition: SEClassExtension });
expect(extensionStore.set).toHaveBeenCalledTimes(1); expect(extensionStore.set).toHaveBeenCalledTimes(1);
expect(extensionStore.set).toHaveBeenCalledWith('MyClassExtension', extension1); expect(extensionStore.set).toHaveBeenCalledWith('SEClassExtension', extension1);
}); });
it.each` it.each`
...@@ -222,20 +278,20 @@ describe('Source Editor Instance', () => { ...@@ -222,20 +278,20 @@ describe('Source Editor Instance', () => {
jest.spyOn(extensionStore, 'set'); jest.spyOn(extensionStore, 'set');
const extension1 = seInstance.use({ const extension1 = seInstance.use({
definition: MyClassExtension, definition: SEClassExtension,
setupOptions: currentSetupOptions, setupOptions: currentSetupOptions,
}); });
const extension2 = seInstance.use({ const extension2 = seInstance.use({
definition: MyClassExtension, definition: SEClassExtension,
setupOptions: newSetupOptions, setupOptions: newSetupOptions,
}); });
expect(extensionStore.size).toBe(1); expect(extensionStore.size).toBe(1);
expect(extensionStore.set).toHaveBeenCalledTimes(expectedCallTimes); expect(extensionStore.set).toHaveBeenCalledTimes(expectedCallTimes);
if (expectedCallTimes > 1) { if (expectedCallTimes > 1) {
expect(extensionStore.set).toHaveBeenCalledWith('MyClassExtension', extension2); expect(extensionStore.set).toHaveBeenCalledWith('SEClassExtension', extension2);
} else { } else {
expect(extensionStore.set).toHaveBeenCalledWith('MyClassExtension', extension1); expect(extensionStore.set).toHaveBeenCalledWith('SEClassExtension', extension1);
} }
}, },
); );
...@@ -252,7 +308,7 @@ describe('Source Editor Instance', () => { ...@@ -252,7 +308,7 @@ describe('Source Editor Instance', () => {
`( `(
`Should throw "${EDITOR_EXTENSION_NOT_SPECIFIED_FOR_UNUSE_ERROR}" when extension is "$unuseExtension"`, `Should throw "${EDITOR_EXTENSION_NOT_SPECIFIED_FOR_UNUSE_ERROR}" when extension is "$unuseExtension"`,
({ unuseExtension, thrownError }) => { ({ unuseExtension, thrownError }) => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
const unuse = () => { const unuse = () => {
seInstance.unuse(unuseExtension); seInstance.unuse(unuseExtension);
}; };
...@@ -262,16 +318,16 @@ describe('Source Editor Instance', () => { ...@@ -262,16 +318,16 @@ describe('Source Editor Instance', () => {
it.each` it.each`
initExtensions | unuseExtensionIndex | remainingAPI initExtensions | unuseExtensionIndex | remainingAPI
${{ definition: MyClassExtension }} | ${0} | ${[]} ${{ definition: SEClassExtension }} | ${0} | ${[]}
${{ definition: MyFnExtension }} | ${0} | ${[]} ${{ definition: SEFnExtension }} | ${0} | ${[]}
${{ definition: MyConstExt }} | ${0} | ${[]} ${{ definition: SEConstExt }} | ${0} | ${[]}
${fullExtensionsArray} | ${0} | ${['fnExtMethod', 'constExtMethod']} ${fullExtensionsArray} | ${0} | ${['fnExtMethod', 'constExtMethod']}
${fullExtensionsArray} | ${1} | ${['shared', 'classExtMethod', 'constExtMethod']} ${fullExtensionsArray} | ${1} | ${['shared', 'classExtMethod', 'constExtMethod']}
${fullExtensionsArray} | ${2} | ${['shared', 'classExtMethod', 'fnExtMethod']} ${fullExtensionsArray} | ${2} | ${['shared', 'classExtMethod', 'fnExtMethod']}
`( `(
'un-registers properties introduced by single extension $unuseExtension', 'un-registers properties introduced by single extension $unuseExtension',
({ initExtensions, unuseExtensionIndex, remainingAPI }) => { ({ initExtensions, unuseExtensionIndex, remainingAPI }) => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
const extensions = seInstance.use(initExtensions); const extensions = seInstance.use(initExtensions);
if (Array.isArray(initExtensions)) { if (Array.isArray(initExtensions)) {
...@@ -291,7 +347,7 @@ describe('Source Editor Instance', () => { ...@@ -291,7 +347,7 @@ describe('Source Editor Instance', () => {
`( `(
'un-registers properties introduced by multiple extensions $unuseExtension', 'un-registers properties introduced by multiple extensions $unuseExtension',
({ unuseExtensionIndex, remainingAPI }) => { ({ unuseExtensionIndex, remainingAPI }) => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
const extensions = seInstance.use(fullExtensionsArray); const extensions = seInstance.use(fullExtensionsArray);
const extensionsToUnuse = extensions.filter((ext, index) => const extensionsToUnuse = extensions.filter((ext, index) =>
unuseExtensionIndex.includes(index), unuseExtensionIndex.includes(index),
...@@ -304,11 +360,11 @@ describe('Source Editor Instance', () => { ...@@ -304,11 +360,11 @@ describe('Source Editor Instance', () => {
it('it does not remove entry from the global registry to keep for potential future re-use', () => { it('it does not remove entry from the global registry to keep for potential future re-use', () => {
const extensionStore = new Map(); const extensionStore = new Map();
seInstance = new Instance({}, extensionStore); seInstance = new SourceEditorInstance({}, extensionStore);
const extensions = seInstance.use(fullExtensionsArray); const extensions = seInstance.use(fullExtensionsArray);
const verifyExpectations = () => { const verifyExpectations = () => {
const entries = extensionStore.entries(); const entries = extensionStore.entries();
const mockExtensions = ['MyClassExtension', 'MyFnExtension', 'MyConstExt']; const mockExtensions = ['SEClassExtension', 'SEFnExtension', 'SEConstExt'];
expect(extensionStore.size).toBe(mockExtensions.length); expect(extensionStore.size).toBe(mockExtensions.length);
mockExtensions.forEach((ext, index) => { mockExtensions.forEach((ext, index) => {
expect(entries.next().value).toEqual([ext, extensions[index]]); expect(entries.next().value).toEqual([ext, extensions[index]]);
...@@ -326,7 +382,7 @@ describe('Source Editor Instance', () => { ...@@ -326,7 +382,7 @@ describe('Source Editor Instance', () => {
beforeEach(() => { beforeEach(() => {
instanceModel = monacoEditor.createModel(''); instanceModel = monacoEditor.createModel('');
seInstance = new Instance({ seInstance = new SourceEditorInstance({
getModel: () => instanceModel, getModel: () => instanceModel,
}); });
}); });
...@@ -363,7 +419,7 @@ describe('Source Editor Instance', () => { ...@@ -363,7 +419,7 @@ describe('Source Editor Instance', () => {
}; };
it('passes correct arguments to callback fns when using an extension', () => { it('passes correct arguments to callback fns when using an extension', () => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
seInstance.use({ seInstance.use({
definition: MyFullExtWithCallbacks, definition: MyFullExtWithCallbacks,
setupOptions: defSetupOptions, setupOptions: defSetupOptions,
...@@ -373,7 +429,7 @@ describe('Source Editor Instance', () => { ...@@ -373,7 +429,7 @@ describe('Source Editor Instance', () => {
}); });
it('passes correct arguments to callback fns when un-using an extension', () => { it('passes correct arguments to callback fns when un-using an extension', () => {
seInstance = new Instance(); seInstance = new SourceEditorInstance();
const extension = seInstance.use({ const extension = seInstance.use({
definition: MyFullExtWithCallbacks, definition: MyFullExtWithCallbacks,
setupOptions: defSetupOptions, setupOptions: defSetupOptions,
......
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