paragraphs.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /**
  2. * @license Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
  3. * For licensing, see LICENSE.md.
  4. */
  5. import { testDataProcessor as test } from 'ckeditor5-markdown-gfm/tests/_utils/utils';
  6. describe( 'GFMDataProcessor', () => {
  7. describe( 'paragraphs', () => {
  8. it( 'single line', () => {
  9. test(
  10. 'single line paragraph',
  11. '<p>single line paragraph</p>'
  12. );
  13. } );
  14. it( 'multiline', () => {
  15. test(
  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. test(
  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. // To-markdown always put 2 empty lines after paragraph.
  36. 'single line\n\n' +
  37. '# header'
  38. );
  39. } );
  40. it( 'with header after #2', () => {
  41. test(
  42. 'single line\n' +
  43. 'header\n' +
  44. '===',
  45. // GitHub is rendering as:
  46. // <p>single line</p>
  47. //
  48. //<h1>header</h1>
  49. '<p>single line</p><h1>header</h1>',
  50. // To-markdown always put 2 empty lines after paragraph and normalize header to #.
  51. 'single line\n' +
  52. '\n' +
  53. '# header'
  54. );
  55. } );
  56. it( 'with blockquote after', () => {
  57. test(
  58. 'single line' +
  59. '\n> quote',
  60. // GitHub is rendereing as:
  61. // <p>single line</p>
  62. //
  63. // <blockquote>
  64. // <p>quote</p>
  65. // </blockquote>
  66. '<p>single line</p><blockquote><p>quote</p></blockquote>',
  67. // To-markdown always put 2 empty lines after paragraph.
  68. 'single line\n' +
  69. '\n' +
  70. '> quote'
  71. );
  72. } );
  73. it( 'with list after', () => {
  74. test(
  75. 'single line\n' +
  76. '* item',
  77. // GitHub is rendering as:
  78. // <p>single line</p>
  79. //
  80. // <ul>
  81. // <li>item</li>
  82. // </ul>
  83. '<p>single line</p><ul><li>item</li></ul>',
  84. // To-markdown always put 2 empty lines after paragraph.
  85. 'single line\n' +
  86. '\n' +
  87. '* item'
  88. );
  89. } );
  90. it( 'with div element after', () => {
  91. test(
  92. 'single line\n' +
  93. '<div>div element</div>',
  94. // GitHub is rendering as:
  95. // <p>single line</p>
  96. //
  97. // <div>div element</div>
  98. '<p>single line</p><div>div element</div>',
  99. // To-markdown always put 2 empty lines after paragraph.
  100. 'single line\n' +
  101. '\n' +
  102. '<div>div element</div>'
  103. );
  104. } );
  105. } );
  106. } );