|
|
@@ -77,16 +77,67 @@ describe( 'RemoveFormat', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
- describe( 'Handles correctly known issues', () => {
|
|
|
- it( 'doesn\'t break after removing subsequently applied style', () => {
|
|
|
+ describe.only( 'Handles correctly known issues', () => {
|
|
|
+ it( 'doesn\'t break after removing format from attribute wrapped around another attribute', () => {
|
|
|
// https://github.com/ckeditor/ckeditor5-remove-format/pull/1#pullrequestreview-220515609
|
|
|
- setModelData( model, '<paragraph>f[o<$text bold="true">ob</$text>a]r</paragraph>' );
|
|
|
+ // setModelData( model, '<paragraph>f[o<$text bold="true">ob</$text>a]r</paragraph>' );
|
|
|
|
|
|
- editor.execute( 'underline' );
|
|
|
+ // editor.execute( 'underline' );
|
|
|
+
|
|
|
+ setModelData( model, '<paragraph>' +
|
|
|
+ 'f[<$text underline="true">o</$text>' +
|
|
|
+ '<$text underline="true" bold="true">ob</$text>' +
|
|
|
+ '<$text underline="true">a</$text>]r' +
|
|
|
+ '</paragraph>' );
|
|
|
+ // editor.execute( 'underline' );
|
|
|
|
|
|
editor.execute( 'removeFormat' );
|
|
|
|
|
|
expect( getModelData( model ) ).to.equal( '<paragraph>foobar</paragraph>' );
|
|
|
} );
|
|
|
} );
|
|
|
+
|
|
|
+ describe.only( 'Test external bug', () => {
|
|
|
+ it( 'sel rem attr', () => {
|
|
|
+ setModelData( model, '<paragraph>' +
|
|
|
+ 'f[<$text underline="true">o</$text>' +
|
|
|
+ '<$text underline="true" bold="true">ob</$text>' +
|
|
|
+ '<$text underline="true">a</$text>]r' +
|
|
|
+ '</paragraph>' );
|
|
|
+
|
|
|
+ model.change( writer => {
|
|
|
+ const modelRoot = model.document.getRoot();
|
|
|
+ // const itemInQuestion = modelRoot.getChild( 0 ).getChild( 1 );
|
|
|
+
|
|
|
+ for ( const item of model.document.selection.getFirstRange() ) {
|
|
|
+ // console.log( item );
|
|
|
+ // console.log( 'has', item.item.hasAttribute( 'bold' ) );
|
|
|
+ writer.removeAttribute( 'bold', item.item );
|
|
|
+ writer.removeAttribute( 'underline', item.item );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ // for ( const i of [ 1, 2, 3 ] ) {
|
|
|
+ // writer.removeAttribute( 'underline', modelRoot.getChild( 0 ).getChild( i ) );
|
|
|
+ // writer.removeAttribute( 'bold', modelRoot.getChild( 0 ).getChild( i ) );
|
|
|
+ // }
|
|
|
+
|
|
|
+ // for ( const item of modelRoot ) {
|
|
|
+ // console.log( item );
|
|
|
+ // }
|
|
|
+ // debugger;
|
|
|
+
|
|
|
+ // writer.removeAttribute( 'underline', itemInQuestion );
|
|
|
+ // writer.removeAttribute( 'bold', itemInQuestion );
|
|
|
+ } );
|
|
|
+
|
|
|
+ // model.createRange( 0 )
|
|
|
+
|
|
|
+ // editor.execute( 'underline' );
|
|
|
+
|
|
|
+ // editor.execute( 'removeFormat' );
|
|
|
+
|
|
|
+ expect( getModelData( model ) ).to.equal( '<paragraph>f[ooba]r</paragraph>' );
|
|
|
+ } );
|
|
|
+ } );
|
|
|
} );
|