blockbuttonview.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. * @license Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
  4. */
  5. import BlockButtonView from '../../../src/toolbar/block/blockbuttonview';
  6. describe( 'BlockButtonView', () => {
  7. let view;
  8. beforeEach( () => {
  9. view = new BlockButtonView();
  10. view.render();
  11. } );
  12. it( 'should be not visible on init', () => {
  13. expect( view.isVisible ).to.be.false;
  14. } );
  15. it( 'should create element from template', () => {
  16. expect( view.element.classList.contains( 'ck-block-toolbar-button' ) ).to.be.true;
  17. } );
  18. it( 'should be initialized as toggleable button', () => {
  19. expect( view.isToggleable ).to.be.true;
  20. } );
  21. describe( 'DOM binding', () => {
  22. it( 'should react on `view#top` change', () => {
  23. view.top = 0;
  24. expect( view.element.style.top ).to.equal( '0px' );
  25. view.top = 10;
  26. expect( view.element.style.top ).to.equal( '10px' );
  27. } );
  28. it( 'should react on `view#left` change', () => {
  29. view.left = 0;
  30. expect( view.element.style.left ).to.equal( '0px' );
  31. view.left = 10;
  32. expect( view.element.style.left ).to.equal( '10px' );
  33. } );
  34. } );
  35. } );