pastefromoffice.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. import PasteFromOffice from '../src/pastefromoffice';
  6. import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
  7. import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
  8. import ContentNormalizer from '../src/contentnormalizer';
  9. describe( 'PasteFromOffice', () => {
  10. let editor, pasteFromOffice;
  11. beforeEach( () => {
  12. return VirtualTestEditor.create( {
  13. plugins: [ PasteFromOffice ]
  14. } )
  15. .then( _editor => {
  16. editor = _editor;
  17. pasteFromOffice = editor.plugins.get( 'PasteFromOffice' );
  18. } );
  19. } );
  20. it( 'is Paste from Office', () => {
  21. expect( pasteFromOffice ).to.be.instanceOf( PasteFromOffice );
  22. } );
  23. it( 'should have static name', () => {
  24. expect( PasteFromOffice.pluginName ).to.equal( 'PasteFromOffice' );
  25. } );
  26. it( 'should load Clipboard plugin', () => {
  27. expect( editor.plugins.get( Clipboard ) ).to.be.instanceOf( Clipboard );
  28. } );
  29. describe( 'constructor()', () => {
  30. it( 'should initialize 2 normalizers', () => {
  31. expect( pasteFromOffice._normalizers ).to.be.a( 'set' );
  32. expect( pasteFromOffice._normalizers.size ).to.equal( 2 );
  33. pasteFromOffice._normalizers.forEach( value => {
  34. expect( value ).to.be.instanceOf( ContentNormalizer );
  35. } );
  36. } );
  37. } );
  38. } );