mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 11:56:01 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { ClassicEditor, Widget } from 'ckeditor5';
 | 
						|
import Mathematics from '../src/math.js';
 | 
						|
import MathEditing from '../src/mathediting.js';
 | 
						|
import MathUI from '../src/mathui.js';
 | 
						|
import AutoMath from '../src/automath.js';
 | 
						|
import { describe, beforeEach, it, afterEach, expect } from "vitest";
 | 
						|
 | 
						|
describe( 'Math', () => {
 | 
						|
	let editorElement: HTMLDivElement, editor: ClassicEditor;
 | 
						|
 | 
						|
	beforeEach( async () => {
 | 
						|
		editorElement = document.createElement( 'div' );
 | 
						|
		document.body.appendChild( editorElement );
 | 
						|
 | 
						|
		return ClassicEditor
 | 
						|
			.create( editorElement, {
 | 
						|
				plugins: [ Mathematics ],
 | 
						|
				licenseKey: "GPL"
 | 
						|
			} )
 | 
						|
			.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' );
 | 
						|
	} );
 | 
						|
} );
 |