blockbuttonview.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /**
  2. * @license Copyright (c) 2003-2019, 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. describe( 'DOM binding', () => {
  19. it( 'should react on `view#top` change', () => {
  20. view.top = 0;
  21. expect( view.element.style.top ).to.equal( '0px' );
  22. view.top = 10;
  23. expect( view.element.style.top ).to.equal( '10px' );
  24. } );
  25. it( 'should react on `view#left` change', () => {
  26. view.left = 0;
  27. expect( view.element.style.left ).to.equal( '0px' );
  28. view.left = 10;
  29. expect( view.element.style.left ).to.equal( '10px' );
  30. } );
  31. } );
  32. } );