|
@@ -139,9 +139,9 @@ describe( 'Differ', () => {
|
|
|
insert( image, position );
|
|
insert( image, position );
|
|
|
|
|
|
|
|
const caption = new Element( 'caption' );
|
|
const caption = new Element( 'caption' );
|
|
|
- insert( caption, Position.createAt( image, 0 ) );
|
|
|
|
|
|
|
+ insert( caption, Position._createAt( image, 0 ) );
|
|
|
|
|
|
|
|
- insert( new Text( 'foo' ), Position.createAt( caption, 0 ) );
|
|
|
|
|
|
|
+ insert( new Text( 'foo' ), Position._createAt( caption, 0 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'insert', name: 'image', length: 1, position }
|
|
{ type: 'insert', name: 'image', length: 1, position }
|
|
@@ -168,13 +168,13 @@ describe( 'Differ', () => {
|
|
|
it( 'node in a element with changed attribute', () => {
|
|
it( 'node in a element with changed attribute', () => {
|
|
|
const text = new Text( 'xyz', { bold: true } );
|
|
const text = new Text( 'xyz', { bold: true } );
|
|
|
const position = new Position( root, [ 0, 3 ] );
|
|
const position = new Position( root, [ 0, 3 ] );
|
|
|
- const range = Range.createFromParentsAndOffsets( root, 0, root, 1 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( root, 0 ), Position._createAt( root, 1 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
insert( text, position );
|
|
insert( text, position );
|
|
|
attribute( range, 'align', null, 'center' );
|
|
attribute( range, 'align', null, 'center' );
|
|
|
|
|
|
|
|
- const diffRange = Range.createFromParentsAndOffsets( root, 0, root.getChild( 0 ), 0 );
|
|
|
|
|
|
|
+ const diffRange = new Range( Position._createAt( root, 0 ), Position._createAt( root.getChild( 0 ), 0 ) );
|
|
|
|
|
|
|
|
// Compare to scenario above, this time there is only an attribute change on parent element,
|
|
// Compare to scenario above, this time there is only an attribute change on parent element,
|
|
|
// so there is also a diff for text.
|
|
// so there is also a diff for text.
|
|
@@ -198,14 +198,14 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
it( 'nodes before nodes with changed attributes', () => {
|
|
it( 'nodes before nodes with changed attributes', () => {
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 1, p1, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 1 ), Position._createAt( p1, 3 ) );
|
|
|
const position = new Position( root, [ 0, 0 ] );
|
|
const position = new Position( root, [ 0, 0 ] );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, 'bold', null, true );
|
|
attribute( range, 'bold', null, true );
|
|
|
insert( new Text( 'xx' ), position );
|
|
insert( new Text( 'xx' ), position );
|
|
|
|
|
|
|
|
- const rangeAfter = Range.createFromParentsAndOffsets( p1, 3, p1, 5 );
|
|
|
|
|
|
|
+ const rangeAfter = new Range( Position._createAt( p1, 3 ), Position._createAt( p1, 5 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'insert', name: '$text', length: 2, position },
|
|
{ type: 'insert', name: '$text', length: 2, position },
|
|
@@ -216,15 +216,15 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
it( 'nodes between nodes with changed attributes', () => {
|
|
it( 'nodes between nodes with changed attributes', () => {
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 1, p1, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 1 ), Position._createAt( p1, 3 ) );
|
|
|
const position = new Position( root, [ 0, 2 ] );
|
|
const position = new Position( root, [ 0, 2 ] );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, 'bold', null, true );
|
|
attribute( range, 'bold', null, true );
|
|
|
insert( new Text( 'xx' ), position );
|
|
insert( new Text( 'xx' ), position );
|
|
|
|
|
|
|
|
- const rangeBefore = Range.createFromParentsAndOffsets( p1, 1, p1, 2 );
|
|
|
|
|
- const rangeAfter = Range.createFromParentsAndOffsets( p1, 4, p1, 5 );
|
|
|
|
|
|
|
+ const rangeBefore = new Range( Position._createAt( p1, 1 ), Position._createAt( p1, 2 ) );
|
|
|
|
|
+ const rangeAfter = new Range( Position._createAt( p1, 4 ), Position._createAt( p1, 5 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
@@ -248,7 +248,7 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
it( 'nodes after nodes with changed attributes', () => {
|
|
it( 'nodes after nodes with changed attributes', () => {
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 1, p1, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 1 ), Position._createAt( p1, 3 ) );
|
|
|
const position = new Position( root, [ 0, 3 ] );
|
|
const position = new Position( root, [ 0, 3 ] );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
@@ -440,13 +440,13 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 0 ] );
|
|
const position = new Position( root, [ 0, 0 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 2, p1, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 2 ), Position._createAt( p1, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, 'bold', null, true );
|
|
attribute( range, 'bold', null, true );
|
|
|
remove( position, 1 );
|
|
remove( position, 1 );
|
|
|
|
|
|
|
|
- const newRange = Range.createFromParentsAndOffsets( p1, 1, p1, 2 );
|
|
|
|
|
|
|
+ const newRange = new Range( Position._createAt( p1, 1 ), Position._createAt( p1, 2 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'remove', name: '$text', length: 1, position },
|
|
{ type: 'remove', name: '$text', length: 1, position },
|
|
@@ -465,13 +465,13 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 0 ] );
|
|
const position = new Position( root, [ 0, 0 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 1, p1, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 1 ), Position._createAt( p1, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, 'bold', null, true );
|
|
attribute( range, 'bold', null, true );
|
|
|
remove( position, 2 );
|
|
remove( position, 2 );
|
|
|
|
|
|
|
|
- const newRange = Range.createFromParentsAndOffsets( p1, 0, p1, 1 );
|
|
|
|
|
|
|
+ const newRange = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 1 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'remove', name: '$text', length: 2, position },
|
|
{ type: 'remove', name: '$text', length: 2, position },
|
|
@@ -490,14 +490,14 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 0, p1, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, 'bold', null, true );
|
|
attribute( range, 'bold', null, true );
|
|
|
remove( position, 1 );
|
|
remove( position, 1 );
|
|
|
|
|
|
|
|
- const rangeBefore = Range.createFromParentsAndOffsets( p1, 0, p1, 1 );
|
|
|
|
|
- const rangeAfter = Range.createFromParentsAndOffsets( p1, 1, p1, 2 );
|
|
|
|
|
|
|
+ const rangeBefore = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 1 ) );
|
|
|
|
|
+ const rangeAfter = new Range( Position._createAt( p1, 1 ), Position._createAt( p1, 2 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
@@ -523,13 +523,13 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 0, p1, 2 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 2 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, 'bold', null, true );
|
|
attribute( range, 'bold', null, true );
|
|
|
remove( position, 2 );
|
|
remove( position, 2 );
|
|
|
|
|
|
|
|
- const newRange = Range.createFromParentsAndOffsets( p1, 0, p1, 1 );
|
|
|
|
|
|
|
+ const newRange = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 1 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
@@ -548,7 +548,7 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 2 ] );
|
|
const position = new Position( root, [ 0, 2 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 0, p1, 1 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 1 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, 'bold', null, true );
|
|
attribute( range, 'bold', null, true );
|
|
@@ -698,12 +698,12 @@ describe( 'Differ', () => {
|
|
|
const attributeNewValue = 'foo';
|
|
const attributeNewValue = 'foo';
|
|
|
|
|
|
|
|
it( 'on an element', () => {
|
|
it( 'on an element', () => {
|
|
|
- const range = Range.createFromParentsAndOffsets( root, 0, root, 1 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( root, 0 ), Position._createAt( root, 1 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
|
|
|
|
|
|
- const diffRange = Range.createFromParentsAndOffsets( root, 0, root.getChild( 0 ), 0 );
|
|
|
|
|
|
|
+ const diffRange = new Range( Position._createAt( root, 0 ), Position._createAt( root.getChild( 0 ), 0 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'attribute', range: diffRange, attributeKey, attributeOldValue, attributeNewValue }
|
|
{ type: 'attribute', range: diffRange, attributeKey, attributeOldValue, attributeNewValue }
|
|
@@ -712,7 +712,7 @@ describe( 'Differ', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'on an element - only one of many attributes changes', () => {
|
|
it( 'on an element - only one of many attributes changes', () => {
|
|
|
- const range = Range.createFromParentsAndOffsets( root, 0, root, 1 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( root, 0 ), Position._createAt( root, 1 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
// Set an attribute on an element. It won't change afterwards.
|
|
// Set an attribute on an element. It won't change afterwards.
|
|
@@ -722,7 +722,7 @@ describe( 'Differ', () => {
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
|
|
|
|
|
|
- const diffRange = Range.createFromParentsAndOffsets( root, 0, root.getChild( 0 ), 0 );
|
|
|
|
|
|
|
+ const diffRange = new Range( Position._createAt( root, 0 ), Position._createAt( root.getChild( 0 ), 0 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'attribute', range: diffRange, attributeKey, attributeOldValue, attributeNewValue }
|
|
{ type: 'attribute', range: diffRange, attributeKey, attributeOldValue, attributeNewValue }
|
|
@@ -732,7 +732,7 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
it( 'on a character', () => {
|
|
it( 'on a character', () => {
|
|
|
const parent = root.getChild( 1 );
|
|
const parent = root.getChild( 1 );
|
|
|
- const range = Range.createFromParentsAndOffsets( parent, 1, parent, 2 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( parent, 1 ), Position._createAt( parent, 2 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
@@ -745,7 +745,7 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
it( 'on a character - case with same characters next to each other', () => {
|
|
it( 'on a character - case with same characters next to each other', () => {
|
|
|
const parent = root.getChild( 0 );
|
|
const parent = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( parent, 1, parent, 2 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( parent, 1 ), Position._createAt( parent, 2 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
@@ -758,7 +758,7 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
it( 'on multiple characters', () => {
|
|
it( 'on multiple characters', () => {
|
|
|
const parent = root.getChild( 0 );
|
|
const parent = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( parent, 0, parent, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( parent, 0 ), Position._createAt( parent, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
@@ -772,14 +772,14 @@ describe( 'Differ', () => {
|
|
|
it( 'on multiple consecutive characters in multiple operations', () => {
|
|
it( 'on multiple consecutive characters in multiple operations', () => {
|
|
|
const parent = root.getChild( 0 );
|
|
const parent = root.getChild( 0 );
|
|
|
|
|
|
|
|
- const range1 = Range.createFromParentsAndOffsets( parent, 1, parent, 2 );
|
|
|
|
|
- const range2 = Range.createFromParentsAndOffsets( parent, 2, parent, 3 );
|
|
|
|
|
|
|
+ const range1 = new Range( Position._createAt( parent, 1 ), Position._createAt( parent, 2 ) );
|
|
|
|
|
+ const range2 = new Range( Position._createAt( parent, 2 ), Position._createAt( parent, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range1, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range1, attributeKey, attributeOldValue, attributeNewValue );
|
|
|
attribute( range2, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range2, attributeKey, attributeOldValue, attributeNewValue );
|
|
|
|
|
|
|
|
- const range = Range.createFromParentsAndOffsets( parent, 1, parent, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( parent, 1 ), Position._createAt( parent, 3 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'attribute', range, attributeKey, attributeOldValue, attributeNewValue }
|
|
{ type: 'attribute', range, attributeKey, attributeOldValue, attributeNewValue }
|
|
@@ -799,7 +799,7 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
for ( const item of ranges ) {
|
|
for ( const item of ranges ) {
|
|
|
- const range = Range.createFromParentsAndOffsets( parent, item[ 0 ], parent, item[ 1 ] );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( parent, item[ 0 ] ), Position._createAt( parent, item[ 1 ] ) );
|
|
|
|
|
|
|
|
attribute( range, item[ 4 ], item[ 2 ], item[ 3 ] );
|
|
attribute( range, item[ 4 ], item[ 2 ], item[ 3 ] );
|
|
|
}
|
|
}
|
|
@@ -807,14 +807,14 @@ describe( 'Differ', () => {
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
|
type: 'attribute',
|
|
type: 'attribute',
|
|
|
- range: Range.createFromParentsAndOffsets( parent, 0, parent, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( parent, 0 ), Position._createAt( parent, 2 ) ),
|
|
|
attributeKey: 'foo',
|
|
attributeKey: 'foo',
|
|
|
attributeOldValue: null,
|
|
attributeOldValue: null,
|
|
|
attributeNewValue: true
|
|
attributeNewValue: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type: 'attribute',
|
|
type: 'attribute',
|
|
|
- range: Range.createFromParentsAndOffsets( parent, 1, parent, 3 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( parent, 1 ), Position._createAt( parent, 3 ) ),
|
|
|
attributeKey: 'bar',
|
|
attributeKey: 'bar',
|
|
|
attributeOldValue: null,
|
|
attributeOldValue: null,
|
|
|
attributeNewValue: true
|
|
attributeNewValue: true
|
|
@@ -835,7 +835,7 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
for ( const item of ranges ) {
|
|
for ( const item of ranges ) {
|
|
|
- const range = Range.createFromParentsAndOffsets( parent, item[ 0 ], parent, item[ 1 ] );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( parent, item[ 0 ] ), Position._createAt( parent, item[ 1 ] ) );
|
|
|
|
|
|
|
|
attribute( range, item[ 4 ], item[ 2 ], item[ 3 ] );
|
|
attribute( range, item[ 4 ], item[ 2 ], item[ 3 ] );
|
|
|
}
|
|
}
|
|
@@ -843,28 +843,28 @@ describe( 'Differ', () => {
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
|
type: 'attribute',
|
|
type: 'attribute',
|
|
|
- range: Range.createFromParentsAndOffsets( parent, 0, parent, 1 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( parent, 0 ), Position._createAt( parent, 1 ) ),
|
|
|
attributeKey: 'bar',
|
|
attributeKey: 'bar',
|
|
|
attributeOldValue: null,
|
|
attributeOldValue: null,
|
|
|
attributeNewValue: true
|
|
attributeNewValue: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type: 'attribute',
|
|
type: 'attribute',
|
|
|
- range: Range.createFromParentsAndOffsets( parent, 1, parent, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( parent, 1 ), Position._createAt( parent, 2 ) ),
|
|
|
attributeKey: 'foo',
|
|
attributeKey: 'foo',
|
|
|
attributeOldValue: null,
|
|
attributeOldValue: null,
|
|
|
attributeNewValue: true
|
|
attributeNewValue: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type: 'attribute',
|
|
type: 'attribute',
|
|
|
- range: Range.createFromParentsAndOffsets( parent, 1, parent, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( parent, 1 ), Position._createAt( parent, 2 ) ),
|
|
|
attributeKey: 'bar',
|
|
attributeKey: 'bar',
|
|
|
attributeOldValue: null,
|
|
attributeOldValue: null,
|
|
|
attributeNewValue: true
|
|
attributeNewValue: true
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type: 'attribute',
|
|
type: 'attribute',
|
|
|
- range: Range.createFromParentsAndOffsets( parent, 2, parent, 3 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( parent, 2 ), Position._createAt( parent, 3 ) ),
|
|
|
attributeKey: 'foo',
|
|
attributeKey: 'foo',
|
|
|
attributeOldValue: null,
|
|
attributeOldValue: null,
|
|
|
attributeNewValue: true
|
|
attributeNewValue: true
|
|
@@ -884,7 +884,7 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
for ( const item of ranges ) {
|
|
for ( const item of ranges ) {
|
|
|
- const range = Range.createFromParentsAndOffsets( parent, item[ 0 ], parent, item[ 1 ] );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( parent, item[ 0 ] ), Position._createAt( parent, item[ 1 ] ) );
|
|
|
|
|
|
|
|
attribute( range, attributeKey, item[ 2 ], item[ 3 ] );
|
|
attribute( range, attributeKey, item[ 2 ], item[ 3 ] );
|
|
|
}
|
|
}
|
|
@@ -906,14 +906,14 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
for ( const item of ranges ) {
|
|
for ( const item of ranges ) {
|
|
|
- const range = Range.createFromParentsAndOffsets( parent, item[ 0 ], parent, item[ 1 ] );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( parent, item[ 0 ] ), Position._createAt( parent, item[ 1 ] ) );
|
|
|
|
|
|
|
|
attribute( range, attributeKey, item[ 2 ], item[ 3 ] );
|
|
attribute( range, attributeKey, item[ 2 ], item[ 3 ] );
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
expectChanges( [ {
|
|
expectChanges( [ {
|
|
|
type: 'attribute',
|
|
type: 'attribute',
|
|
|
- range: Range.createFromParentsAndOffsets( parent, 0, parent, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( parent, 0 ), Position._createAt( parent, 2 ) ),
|
|
|
attributeKey,
|
|
attributeKey,
|
|
|
attributeOldValue: null,
|
|
attributeOldValue: null,
|
|
|
attributeNewValue: true
|
|
attributeNewValue: true
|
|
@@ -924,8 +924,8 @@ describe( 'Differ', () => {
|
|
|
it( 'on multiple non-consecutive characters in multiple operations', () => {
|
|
it( 'on multiple non-consecutive characters in multiple operations', () => {
|
|
|
const parent = root.getChild( 0 );
|
|
const parent = root.getChild( 0 );
|
|
|
|
|
|
|
|
- const range1 = Range.createFromParentsAndOffsets( parent, 0, parent, 1 );
|
|
|
|
|
- const range2 = Range.createFromParentsAndOffsets( parent, 2, parent, 3 );
|
|
|
|
|
|
|
+ const range1 = new Range( Position._createAt( parent, 0 ), Position._createAt( parent, 1 ) );
|
|
|
|
|
+ const range2 = new Range( Position._createAt( parent, 2 ), Position._createAt( parent, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
// Note "reversed" order of ranges. Further range is changed first.
|
|
// Note "reversed" order of ranges. Further range is changed first.
|
|
@@ -941,7 +941,7 @@ describe( 'Differ', () => {
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'on range containing various nodes', () => {
|
|
it( 'on range containing various nodes', () => {
|
|
|
- const range = Range.createFromParentsAndOffsets( root, 0, root, 2 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( root, 0 ), Position._createAt( root, 2 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
@@ -953,14 +953,14 @@ describe( 'Differ', () => {
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( root, 0, p1, 0 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( root, 0 ), Position._createAt( p1, 0 ) ),
|
|
|
attributeKey,
|
|
attributeKey,
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( root, 1, p2, 0 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( root, 1 ), Position._createAt( p2, 0 ) ),
|
|
|
attributeKey,
|
|
attributeKey,
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
@@ -974,14 +974,14 @@ describe( 'Differ', () => {
|
|
|
|
|
|
|
|
p.getChild( 0 )._setAttribute( 'bold', true );
|
|
p.getChild( 0 )._setAttribute( 'bold', true );
|
|
|
|
|
|
|
|
- const range = Range.createFromParentsAndOffsets( p, 1, p, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p, 1 ), Position._createAt( p, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( range, 'bold', true, null );
|
|
attribute( range, 'bold', true, null );
|
|
|
attribute( range, 'italic', null, true );
|
|
attribute( range, 'italic', null, true );
|
|
|
|
|
|
|
|
- const range1 = Range.createFromParentsAndOffsets( p, 1, p, 2 );
|
|
|
|
|
- const range2 = Range.createFromParentsAndOffsets( p, 2, p, 3 );
|
|
|
|
|
|
|
+ const range1 = new Range( Position._createAt( p, 1 ), Position._createAt( p, 2 ) );
|
|
|
|
|
+ const range2 = new Range( Position._createAt( p, 2 ), Position._createAt( p, 3 ) );
|
|
|
|
|
|
|
|
// Attribute change glueing does not work 100% correct.
|
|
// Attribute change glueing does not work 100% correct.
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
@@ -1021,13 +1021,13 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 0, p1, 2 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 2 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
insert( new Text( 'xx' ), position );
|
|
insert( new Text( 'xx' ), position );
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
|
|
|
|
|
|
- const rangeBefore = Range.createFromParentsAndOffsets( p1, 0, p1, 1 );
|
|
|
|
|
|
|
+ const rangeBefore = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 1 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'attribute', range: rangeBefore, attributeKey, attributeOldValue, attributeNewValue },
|
|
{ type: 'attribute', range: rangeBefore, attributeKey, attributeOldValue, attributeNewValue },
|
|
@@ -1040,7 +1040,7 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 2, p1, 3 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 2 ), Position._createAt( p1, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
insert( new Text( 'xxx' ), position );
|
|
insert( new Text( 'xxx' ), position );
|
|
@@ -1056,13 +1056,13 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 2, p1, 4 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 2 ), Position._createAt( p1, 4 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
insert( new Text( 'xx' ), position );
|
|
insert( new Text( 'xx' ), position );
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
|
|
|
|
|
|
- const rangeAfter = Range.createFromParentsAndOffsets( p1, 3, p1, 4 );
|
|
|
|
|
|
|
+ const rangeAfter = new Range( Position._createAt( p1, 3 ), Position._createAt( p1, 4 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'insert', name: '$text', length: 2, position },
|
|
{ type: 'insert', name: '$text', length: 2, position },
|
|
@@ -1075,14 +1075,14 @@ describe( 'Differ', () => {
|
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
const position = new Position( root, [ 0, 1 ] );
|
|
|
|
|
|
|
|
const p1 = root.getChild( 0 );
|
|
const p1 = root.getChild( 0 );
|
|
|
- const range = Range.createFromParentsAndOffsets( p1, 0, p1, 4 );
|
|
|
|
|
|
|
+ const range = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 4 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
insert( new Text( 'xx' ), position );
|
|
insert( new Text( 'xx' ), position );
|
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
attribute( range, attributeKey, attributeOldValue, attributeNewValue );
|
|
|
|
|
|
|
|
- const rangeBefore = Range.createFromParentsAndOffsets( p1, 0, p1, 1 );
|
|
|
|
|
- const rangeAfter = Range.createFromParentsAndOffsets( p1, 3, p1, 4 );
|
|
|
|
|
|
|
+ const rangeBefore = new Range( Position._createAt( p1, 0 ), Position._createAt( p1, 1 ) );
|
|
|
|
|
+ const rangeAfter = new Range( Position._createAt( p1, 3 ), Position._createAt( p1, 4 ) );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'attribute', range: rangeBefore, attributeKey, attributeOldValue, attributeNewValue },
|
|
{ type: 'attribute', range: rangeBefore, attributeKey, attributeOldValue, attributeNewValue },
|
|
@@ -1095,8 +1095,8 @@ describe( 'Differ', () => {
|
|
|
it( 'on some not changed and some changed nodes', () => {
|
|
it( 'on some not changed and some changed nodes', () => {
|
|
|
const p = root.getChild( 0 );
|
|
const p = root.getChild( 0 );
|
|
|
|
|
|
|
|
- const rangeA = Range.createFromParentsAndOffsets( p, 1, p, 3 );
|
|
|
|
|
- const rangeB = Range.createFromParentsAndOffsets( p, 0, p, 2 );
|
|
|
|
|
|
|
+ const rangeA = new Range( Position._createAt( p, 1 ), Position._createAt( p, 3 ) );
|
|
|
|
|
+ const rangeB = new Range( Position._createAt( p, 0 ), Position._createAt( p, 2 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( rangeA, 'a', null, true );
|
|
attribute( rangeA, 'a', null, true );
|
|
@@ -1110,28 +1110,28 @@ describe( 'Differ', () => {
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 0, p, 1 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 0 ), Position._createAt( p, 1 ) ),
|
|
|
attributeKey: 'b',
|
|
attributeKey: 'b',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 1, p, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 1 ), Position._createAt( p, 2 ) ),
|
|
|
attributeKey: 'a',
|
|
attributeKey: 'a',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 1, p, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 1 ), Position._createAt( p, 2 ) ),
|
|
|
attributeKey: 'b',
|
|
attributeKey: 'b',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 2, p, 3 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 2 ), Position._createAt( p, 3 ) ),
|
|
|
attributeKey: 'a',
|
|
attributeKey: 'a',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
@@ -1143,8 +1143,8 @@ describe( 'Differ', () => {
|
|
|
it( 'on already changed nodes', () => {
|
|
it( 'on already changed nodes', () => {
|
|
|
const p = root.getChild( 1 );
|
|
const p = root.getChild( 1 );
|
|
|
|
|
|
|
|
- const rangeA = Range.createFromParentsAndOffsets( p, 0, p, 3 );
|
|
|
|
|
- const rangeB = Range.createFromParentsAndOffsets( p, 1, p, 2 );
|
|
|
|
|
|
|
+ const rangeA = new Range( Position._createAt( p, 0 ), Position._createAt( p, 3 ) );
|
|
|
|
|
+ const rangeB = new Range( Position._createAt( p, 1 ), Position._createAt( p, 2 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( rangeA, 'a', null, true );
|
|
attribute( rangeA, 'a', null, true );
|
|
@@ -1158,21 +1158,21 @@ describe( 'Differ', () => {
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 0, p, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 0 ), Position._createAt( p, 2 ) ),
|
|
|
attributeKey: 'a',
|
|
attributeKey: 'a',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 1, p, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 1 ), Position._createAt( p, 2 ) ),
|
|
|
attributeKey: 'b',
|
|
attributeKey: 'b',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 2, p, 3 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 2 ), Position._createAt( p, 3 ) ),
|
|
|
attributeKey: 'a',
|
|
attributeKey: 'a',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
@@ -1184,8 +1184,8 @@ describe( 'Differ', () => {
|
|
|
it( 'on some changed and some not changed nodes', () => {
|
|
it( 'on some changed and some not changed nodes', () => {
|
|
|
const p = root.getChild( 1 );
|
|
const p = root.getChild( 1 );
|
|
|
|
|
|
|
|
- const rangeA = Range.createFromParentsAndOffsets( p, 0, p, 2 );
|
|
|
|
|
- const rangeB = Range.createFromParentsAndOffsets( p, 1, p, 3 );
|
|
|
|
|
|
|
+ const rangeA = new Range( Position._createAt( p, 0 ), Position._createAt( p, 2 ) );
|
|
|
|
|
+ const rangeB = new Range( Position._createAt( p, 1 ), Position._createAt( p, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( rangeA, 'a', null, true );
|
|
attribute( rangeA, 'a', null, true );
|
|
@@ -1198,14 +1198,14 @@ describe( 'Differ', () => {
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 0, p, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 0 ), Position._createAt( p, 2 ) ),
|
|
|
attributeKey: 'a',
|
|
attributeKey: 'a',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 1, p, 3 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 1 ), Position._createAt( p, 3 ) ),
|
|
|
attributeKey: 'b',
|
|
attributeKey: 'b',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
@@ -1217,8 +1217,8 @@ describe( 'Differ', () => {
|
|
|
it( 'over all changed nodes and some not changed nodes', () => {
|
|
it( 'over all changed nodes and some not changed nodes', () => {
|
|
|
const p = root.getChild( 0 );
|
|
const p = root.getChild( 0 );
|
|
|
|
|
|
|
|
- const rangeA = Range.createFromParentsAndOffsets( p, 1, p, 2 );
|
|
|
|
|
- const rangeB = Range.createFromParentsAndOffsets( p, 0, p, 3 );
|
|
|
|
|
|
|
+ const rangeA = new Range( Position._createAt( p, 1 ), Position._createAt( p, 2 ) );
|
|
|
|
|
+ const rangeB = new Range( Position._createAt( p, 0 ), Position._createAt( p, 3 ) );
|
|
|
|
|
|
|
|
model.change( () => {
|
|
model.change( () => {
|
|
|
attribute( rangeA, 'a', null, true );
|
|
attribute( rangeA, 'a', null, true );
|
|
@@ -1232,21 +1232,21 @@ describe( 'Differ', () => {
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 0, p, 1 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 0 ), Position._createAt( p, 1 ) ),
|
|
|
attributeKey: 'b',
|
|
attributeKey: 'b',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 1, p, 2 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 1 ), Position._createAt( p, 2 ) ),
|
|
|
attributeKey: 'a',
|
|
attributeKey: 'a',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
type,
|
|
type,
|
|
|
- range: Range.createFromParentsAndOffsets( p, 1, p, 3 ),
|
|
|
|
|
|
|
+ range: new Range( Position._createAt( p, 1 ), Position._createAt( p, 3 ) ),
|
|
|
attributeKey: 'b',
|
|
attributeKey: 'b',
|
|
|
attributeOldValue,
|
|
attributeOldValue,
|
|
|
attributeNewValue
|
|
attributeNewValue
|
|
@@ -1391,8 +1391,8 @@ describe( 'Differ', () => {
|
|
|
let range, rangeB;
|
|
let range, rangeB;
|
|
|
|
|
|
|
|
beforeEach( () => {
|
|
beforeEach( () => {
|
|
|
- range = Range.createFromParentsAndOffsets( root, 0, root, 1 );
|
|
|
|
|
- rangeB = Range.createFromParentsAndOffsets( root, 1, root, 2 );
|
|
|
|
|
|
|
+ range = new Range( Position._createAt( root, 0 ), Position._createAt( root, 1 ) );
|
|
|
|
|
+ rangeB = new Range( Position._createAt( root, 1 ), Position._createAt( root, 2 ) );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'add marker', () => {
|
|
it( 'add marker', () => {
|
|
@@ -1603,10 +1603,10 @@ describe( 'Differ', () => {
|
|
|
it( 'remove is correctly transformed by multiple affecting changes', () => {
|
|
it( 'remove is correctly transformed by multiple affecting changes', () => {
|
|
|
root._appendChild( new Element( 'paragraph', null, new Text( 'xyz' ) ) );
|
|
root._appendChild( new Element( 'paragraph', null, new Text( 'xyz' ) ) );
|
|
|
|
|
|
|
|
- model.change( () => {
|
|
|
|
|
|
|
+ model.change( writer => {
|
|
|
rename( root.getChild( 1 ), 'heading' );
|
|
rename( root.getChild( 1 ), 'heading' );
|
|
|
rename( root.getChild( 2 ), 'heading' );
|
|
rename( root.getChild( 2 ), 'heading' );
|
|
|
- remove( Position.createAt( root, 0 ), 3 );
|
|
|
|
|
|
|
+ remove( writer.createPositionAt( root, 0 ), 3 );
|
|
|
|
|
|
|
|
expectChanges( [
|
|
expectChanges( [
|
|
|
{ type: 'remove', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) },
|
|
{ type: 'remove', name: 'paragraph', length: 1, position: new Position( root, [ 0 ] ) },
|
|
@@ -1624,8 +1624,8 @@ describe( 'Differ', () => {
|
|
|
position = new Position( root, [ 0, 1 ] );
|
|
position = new Position( root, [ 0, 1 ] );
|
|
|
p1 = root.getChild( 0 );
|
|
p1 = root.getChild( 0 );
|
|
|
|
|
|
|
|
- range = Range.createFromParentsAndOffsets( p1, 2, p1, 4 );
|
|
|
|
|
- rangeAttrChange = Range.createFromParentsAndOffsets( p1, 3, p1, 4 );
|
|
|
|
|
|
|
+ range = new Range( Position._createAt( p1, 2 ), Position._createAt( p1, 4 ) );
|
|
|
|
|
+ rangeAttrChange = new Range( Position._createAt( p1, 3 ), Position._createAt( p1, 4 ) );
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
it( 'should return changes in graveyard if a flag was set up', () => {
|
|
it( 'should return changes in graveyard if a flag was set up', () => {
|
|
@@ -1762,7 +1762,7 @@ describe( 'Differ', () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function remove( sourcePosition, howMany ) {
|
|
function remove( sourcePosition, howMany ) {
|
|
|
- const targetPosition = Position.createAt( doc.graveyard, doc.graveyard.maxOffset );
|
|
|
|
|
|
|
+ const targetPosition = Position._createAt( doc.graveyard, doc.graveyard.maxOffset );
|
|
|
const operation = new MoveOperation( sourcePosition, howMany, targetPosition, doc.version );
|
|
const operation = new MoveOperation( sourcePosition, howMany, targetPosition, doc.version );
|
|
|
|
|
|
|
|
model.applyOperation( operation );
|
|
model.applyOperation( operation );
|
|
@@ -1775,7 +1775,7 @@ describe( 'Differ', () => {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function rename( element, newName ) {
|
|
function rename( element, newName ) {
|
|
|
- const operation = new RenameOperation( Position.createBefore( element ), element.name, newName, doc.version );
|
|
|
|
|
|
|
+ const operation = new RenameOperation( Position._createBefore( element ), element.name, newName, doc.version );
|
|
|
|
|
|
|
|
model.applyOperation( operation );
|
|
model.applyOperation( operation );
|
|
|
}
|
|
}
|