8
0

40.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import HeadingEngine from 'ckeditor5-heading/src/headingengine';
  6. import VirtualTestEditor from 'ckeditor5-core/tests/_utils/virtualtesteditor';
  7. import Enter from 'ckeditor5-enter/src/enter';
  8. import { getData, setData } from 'ckeditor5-engine/src/dev-utils/model';
  9. describe( 'Bug ckeditor5-heading#40', () => {
  10. let editor;
  11. afterEach( () => {
  12. return editor.destroy();
  13. } );
  14. it( 'enter at the end of a heading creates a paragraph, when heading was loaded before enter', () => {
  15. return VirtualTestEditor.create( {
  16. plugins: [ HeadingEngine, Enter ]
  17. } )
  18. .then( newEditor => {
  19. editor = newEditor;
  20. setData( editor.document, '<heading1>foo[]</heading1>' );
  21. editor.execute( 'enter' );
  22. expect( getData( editor.document ) ).to.equal( '<heading1>foo</heading1><paragraph>[]</paragraph>' );
  23. } );
  24. } );
  25. it( 'enter at the end of a heading creates a paragraph, when enter was loaded before heading', () => {
  26. return VirtualTestEditor.create( {
  27. plugins: [ Enter, HeadingEngine ]
  28. } )
  29. .then( newEditor => {
  30. editor = newEditor;
  31. setData( editor.document, '<heading1>foo[]</heading1>' );
  32. editor.execute( 'enter' );
  33. expect( getData( editor.document ) ).to.equal( '<heading1>foo</heading1><paragraph>[]</paragraph>' );
  34. } );
  35. } );
  36. } );