editorui.js 1.4 KB

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