47 lines
1.0 KiB
TypeScript
Raw Permalink Normal View History

import { ClassicEditor, Essentials, Paragraph, Heading, _setModelData as setModelData } from 'ckeditor5';
2022-03-04 13:39:39 +01:00
2024-06-07 15:46:40 +02:00
import Mermaid from '../src/mermaid.js';
2025-05-10 02:23:22 +03:00
import { afterEach, beforeEach, describe, it } from 'vitest';
import { expect } from 'vitest';
2022-03-04 13:39:39 +01:00
/* 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, {
licenseKey: "GPL",
2022-03-04 13:39:39 +01:00
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 );
} );
} );
} );