paragraphs.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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( 'paragraphs', () => {
  8. it( 'single line', () => {
  9. testDataProcessor(
  10. 'single line paragraph',
  11. '<p>single line paragraph</p>'
  12. );
  13. } );
  14. it( 'multiline', () => {
  15. testDataProcessor(
  16. 'first\n' +
  17. 'second\n' +
  18. 'third',
  19. // GitHub is rendering as:
  20. // <p>first<br>
  21. // second<br>
  22. // third</p>
  23. '<p>first<br></br>second<br></br>third</p>'
  24. );
  25. } );
  26. it( 'with header after #1', () => {
  27. testDataProcessor(
  28. 'single line\n' +
  29. '# header',
  30. // GitHub is rendering as:
  31. // <p>single line</p>
  32. //
  33. // <h1>header</h1>
  34. '<p>single line</p><h1>header</h1>',
  35. 'single line\n' +
  36. '\n' +
  37. '# header'
  38. );
  39. } );
  40. it( 'with blockquote after', () => {
  41. testDataProcessor(
  42. 'single line' +
  43. '\n> quote',
  44. // GitHub is rendereing as:
  45. // <p>single line</p>
  46. //
  47. // <blockquote>
  48. // <p>quote</p>
  49. // </blockquote>
  50. '<p>single line</p><blockquote><p>quote</p></blockquote>',
  51. 'single line' +
  52. '\n' +
  53. '\n> quote'
  54. );
  55. } );
  56. it( 'with list after', () => {
  57. testDataProcessor(
  58. 'single line\n' +
  59. '* item',
  60. // GitHub is rendering as:
  61. // <p>single line</p>
  62. //
  63. // <ul>
  64. // <li>item</li>
  65. // </ul>
  66. '<p>single line</p><ul><li>item</li></ul>',
  67. 'single line\n' +
  68. '\n' +
  69. '* item'
  70. );
  71. } );
  72. } );
  73. } );