mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			44 lines
		
	
	
		
			948 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			948 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
import { ClassicEditor, Essentials, Paragraph, Heading, _setModelData as setModelData } from 'ckeditor5';
 | 
						|
 | 
						|
import Mermaid from '../src/mermaid.js';
 | 
						|
 | 
						|
/* global document */
 | 
						|
 | 
						|
describe( 'Mermaid', () => {
 | 
						|
	it( 'should be named', () => {
 | 
						|
		expect( Mermaid.pluginName ).to.equal( 'Mermaid' );
 | 
						|
	} );
 | 
						|
 | 
						|
	describe( 'init()', () => {
 | 
						|
		let domElement, editor;
 | 
						|
 | 
						|
		beforeEach( async () => {
 | 
						|
			domElement = document.createElement( 'div' );
 | 
						|
			document.body.appendChild( domElement );
 | 
						|
 | 
						|
			editor = await ClassicEditor.create( domElement, {
 | 
						|
				plugins: [
 | 
						|
					Paragraph,
 | 
						|
					Heading,
 | 
						|
					Essentials,
 | 
						|
					Mermaid
 | 
						|
				],
 | 
						|
				toolbar: [
 | 
						|
					'mermaid'
 | 
						|
				]
 | 
						|
			} );
 | 
						|
 | 
						|
			setModelData( editor.model, '<paragraph>[]</paragraph>' );
 | 
						|
		} );
 | 
						|
 | 
						|
		afterEach( () => {
 | 
						|
			domElement.remove();
 | 
						|
			return editor.destroy();
 | 
						|
		} );
 | 
						|
 | 
						|
		it( 'should add an icon to the toolbar', () => {
 | 
						|
			expect( editor.ui.componentFactory.has( 'Mermaid' ) ).to.equal( true );
 | 
						|
		} );
 | 
						|
	} );
 | 
						|
} );
 |