Browse Source

Removed bug and added test for it.

Maciej Bukowski 8 years ago
parent
commit
f49e2a9036

+ 5 - 0
packages/ckeditor5-engine/src/model/liveselection.js

@@ -203,6 +203,11 @@ export default class LiveSelection extends Selection {
 		this._refreshAttributes();
 	}
 
+	setFocus( itemOrPosition, offset ) {
+		super.setFocus( itemOrPosition, offset );
+		this._refreshAttributes();
+	}
+
 	/**
 	 * @inheritDoc
 	 */

+ 8 - 0
packages/ckeditor5-engine/tests/model/documentselection.js

@@ -252,6 +252,14 @@ describe( 'DocumentSelection', () => {
 
 			expect( spy.calledOnce ).to.be.true;
 		} );
+
+		it( 'refreshes attributes', () => {
+			const spy = sinon.spy( selection._selection, '_updateAttributes' );
+
+			selection._setFocus( Position.createAt( root, 1 ) );
+
+			expect( spy.called ).to.be.true;
+		} );
 	} );
 
 	describe( 'setTo - removeAllRanges', () => {