editorui.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /**
  2. * @license Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import testUtils from '/tests/core/_utils/utils.js';
  6. import Editor from '/ckeditor5/core/editor/editor.js';
  7. import EditorUI from '/ckeditor5/ui/editorui/editorui.js';
  8. import ComponentFactory from '/ckeditor5/ui/componentfactory.js';
  9. import ControllerCollection from '/ckeditor5/ui/controllercollection.js';
  10. testUtils.createSinonSandbox();
  11. describe( 'EditorUI', () => {
  12. let editor, editorUI;
  13. beforeEach( () => {
  14. editor = new Editor();
  15. editorUI = new EditorUI( editor );
  16. } );
  17. describe( 'constructor', () => {
  18. it( 'sets all the properties', () => {
  19. expect( editorUI ).to.have.property( 'editor', editor );
  20. expect( editorUI.featureComponents ).to.be.instanceof( ComponentFactory );
  21. expect( editorUI.collections.get( 'body' ) ).to.be.instanceof( ControllerCollection );
  22. } );
  23. } );
  24. describe( 'init', () => {
  25. it( 'calls _setupIconManager when "icon" in model', () => {
  26. const spy = testUtils.sinon.spy( editorUI, '_setupIconManager' );
  27. return editorUI.init()
  28. .then( () => {
  29. expect( spy.calledOnce ).to.be.true;
  30. } );
  31. } );
  32. } );
  33. describe( '_setupIconManager', () => {
  34. it( 'sets "icon" property', () => {
  35. editorUI._setupIconManager();
  36. expect( editorUI.icons ).to.be.an( 'array' );
  37. expect( editorUI.icons ).to.not.be.empty;
  38. } );
  39. } );
  40. } );