8
0

classiceditoruiview.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 ClassicEditorUIView from 'ckeditor5-editor-classic/src/classiceditoruiview';
  7. import StickyToolbarView from 'ckeditor5-ui/src/toolbar/sticky/stickytoolbarview';
  8. import InlineEditableUIView from 'ckeditor5-ui/src/editableui/inline/inlineeditableuiview';
  9. import Locale from 'ckeditor5-utils/src/locale';
  10. describe( 'ClassicEditorUIView', () => {
  11. let locale, view;
  12. beforeEach( () => {
  13. locale = new Locale( 'en' );
  14. view = new ClassicEditorUIView( locale );
  15. } );
  16. describe( 'constructor()', () => {
  17. describe( '#toolbar', () => {
  18. it( 'is created', () => {
  19. expect( view.toolbar ).to.be.instanceof( StickyToolbarView );
  20. } );
  21. it( 'is given a locate object', () => {
  22. expect( view.toolbar.locale ).to.equal( locale );
  23. } );
  24. it( 'is put into the "top" collection', () => {
  25. expect( view.top.get( 0 ) ).to.equal( view.toolbar );
  26. } );
  27. } );
  28. describe( '#editable', () => {
  29. it( 'is created', () => {
  30. expect( view.editable ).to.be.instanceof( InlineEditableUIView );
  31. } );
  32. it( 'is given a locate object', () => {
  33. expect( view.editable.locale ).to.equal( locale );
  34. } );
  35. it( 'is put into the "main" collection', () => {
  36. expect( view.main.get( 0 ) ).to.equal( view.editable );
  37. } );
  38. } );
  39. } );
  40. describe( 'editableElement', () => {
  41. it( 'returns editable\'s view element', () => {
  42. document.body.appendChild( view.element );
  43. return view.init()
  44. .then( () => {
  45. expect( view.editableElement.getAttribute( 'contentEditable' ) ).to.equal( 'true' );
  46. } )
  47. .then( () => view.destroy() );
  48. } );
  49. } );
  50. } );