8
0
Quellcode durchsuchen

Filtered out ununseful batches from autosave #2.

Maciej Bukowski vor 7 Jahren
Ursprung
Commit
b39dc015b6
1 geänderte Dateien mit 29 neuen und 1 gelöschten Zeilen
  1. 29 1
      packages/ckeditor5-autosave/tests/autosave.js

+ 29 - 1
packages/ckeditor5-autosave/tests/autosave.js

@@ -145,7 +145,7 @@ describe( 'Autosave', () => {
 			} );
 		} );
 
-		it( 'should filter out batches that don\'t change content', () => {
+		it( 'should filter out change batches that don\'t change content', () => {
 			autosave.provider = {
 				save: sandbox.spy()
 			};
@@ -158,6 +158,34 @@ describe( 'Autosave', () => {
 			sinon.assert.notCalled( autosave.provider.save );
 		} );
 
+		it( 'should filter out change batches that don\'t change content #2', () => {
+			autosave.provider = {
+				save: sandbox.spy()
+			};
+
+			const operation = { name: 'user:position' };
+			editor.model.document.fire( 'change', {
+				deltas: [ { operations: [ operation ] } ]
+			} );
+
+			autosave._flush();
+			sinon.assert.notCalled( autosave.provider.save );
+		} );
+
+		it( 'should filter out change batches that don\'t change content #3', () => {
+			autosave.provider = {
+				save: sandbox.spy()
+			};
+
+			const operation = { name: 'user:range' };
+			editor.model.document.fire( 'change', {
+				deltas: [ { operations: [ operation ] } ]
+			} );
+
+			autosave._flush();
+			sinon.assert.notCalled( autosave.provider.save );
+		} );
+
 		it( 'should flush remaining calls after editor\'s destroy', () => {
 			const spy = sandbox.spy();
 			const savedStates = [];