Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Added a test for todo lists when loading the HTML produced by the tod…
Browse files Browse the repository at this point in the history
…o list feature.
  • Loading branch information
fredck committed Feb 25, 2020
1 parent 116ced0 commit 38a8f78
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/gfmdataprocessor/lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
*/

import { testDataProcessor as test } from '../../tests/_utils/utils';
import MarkdownDataProcessor from '../../src/gfmdataprocessor';
import HtmlDataProcessor from '@ckeditor/ckeditor5-engine/src/dataprocessor/htmldataprocessor';

describe( 'GFMDataProcessor', () => {
describe( 'lists', () => {
Expand Down Expand Up @@ -352,5 +354,28 @@ describe( 'GFMDataProcessor', () => {
'<li><input checked="" disabled="" type="checkbox"></input>Item 2</li>' +
'</ul>' );
} );

it( 'should process the HTML produced by the todo list feature', () => {
const htmlDataProcessor = new HtmlDataProcessor();
const mdDataProcessor = new MarkdownDataProcessor();

const viewFragment = htmlDataProcessor.toView(
'<ul class="todo-list">' +
'<li><label class="todo-list__label">' +
'<input type="checkbox" disabled="disabled">' +
'<span class="todo-list__label__description">Item 1</span>' +
'</label></li>' +
'<li><label class="todo-list__label">' +
'<input type="checkbox" disabled="disabled" checked="checked">' +
'<span class="todo-list__label__description">Item 2</span>' +
'</label></li>' +
'</ul>'
);

expect( mdDataProcessor.toData( viewFragment ) ).to.equal(
'* [ ] List 1\n' +
'* [x] Item 2'
);
} );
} );
} );

0 comments on commit 38a8f78

Please sign in to comment.