8
0

classiceditoruiview.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. /* globals document */
  6. /* bender-tags: editor, browser-only */
  7. import ClassicEditorUIView from 'ckeditor5/editor-classic/classiceditoruiview.js';
  8. import StickyToolbarView from 'ckeditor5/ui/toolbar/sticky/stickytoolbarview.js';
  9. import InlineEditableUIView from 'ckeditor5/ui/editableui/inline/inlineeditableuiview.js';
  10. import Locale from 'ckeditor5/utils/locale.js';
  11. describe( 'ClassicEditorUIView', () => {
  12. let locale, view;
  13. beforeEach( () => {
  14. locale = new Locale( 'en' );
  15. view = new ClassicEditorUIView( locale );
  16. } );
  17. describe( 'constructor()', () => {
  18. describe( '#toolbar', () => {
  19. it( 'is created', () => {
  20. expect( view.toolbar ).to.be.instanceof( StickyToolbarView );
  21. } );
  22. it( 'is given a locate object', () => {
  23. expect( view.toolbar.locale ).to.equal( locale );
  24. } );
  25. it( 'is put into the "top" collection', () => {
  26. expect( view.top.get( 0 ) ).to.equal( view.toolbar );
  27. } );
  28. } );
  29. describe( '#editable', () => {
  30. it( 'is created', () => {
  31. expect( view.editable ).to.be.instanceof( InlineEditableUIView );
  32. } );
  33. it( 'is given a locate object', () => {
  34. expect( view.editable.locale ).to.equal( locale );
  35. } );
  36. it( 'is put into the "main" collection', () => {
  37. expect( view.main.get( 0 ) ).to.equal( view.editable );
  38. } );
  39. } );
  40. } );
  41. describe( 'editableElement', () => {
  42. it( 'returns editable\'s view element', () => {
  43. document.body.appendChild( view.element );
  44. return view.init()
  45. .then( () => {
  46. expect( view.editableElement.getAttribute( 'contentEditable' ) ).to.equal( 'true' );
  47. } )
  48. .then( () => view.destroy() );
  49. } );
  50. } );
  51. } );