|
@@ -4,6 +4,7 @@
|
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
import Selection from '../../src/view/selection';
|
|
import Selection from '../../src/view/selection';
|
|
|
|
|
+import DocumentSelection from '../../src/view/documentselection';
|
|
|
import Range from '../../src/view/range';
|
|
import Range from '../../src/view/range';
|
|
|
import Document from '../../src/view/document';
|
|
import Document from '../../src/view/document';
|
|
|
import Element from '../../src/view/element';
|
|
import Element from '../../src/view/element';
|
|
@@ -92,6 +93,14 @@ describe( 'Selection', () => {
|
|
|
expect( selection.isBackward ).to.be.true;
|
|
expect( selection.isBackward ).to.be.true;
|
|
|
} );
|
|
} );
|
|
|
|
|
|
|
|
|
|
+ it( 'should be able to create a selection from the other document selection', () => {
|
|
|
|
|
+ const otherSelection = new DocumentSelection( [ range2, range3 ], { backward: true } );
|
|
|
|
|
+ const selection = new Selection( otherSelection );
|
|
|
|
|
+
|
|
|
|
|
+ expect( Array.from( selection.getRanges() ) ).to.deep.equal( [ range2, range3 ] );
|
|
|
|
|
+ expect( selection.isBackward ).to.be.true;
|
|
|
|
|
+ } );
|
|
|
|
|
+
|
|
|
it( 'should be able to create a fake selection from the other fake selection', () => {
|
|
it( 'should be able to create a fake selection from the other fake selection', () => {
|
|
|
const otherSelection = new Selection( [ range2, range3 ], { fake: true, label: 'foo bar baz' } );
|
|
const otherSelection = new Selection( [ range2, range3 ], { fake: true, label: 'foo bar baz' } );
|
|
|
const selection = new Selection( otherSelection );
|
|
const selection = new Selection( otherSelection );
|