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

Commit

Permalink
Merge afe66d9 into 6c85e6b
Browse files Browse the repository at this point in the history
  • Loading branch information
scofalik committed Jul 23, 2019
2 parents 6c85e6b + afe66d9 commit 28dc8ca
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/model/differ.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export default class Differ {
case 'addAttribute':
case 'removeAttribute':
case 'changeAttribute': {
for ( const item of operation.range.getItems() ) {
for ( const item of operation.range.getItems( { shallow: true } ) ) {
if ( this._isInInsertedElement( item.parent ) ) {
continue;
}
Expand Down
30 changes: 30 additions & 0 deletions tests/model/differ.js
Original file line number Diff line number Diff line change
Expand Up @@ -1243,6 +1243,36 @@ describe( 'Differ', () => {
} );
} );

it( 'on an element that got some nodes inserted', () => {
const p = root.getChild( 0 );

model.change( () => {
insert( new Text( 'x' ), Position._createAt( p, 3 ) );
insert( new Text( 'x' ), Position._createAt( p, 4 ) );
insert( new Text( 'x' ), Position._createAt( p, 5 ) );

attribute( new Range( Position._createAt( root, 0 ), Position._createAt( root, 1 ) ), 'a', null, true );

insert( new Text( 'y' ), Position._createAt( p, 6 ) );

expectChanges( [
{
type: 'attribute',
range: new Range( Position._createAt( root, 0 ), Position._createAt( p, 0 ) ),
attributeKey: 'a',
attributeOldValue: null,
attributeNewValue: true
},
{
type: 'insert',
position: Position._createAt( p, 3 ),
length: 4,
name: '$text'
}
] );
} );
} );

it( 'over all changed nodes and some not changed nodes', () => {
const p = root.getChild( 0 );

Expand Down

0 comments on commit 28dc8ca

Please sign in to comment.