spacing.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * @license Copyright (c) 2003-2018, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import VirtualTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/virtualtesteditor';
  6. import Clipboard from '@ckeditor/ckeditor5-clipboard/src/clipboard';
  7. import PasteFromOffice from '../../../src/pastefromoffice';
  8. import { expectNormalized } from '../../_utils/utils';
  9. import { getFixtures } from '../../_utils/fixtures';
  10. describe( 'Spacing – normalization', () => {
  11. let editor, input, normalized, pasteFromOfficePlugin;
  12. before( () => {
  13. ( { input, normalized } = getFixtures( 'spacing' ) );
  14. } );
  15. beforeEach( () => {
  16. return VirtualTestEditor
  17. .create( {
  18. plugins: [ Clipboard, PasteFromOffice ]
  19. } )
  20. .then( newEditor => {
  21. editor = newEditor;
  22. pasteFromOfficePlugin = editor.plugins.get( 'PasteFromOffice' );
  23. } );
  24. } );
  25. it( 'normalizes simple single spacing', () => {
  26. expectNormalized( pasteFromOfficePlugin._normalizeWordInput( input.simple, editor ), normalized.simple );
  27. } );
  28. it( 'normalizes multiple spacing in a single line', () => {
  29. expectNormalized( pasteFromOfficePlugin._normalizeWordInput( input.singleLine, editor ), normalized.singleLine );
  30. } );
  31. it( 'normalizes multiple spacing in multiple lines', () => {
  32. expectNormalized( pasteFromOfficePlugin._normalizeWordInput( input.multiLine, editor ), normalized.multiLine );
  33. } );
  34. } );