8
0

longtext.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 getLongText from '../../tests/_utils/longtext';
  6. describe( 'utils', () => {
  7. describe( 'getLongText', () => {
  8. it( 'should return text with 0 length', () => {
  9. expect( getLongText( 0 ).length ).to.equal( 0 );
  10. } );
  11. it( 'should return text with 553 length', () => {
  12. expect( getLongText( 553 ).length ).to.equal( 553 );
  13. } );
  14. it( 'should return text with 1500 length', () => {
  15. expect( getLongText( 1500 ).length ).to.equal( 1500 );
  16. } );
  17. it( 'should return text with 4000 length', () => {
  18. expect( getLongText( 4000 ).length ).to.equal( 4000 );
  19. } );
  20. it( 'should return different text with fromStart=false', () => {
  21. expect( getLongText( 100 ) ).to.not.equal( getLongText( 100, false ) );
  22. } );
  23. it( 'should return reversed text', () => {
  24. const text1 = getLongText( 100 );
  25. const text2 = getLongText( 100, true, true );
  26. expect( text1 ).to.not.equal( text2 );
  27. expect( text1 ).to.equal( text2.split( '' ).reverse().join( '' ) );
  28. } );
  29. it( 'should return reversed text (with fromStart=false)', () => {
  30. const text1 = getLongText( 150, false );
  31. const text2 = getLongText( 150, false, true );
  32. expect( text1 ).to.not.equal( text2 );
  33. expect( text1 ).to.equal( text2.split( '' ).reverse().join( '' ) );
  34. } );
  35. } );
  36. } );