import { describe, expect, it, beforeEach, afterEach } from 'vitest'; import { ClassicEditor, Essentials, Paragraph, Heading } from 'ckeditor5'; import <%= formattedNames.plugin.pascalCase %> from '../src/<%= formattedNames.plugin.lowerCaseMerged %>.js'; describe( '<%= formattedNames.plugin.pascalCase %>', () => { it( 'should be named', () => { expect( <%= formattedNames.plugin.pascalCase %>.pluginName ).to.equal( '<%= formattedNames.plugin.pascalCase %>' ); } ); describe( 'init()', () => { let domElement, editor; beforeEach( async () => { domElement = document.createElement( 'div' ); document.body.appendChild( domElement ); editor = await ClassicEditor.create( { attachTo: domElement, licenseKey: 'GPL', plugins: [ Paragraph, Heading, Essentials, <%= formattedNames.plugin.pascalCase %> ], toolbar: [ '<%= formattedNames.plugin.camelCase %>' ] } ); } ); afterEach( () => { domElement.remove(); return editor.destroy(); } ); it( 'should load <%= formattedNames.plugin.pascalCase %>', () => { const myPlugin = editor.plugins.get( '<%= formattedNames.plugin.pascalCase %>' ); expect( myPlugin ).to.be.an.instanceof( <%= formattedNames.plugin.pascalCase %> ); } ); it( 'should add an icon to the toolbar', () => { expect( editor.ui.componentFactory.has( '<%= formattedNames.plugin.camelCase %>' ) ).to.equal( true ); } ); it( 'should add a text into the editor after clicking the icon', () => { const icon = editor.ui.componentFactory.create( '<%= formattedNames.plugin.camelCase %>' ); expect( editor.getData() ).to.equal( '' ); icon.fire( 'execute' ); expect( editor.getData() ).to.equal( '
Hello CKEditor 5!
' ); } ); } ); } );