text.js 1.5 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 { testDataProcessor } from '../_utils/utils';
  6. describe( 'GFMDataProcessor', () => {
  7. describe( 'text', () => {
  8. describe( 'urls', () => {
  9. it( 'should not escape urls', () => {
  10. testDataProcessor(
  11. 'escape\\_this https://test.com/do_[not]-escape escape\\_this',
  12. '<p>escape_this https://test.com/do_[not]-escape escape_this</p>'
  13. );
  14. } );
  15. it( 'should not escape urls (data escaped between urls)', () => {
  16. testDataProcessor(
  17. 'escape\\_this https://test.com/do_[not]-escape escape\\_this https://test.com/do_[not]-escape',
  18. '<p>escape_this https://test.com/do_[not]-escape escape_this https://test.com/do_[not]-escape</p>'
  19. );
  20. } );
  21. it( 'should not escape urls (at start)', () => {
  22. testDataProcessor(
  23. 'https://test.com/do_[not]-escape escape\\_this',
  24. '<p>https://test.com/do_[not]-escape escape_this</p>'
  25. );
  26. } );
  27. it( 'should not escape urls (at end)', () => {
  28. testDataProcessor(
  29. 'escape\\_this https://test.com/do_[not]-escape',
  30. '<p>escape_this https://test.com/do_[not]-escape</p>'
  31. );
  32. } );
  33. [
  34. 'https://test.com/do_[not]-escape',
  35. 'http://test.com/do_[not]-escape',
  36. 'www.test.com/do_[not]-escape'
  37. ].forEach( url => {
  38. it( `should not escape urls (${ url })`, () => {
  39. testDataProcessor( url, `<p>${ url }</p>` );
  40. } );
  41. } );
  42. } );
  43. } );
  44. } );