|
@@ -10,16 +10,24 @@ describe( 'plainTextToHtml()', () => {
|
|
|
expect( plainTextToHtml( 'x y <z>' ) ).to.equal( 'x y <z>' );
|
|
expect( plainTextToHtml( 'x y <z>' ) ).to.equal( 'x y <z>' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- it( 'turns a single line break into paragraphs', () => {
|
|
|
|
|
- expect( plainTextToHtml( 'x\ny\nz' ) ).to.equal( '<p>x</p><p>y</p><p>z</p>' );
|
|
|
|
|
|
|
+ it( 'turns double line breaks into paragraphs (Linux/Mac EOL style)', () => {
|
|
|
|
|
+ expect( plainTextToHtml( 'x\n\ny\n\nz' ) ).to.equal( '<p>x</p><p>y</p><p>z</p>' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
- it( 'turns double line breaks into paragraphs', () => {
|
|
|
|
|
- expect( plainTextToHtml( 'x\n\ny\n\nz' ) ).to.equal( '<p>x</p><p></p><p>y</p><p></p><p>z</p>' );
|
|
|
|
|
|
|
+ it( 'turns double line breaks into paragraphs (Windows EOL style)', () => {
|
|
|
|
|
+ expect( plainTextToHtml( 'x\r\n\r\ny\r\n\r\nz' ) ).to.equal( '<p>x</p><p>y</p><p>z</p>' );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'turns single line breaks into soft breaks (Linux/Mac EOL style)', () => {
|
|
|
|
|
+ expect( plainTextToHtml( 'x\ny\nz' ) ).to.equal( '<p>x<br>y<br>z</p>' );
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
|
|
+ it( 'turns single line breaks into soft breaks (Windows EOL style)', () => {
|
|
|
|
|
+ expect( plainTextToHtml( 'x\r\ny\r\nz' ) ).to.equal( '<p>x<br>y<br>z</p>' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'turns combination of different amount of line breaks to paragraphs', () => {
|
|
it( 'turns combination of different amount of line breaks to paragraphs', () => {
|
|
|
- expect( plainTextToHtml( 'a\nb\n\nc\n\n\nd' ) ).to.equal( '<p>a</p><p>b</p><p></p><p>c</p><p></p><p></p><p>d</p>' );
|
|
|
|
|
|
|
+ expect( plainTextToHtml( 'a\n\nb\nc\n\n\n\nd\ne' ) ).to.equal( '<p>a</p><p>b<br>c</p><p></p><p>d<br>e</p>' );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'preserves trailing spaces', () => {
|
|
it( 'preserves trailing spaces', () => {
|