8
0
Pārlūkot izejas kodu

Create stub tests for writer's Position/Writer/Selection factory methods.

Maciej Gołaszewski 7 gadi atpakaļ
vecāks
revīzija
9b7e3752d8
1 mainītis faili ar 96 papildinājumiem un 0 dzēšanām
  1. 96 0
      packages/ckeditor5-engine/tests/model/writer.js

+ 96 - 0
packages/ckeditor5-engine/tests/model/writer.js

@@ -2567,6 +2567,102 @@ describe( 'Writer', () => {
 		} );
 	} );
 
+	describe( 'createPositionFromPath()', () => {
+		it( 'should call model.createPositionFromPath()', () => {
+			const stub = sinon.stub( model, 'createPositionFromPath' );
+
+			model.change( writer => {
+				writer.createPositionFromPath();
+			} );
+
+			sinon.assert.calledOnce( stub );
+		} );
+	} );
+
+	describe( 'createPositionAt()', () => {
+		it( 'should call model.createPositionAt()', () => {
+			const stub = sinon.stub( model, 'createPositionAt' );
+
+			model.change( writer => {
+				writer.createPositionAt();
+			} );
+
+			sinon.assert.calledOnce( stub );
+		} );
+	} );
+
+	describe( 'createPositionAfter()', () => {
+		it( 'should call model.createPositionAfter()', () => {
+			const stub = sinon.stub( model, 'createPositionAfter' );
+
+			model.change( writer => {
+				writer.createPositionAfter();
+			} );
+
+			sinon.assert.calledOnce( stub );
+		} );
+	} );
+
+	describe( 'createPositionBefore()', () => {
+		it( 'should call model.createPositionBefore()', () => {
+			const stub = sinon.stub( model, 'createPositionBefore' );
+
+			model.change( writer => {
+				writer.createPositionBefore();
+			} );
+
+			sinon.assert.calledOnce( stub );
+		} );
+	} );
+
+	describe( 'createRange()', () => {
+		it( 'should call model.createRange()', () => {
+			const stub = sinon.stub( model, 'createRange' );
+
+			model.change( writer => {
+				writer.createRange();
+			} );
+
+			sinon.assert.calledOnce( stub );
+		} );
+	} );
+
+	describe( 'createRangeIn()', () => {
+		it( 'should call model.createRangeIn()', () => {
+			const stub = sinon.stub( model, 'createRangeIn' );
+
+			model.change( writer => {
+				writer.createRangeIn();
+			} );
+
+			sinon.assert.calledOnce( stub );
+		} );
+	} );
+
+	describe( 'createRangeOn()', () => {
+		it( 'should call model.createRangeOn()', () => {
+			const stub = sinon.stub( model, 'createRangeOn' );
+
+			model.change( writer => {
+				writer.createRangeOn();
+			} );
+
+			sinon.assert.calledOnce( stub );
+		} );
+	} );
+
+	describe( 'createSelection()', () => {
+		it( 'should call model.createSelection()', () => {
+			const stub = sinon.stub( model, 'createSelection' );
+
+			model.change( writer => {
+				writer.createSelection();
+			} );
+
+			sinon.assert.calledOnce( stub );
+		} );
+	} );
+
 	function createText( data, attributes ) {
 		return model.change( writer => {
 			return writer.createText( data, attributes );