balloontoolbareditoruiview.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import BalloonToolbarEditorUIView from '../src/balloontoolbareditoruiview';
  6. import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview';
  7. import Locale from '@ckeditor/ckeditor5-utils/src/locale';
  8. describe( 'BalloonToolbarEditorUIView', () => {
  9. let locale, view;
  10. beforeEach( () => {
  11. locale = new Locale( 'en' );
  12. view = new BalloonToolbarEditorUIView( locale );
  13. } );
  14. describe( 'constructor()', () => {
  15. describe( '#editable', () => {
  16. it( 'is created', () => {
  17. expect( view.editable ).to.be.instanceof( InlineEditableUIView );
  18. } );
  19. it( 'is given a locate object', () => {
  20. expect( view.editable.locale ).to.equal( locale );
  21. } );
  22. it( 'is registered as a child', () => {
  23. const spy = sinon.spy( view.editable, 'destroy' );
  24. return view.init()
  25. .then( () => view.destroy() )
  26. .then( () => {
  27. sinon.assert.calledOnce( spy );
  28. } );
  29. } );
  30. } );
  31. } );
  32. describe( 'editableElement', () => {
  33. it( 'returns editable\'s view element', () => {
  34. return view.init()
  35. .then( () => {
  36. expect( view.editableElement.getAttribute( 'contentEditable' ) ).to.equal( 'true' );
  37. } )
  38. .then( () => view.destroy() );
  39. } );
  40. } );
  41. } );