Skip to content

Add coverage for the simple situation of two paragraphs #143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions test/draft-to-markdown.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,30 @@ describe('draftToMarkdown', function () {
markdown = draftToMarkdown(rawObject, {preserveNewlines: true});
expect(markdown).toEqual('> one\n> \n> blockquote\nHello :)');
});

it('creates distinct paragraphs when preserveNewlines is default (false)', function () {
/* eslint-disable */
const rawObject = {"blocks":[
{"key":"6iuat","text":"paragraph one","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},
{"key":"603i9","text":"paragraph two","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},
],"entityMap":{}}
/* eslint-enable */

var markdown = draftToMarkdown(rawObject);
expect(markdown).toEqual('paragraph one\n\nparagraph two');
});

it('creates distinct paragraphs when preserveNewlines is set to true', function () {
/* eslint-disable */
const rawObject = {"blocks":[
{"key":"6iuat","text":"paragraph one","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},
{"key":"603i9","text":"paragraph two","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},
],"entityMap":{}}
/* eslint-enable */

var markdown = draftToMarkdown(rawObject, {preserveNewlines: true});
expect(markdown).toEqual('paragraph one\n\nparagraph two');
});
});

describe('entity conversion', function () {
Expand Down