Skip to content

Commit 06263c1

Browse files
Ali Bosworthalibosworth
authored andcommitted
Add failing test coverage for OL item issue
Issue documented here Rosey#127
1 parent ea034bc commit 06263c1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/draft-to-markdown.spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,19 @@ describe('draftToMarkdown', function () {
397397
expect(markdown).toEqual('1. Test Item one unnested\n 1. Test Item one nested\n 2. Test Item two nested\n 3. Test item three nested\n2. Test item two unnested\n3. Test item three unnested\n4. Test Item Four unnested\n 1. Test item one nested under test item four\n 1. Test item one double nested\n 2. Test item two double nested');
398398
});
399399

400+
it('resets ordered lists count when list is interupted by another element', function () {
401+
/* eslint-disable */
402+
var rawObject = {"entityMap":{},"blocks":[
403+
{"key":"8omhg","text":"first top level list item","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},
404+
{"key":"d8k17","text":"second top level list item","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},
405+
{"key":"ag9fd","text":"another block-level item","type":"unstyled","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},
406+
{"key":"b5fol","text":"another top level list item","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},
407+
]};
408+
/* eslint-enable */
409+
var markdown = draftToMarkdown(rawObject);
410+
expect(markdown).toEqual('1. first top level list item\n2. second top level list item\n\nanother block-level item\n\n1. another top level list item');
411+
})
412+
400413
it('renders unnested ordered lists', function () {
401414
/* eslint-disable */
402415
var rawObject = {"entityMap":{},"blocks":[{"key":"d9c1d","text":"item","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}},{"key":"meoh","text":"item","type":"ordered-list-item","depth":0,"inlineStyleRanges":[],"entityRanges":[],"data":{}}]};

0 commit comments

Comments
 (0)