utils.js 992 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals document */
  6. import testUtils from '../../tests/_utils/utils';
  7. describe( 'utils', () => {
  8. describe( 'createTestUIView', () => {
  9. describe( 'view instance', () => {
  10. it( 'comes with a view', () => {
  11. const view = testUtils.createTestUIView();
  12. expect( view.element ).to.equal( document.body );
  13. } );
  14. it( 'creates collections and regions', () => {
  15. const view = testUtils.createTestUIView( {
  16. foo: el => el.firstChild,
  17. bar: el => el.lastChild,
  18. } );
  19. expect( view.foo._parentElement ).to.equal( document.body.firstChild );
  20. expect( view.bar._parentElement ).to.equal( document.body.lastChild );
  21. } );
  22. it( 'is ready', () => {
  23. const view = testUtils.createTestUIView( {
  24. foo: el => el.firstChild,
  25. bar: el => el.lastChild,
  26. } );
  27. expect( view.ready ).to.be.true;
  28. } );
  29. } );
  30. } );
  31. } );