56 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-02-06 19:35:50 +01:00
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
2019-10-09 13:38:30 +03:00
import Mathematics from '../src/math';
import MathEditing from '../src/mathediting';
import MathUI from '../src/mathui';
import AutoMath from '../src/automath';
import Widget from '@ckeditor/ckeditor5-widget/src/widget';
import global from '@ckeditor/ckeditor5-utils/src/dom/global';
2024-03-20 20:55:51 -03:00
import { expect } from 'chai';
2019-10-09 13:38:30 +03:00
describe( 'Math', () => {
2024-03-20 20:55:51 -03:00
let editorElement: HTMLDivElement, editor: ClassicEditor;
2019-10-09 13:38:30 +03:00
2024-03-20 20:55:51 -03:00
beforeEach( async () => {
2025-03-15 00:24:12 +02:00
editorElement = document.createElement( 'div' );
document.body.appendChild( editorElement );
2019-10-09 13:38:30 +03:00
2023-02-06 19:35:50 +01:00
return ClassicEditor
2019-10-09 13:38:30 +03:00
.create( editorElement, {
plugins: [ Mathematics ]
} )
.then( newEditor => {
editor = newEditor;
} );
} );
afterEach( () => {
editorElement.remove();
return editor.destroy();
} );
it( 'should be loaded', () => {
expect( editor.plugins.get( Mathematics ) ).to.instanceOf( Mathematics );
} );
it( 'should load MathEditing plugin', () => {
expect( editor.plugins.get( MathEditing ) ).to.instanceOf( MathEditing );
} );
it( 'should load Widget plugin', () => {
expect( editor.plugins.get( Widget ) ).to.instanceOf( Widget );
} );
it( 'should load MathUI plugin', () => {
expect( editor.plugins.get( MathUI ) ).to.instanceOf( MathUI );
} );
it( 'should load AutoMath plugin', () => {
expect( editor.plugins.get( AutoMath ) ).to.instanceOf( AutoMath );
} );
it( 'has proper name', () => {
expect( Mathematics.pluginName ).to.equal( 'Math' );
} );
} );