integration.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. /* global document */
  6. import Highlight from '@ckeditor/ckeditor5-highlight/src/highlight';
  7. import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
  8. import FontSize from '../../src/fontsize';
  9. import ClassicTestEditor from '@ckeditor/ckeditor5-core/tests/_utils/classictesteditor';
  10. import { setData as setModelData } from '@ckeditor/ckeditor5-engine/src/dev-utils/model';
  11. import { getData as getViewData } from '@ckeditor/ckeditor5-engine/src/dev-utils/view';
  12. describe( 'FontSize - integration', () => {
  13. let editor, model, element;
  14. beforeEach( () => {
  15. element = document.createElement( 'div' );
  16. document.body.appendChild( element );
  17. return ClassicTestEditor
  18. .create( element, {
  19. plugins: [ Highlight, Paragraph, FontSize ]
  20. } )
  21. .then( newEditor => {
  22. editor = newEditor;
  23. model = editor.model;
  24. } );
  25. } );
  26. afterEach( () => {
  27. element.remove();
  28. return editor.destroy();
  29. } );
  30. describe( 'compatibility with highlight', () => {
  31. it( 'the view "span" element should outer wrap the text', () => {
  32. setModelData( model, '<paragraph>Foo [Bar] Baz.</paragraph>' );
  33. editor.execute( 'highlight', { value: 'yellowMarker' } );
  34. expect( getViewData( editor.editing.view ) ).to.equal(
  35. '<p>Foo {<mark class="marker-yellow">Bar</mark>} Baz.</p>'
  36. );
  37. editor.execute( 'fontSize', { value: 'huge' } );
  38. expect( getViewData( editor.editing.view ) ).to.equal(
  39. '<p>Foo {<span class="text-huge"><mark class="marker-yellow">Bar</mark></span>} Baz.</p>'
  40. );
  41. } );
  42. } );
  43. } );