classiceditoruiview.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /**
  2. * @license Copyright (c) 2003-2019, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import ClassicEditorUIView from '../src/classiceditoruiview';
  6. import StickyPanelView from '@ckeditor/ckeditor5-ui/src/panel/sticky/stickypanelview';
  7. import ToolbarView from '@ckeditor/ckeditor5-ui/src/toolbar/toolbarview';
  8. import InlineEditableUIView from '@ckeditor/ckeditor5-ui/src/editableui/inline/inlineeditableuiview';
  9. import Locale from '@ckeditor/ckeditor5-utils/src/locale';
  10. import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
  11. describe( 'ClassicEditorUIView', () => {
  12. let locale, view;
  13. testUtils.createSinonSandbox();
  14. beforeEach( () => {
  15. locale = new Locale( 'en' );
  16. view = new ClassicEditorUIView( locale );
  17. view.render();
  18. } );
  19. afterEach( () => {
  20. view.destroy();
  21. } );
  22. describe( 'constructor()', () => {
  23. describe( '#stickyPanel', () => {
  24. it( 'is created', () => {
  25. expect( view.stickyPanel ).to.be.instanceof( StickyPanelView );
  26. } );
  27. it( 'is given a locate object', () => {
  28. expect( view.stickyPanel.locale ).to.equal( locale );
  29. } );
  30. it( 'is put into the "top" collection', () => {
  31. expect( view.top.get( 0 ) ).to.equal( view.stickyPanel );
  32. } );
  33. } );
  34. describe( '#toolbar', () => {
  35. it( 'is created', () => {
  36. expect( view.toolbar ).to.be.instanceof( ToolbarView );
  37. } );
  38. it( 'is given a locate object', () => {
  39. expect( view.toolbar.locale ).to.equal( locale );
  40. } );
  41. it( 'is put into the "stickyPanel.content" collection', () => {
  42. expect( view.stickyPanel.content.get( 0 ) ).to.equal( view.toolbar );
  43. } );
  44. } );
  45. describe( '#editable', () => {
  46. it( 'is created', () => {
  47. expect( view.editable ).to.be.instanceof( InlineEditableUIView );
  48. } );
  49. it( 'is given a locate object', () => {
  50. expect( view.editable.locale ).to.equal( locale );
  51. } );
  52. it( 'is put into the "main" collection', () => {
  53. expect( view.main.get( 0 ) ).to.equal( view.editable );
  54. } );
  55. } );
  56. } );
  57. } );