+ //Foo{}
+ //Foo
foo
' + + '123
' + + 'foo
' + + '123
' + + 'foo
' + + 'bar
' + + 'foo
' + + 'bar
' + + 'bar
' + + 'bar
' + + 'مرØبا
+مرØبا.
+مرØبا
+This is a test for list feature.
+Some more text for testing.
+Paragraph.
+Another testing paragraph.
+Checkbox in paragraph
+p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'x
' + + 'p
' + + 'p
' + + 'b
' + + 'p
' + + 'p
' + + 'x
' + + 'p
' + + 'x
' + + 'x2
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + ); + + expect( test.reconvertSpy.callCount ).to.equal( 0 ); + } ); + + it( 'remove element from between lists of same type', () => { + test.remove( + 'p
' + + 'p
' + ); + + expect( test.reconvertSpy.callCount ).to.equal( 0 ); + } ); + + it( 'remove element from between lists of different type', () => { + test.remove( + 'p
' + + 'p
' + ); + + expect( test.reconvertSpy.callCount ).to.equal( 0 ); + } ); + + it( 'remove the first block of a list item', () => { + test.remove( + 'p
' + + 'p
' + + 'p
' + + 'a3
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + ); + + expect( test.reconvertSpy.callCount ).to.equal( 1 ); + expect( test.reconvertSpy.firstCall.firstArg ).to.equal( modelRoot.getChild( 1 ) ); + } ); + + it( 'change element into to-do list at the edge of two different lists (after to-do list)', () => { + test.changeType( + '' + + '', + + 'b ' + + 'c ' + + '
' + + '' + + '' + + '
' + + '- ' + + '' + + '' + + 'b' + + '' + + '
' + + '' + + '
' + + '- ' + + '' + + '' + + '' + + 'c' + + '' + + '
' + + '
' + + '', + + 'b ' + + 'c ' + + '
' + + '' + + '' + + '
' + + '- ' + + 'b' + + '
' + + '' + + '
' + + '- c
' + + '
' +
+ 'abc
' +
+ '
' +
+ '' +
+ 'abc
' +
+ '
' +
+ 'b2
' + + 'b2
' + + 'b2
' + + 'a
' + + 'b
' + + 'b
' + ); + + expect( test.reconvertSpy.callCount ).to.equal( 1 ); + expect( test.reconvertSpy.firstCall.firstArg ).to.equal( modelRoot.getChild( 1 ) ); + } ); + + it( 'only list item', () => { + test.removeListAttributes( + 'p
' + + 'x
' + + 'p
' + ); + + expect( test.reconvertSpy.callCount ).to.equal( 1 ); + expect( test.reconvertSpy.firstCall.firstArg ).to.equal( modelRoot.getChild( 1 ) ); + } ); + + it( 'on non paragraph', () => { + test.removeListAttributes( + '[a1
' + + 'a2
' + ); + + expect( test.reconvertSpy.callCount ).to.equal( 0 ); + } ); + + it( 'middle block of list item', () => { + test.removeListAttributes( + 'a2
' + + 'x
' + + 'x
' + ); + + expect( test.reconvertSpy.callCount ).to.equal( 1 ); + expect( test.reconvertSpy.firstCall.firstArg ).to.equal( modelRoot.getChild( 1 ) ); + } ); + + it( 'on element before list of same type', () => { + test.setListAttributes( 'todo', + '[a
' + + 'x
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + 'p
' + + '1b
' + + 'xb
' + + 'p
' + + 'p
' + + '1b
' + + 'xb
' + + '1.1b
' + + 'p
' + + 'p
' + + '1b
' + + 'xb
' + + '2b
' + + 'p
' + + 'p
' + + '1b
' + + '1.1b
' + + 'xb
' + + 'p
' + + 'p
' + + '1b
' + + 'xb
' + + '1.1b
' + + 'p
' + + 'p
' + + '1.1
' + + 'x
' + + '1.2
' + + 'p
' + + 'x
' + + 'c
' + + 'b
' + ); + } ); + } ); + } ); + + describe( 'position mapping', () => { + let mapper, view, viewRoot; + + beforeEach( () => { + mapper = editor.editing.mapper; + view = editor.editing.view; + viewRoot = view.document.getRoot(); + + setModelData( model, + '0
' + + '2
' + + 'foo
' + + 'foo
' + + 'bar
' + + 'foo' + + '
' + + '' + ); + } ); + + it( 'should convert li with a checkbox and a heading', () => { + testUpcast( + 'foo ' + + '
foo |
bar
' + + '' + + '', + 'foo ' + + '
' + + '' + + 'foo
' + + '
' + + 'foo' + + '
' + + 'bar
' + + '' + + '', + 'foo ' + + '
' + + 'foo
foo | ' + + '
foo
' + + '