tabs.js 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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( 'tabs', () => {
  8. it( 'should process list item with tabs', () => {
  9. testDataProcessor(
  10. '+ this is a list item indented with tabs',
  11. // GitHub will render it as (notice two spaces at the beginning of the list item):
  12. // <ul>
  13. // <li> this is a list item indented with tabs</li>
  14. // </ul>
  15. '<ul>' +
  16. '<li>this is a list item indented with tabs</li>' +
  17. '</ul>',
  18. // After converting back list will be normalized to *.
  19. '* this is a list item indented with tabs'
  20. );
  21. } );
  22. it( 'should process list item with spaces', () => {
  23. testDataProcessor(
  24. '+ this is a list item indented with spaces',
  25. // GitHub will render it as (notice two spaces at the beginning of the list item):
  26. // <ul>
  27. // <li> this is a list item indented with spaces</li>
  28. // </ul>
  29. '<ul>' +
  30. '<li>this is a list item indented with spaces</li>' +
  31. '</ul>',
  32. // After converting back list will be normalized to *.
  33. '* this is a list item indented with spaces'
  34. );
  35. } );
  36. it( 'should process code block indented by tab', () => {
  37. testDataProcessor(
  38. ' this code block is indented by one tab',
  39. '<pre><code>this code block is indented by one tab</code></pre>',
  40. // After converting back code block will be normalized to ``` representation.
  41. '```\n' +
  42. 'this code block is indented by one tab\n' +
  43. '```'
  44. );
  45. } );
  46. it( 'should process code block indented by two tabs', () => {
  47. testDataProcessor(
  48. ' this code block is indented by two tabs',
  49. '<pre><code> this code block is indented by two tabs</code></pre>',
  50. // After converting back code block will be normalized to ``` representation.
  51. '```\n' +
  52. ' this code block is indented by two tabs\n' +
  53. '```'
  54. );
  55. } );
  56. it( 'should process list items indented with tabs as code block', () => {
  57. testDataProcessor(
  58. ' + list item\n' +
  59. ' next line',
  60. '<pre><code>+ list item\n' +
  61. 'next line</code></pre>',
  62. // After converting back code block will be normalized to ``` representation.
  63. '```\n' +
  64. '+ list item\n' +
  65. 'next line\n' +
  66. '```'
  67. );
  68. } );
  69. } );
  70. } );