cleanup.js 840 B

123456789101112131415161718192021222324252627
  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. /* globals document */
  6. import Locale from '@ckeditor/ckeditor5-utils/src/locale';
  7. import EditorUIView from '@ckeditor/ckeditor5-ui/src/editorui/editoruiview';
  8. import { removeEditorBodyOrphans } from '../_utils/cleanup';
  9. describe( 'cleanup util', () => {
  10. describe( 'removeEditorBodyOrphans()', () => {
  11. const locale = new Locale();
  12. const uiViews = [ new EditorUIView( locale ), new EditorUIView( locale ) ];
  13. for ( const view of uiViews ) {
  14. view.render();
  15. }
  16. expect( document.querySelectorAll( '.ck-body' ) ).to.have.length( 2 );
  17. removeEditorBodyOrphans();
  18. expect( document.querySelectorAll( '.ck-body' ) ).to.have.length( 0 );
  19. } );
  20. } );