8
0
Просмотр исходного кода

Add tests for Input#isInput().

Maciej Gołaszewski 6 лет назад
Родитель
Сommit
1092d36279
1 измененных файлов с 23 добавлено и 0 удалено
  1. 23 0
      packages/ckeditor5-typing/tests/input.js

+ 23 - 0
packages/ckeditor5-typing/tests/input.js

@@ -70,6 +70,29 @@ describe( 'Input feature', () => {
 		return editor.destroy();
 	} );
 
+	describe( 'isInput()', () => {
+		let input;
+
+		beforeEach( () => {
+			input = editor.plugins.get( 'Input' );
+		} );
+
+		it( 'returns true for batch created using "input" command', done => {
+			model.document.once( 'change:data', ( evt, batch ) => {
+				expect( input.isInput( batch ) ).to.be.true;
+				done();
+			} );
+
+			editor.execute( 'input', { text: 'foo' } );
+		} );
+
+		it( 'returns false for batch not created using "input" command', () => {
+			const batch = model.createBatch();
+
+			expect( input.isInput( batch ) ).to.be.false;
+		} );
+	} );
+
 	describe( 'mutations handling', () => {
 		it( 'should handle text mutation', () => {
 			viewDocument.fire( 'mutations', [