Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Tests: Added unit test for the removeEditorBodyOrphans util function.
Browse files Browse the repository at this point in the history
  • Loading branch information
mlewand committed Jan 7, 2020
1 parent 90b1aef commit 4e3c55e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/_utils-tests/cleanup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/* globals document */

import Locale from '@ckeditor/ckeditor5-utils/src/locale';
import EditorUIView from '@ckeditor/ckeditor5-ui/src/editorui/editoruiview';
import { removeEditorBodyOrphans } from '../_utils/cleanup';

describe( 'cleanup util', () => {
describe( 'removeEditorBodyOrphans()', () => {
const locale = new Locale();
const uiViews = [ new EditorUIView( locale ), new EditorUIView( locale ) ];

for ( const view of uiViews ) {
view.render();
}

expect( document.querySelectorAll( '.ck-body' ) ).to.have.length( 2 );

removeEditorBodyOrphans();

expect( document.querySelectorAll( '.ck-body' ) ).to.have.length( 0 );
} );
} );

0 comments on commit 4e3c55e

Please sign in to comment.