8
0

basic-styles.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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( 'Basic Styles – normalization', () => {
  11. let editor, input, normalized, pasteFromOfficePlugin;
  12. before( () => {
  13. ( { input, normalized } = getFixtures( 'basic-styles' ) );
  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 bold within text', () => {
  26. expectNormalized(
  27. pasteFromOfficePlugin._normalizeWordInput( input.boldWithinText, editor ), normalized.boldWithinText );
  28. } );
  29. it( 'normalizes italic starting text', () => {
  30. expectNormalized(
  31. pasteFromOfficePlugin._normalizeWordInput( input.italicStartingText, editor ), normalized.italicStartingText );
  32. } );
  33. it( 'normalizes underlined text', () => {
  34. expectNormalized(
  35. pasteFromOfficePlugin._normalizeWordInput( input.underlinedText, editor ), normalized.underlinedText );
  36. } );
  37. it( 'normalizes strikethrough ending text', () => {
  38. expectNormalized(
  39. pasteFromOfficePlugin._normalizeWordInput( input.strikethroughEndingText, editor ), normalized.strikethroughEndingText );
  40. } );
  41. it( 'normalizes mulitple styles single line', () => {
  42. expectNormalized(
  43. pasteFromOfficePlugin._normalizeWordInput( input.multipleStylesSingleLine, editor ), normalized.multipleStylesSingleLine );
  44. } );
  45. it( 'normalizes mulitple styles multiline', () => {
  46. expectNormalized(
  47. pasteFromOfficePlugin._normalizeWordInput( input.multipleStylesMultiline, editor ), normalized.multipleStylesMultiline );
  48. } );
  49. } );