Migrate tests to Typescript

This commit is contained in:
Federico
2024-03-20 20:55:51 -03:00
committed by Tony Narlock
parent ac60fc7a76
commit 3e1008ee96
8 changed files with 150 additions and 66 deletions

55
tests/math.ts Normal file
View File

@@ -0,0 +1,55 @@
import ClassicEditor from '@ckeditor/ckeditor5-editor-classic/src/classiceditor';
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';
import { expect } from 'chai';
describe( 'Math', () => {
let editorElement: HTMLDivElement, editor: ClassicEditor;
beforeEach( async () => {
editorElement = global.document.createElement( 'div' );
global.document.body.appendChild( editorElement );
return ClassicEditor
.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' );
} );
} );