injecttransitiondisabling.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 injectCSSTransitionDisabling from '../../src/bindings/injecttransitiondisabling';
  6. import View from '../../src/view';
  7. describe( 'injectCSSTransitionDisabling()', () => {
  8. let view;
  9. class TestView extends View {
  10. constructor( ...args ) {
  11. super( ...args );
  12. this.setTemplate( {
  13. tag: 'div'
  14. } );
  15. injectCSSTransitionDisabling( this );
  16. }
  17. }
  18. beforeEach( () => {
  19. view = new TestView();
  20. view.render();
  21. } );
  22. afterEach( () => {
  23. view.destroy();
  24. } );
  25. it( 'should create a protected observable property for class binding', () => {
  26. expect( view._isCSSTransitionsDisabled ).to.be.false;
  27. } );
  28. it( 'should not alter the CSS class of the view until blocking is enabled', () => {
  29. expect( view.element.classList ).to.be.empty;
  30. } );
  31. describe( 'disableCSSTransitions() method', () => {
  32. it( 'should belong to the view', () => {
  33. expect( view.disableCSSTransitions ).to.be.a( 'function' );
  34. } );
  35. it( 'should set the proper CSS class when called', () => {
  36. view.disableCSSTransitions();
  37. expect( view.element.classList.contains( 'ck-transitions-disabled' ) ).to.be.true;
  38. } );
  39. } );
  40. describe( 'enableCSSTransitions() method', () => {
  41. it( 'should belong to the view', () => {
  42. expect( view.enableCSSTransitions ).to.be.a( 'function' );
  43. } );
  44. it( 'should remove the proper CSS class when called', () => {
  45. view.disableCSSTransitions();
  46. expect( view.element.classList.contains( 'ck-transitions-disabled' ) ).to.be.true;
  47. view.enableCSSTransitions();
  48. expect( view.element.classList.contains( 'ck-transitions-disabled' ) ).to.be.false;
  49. } );
  50. } );
  51. } );