Răsfoiți Sursa

Revert docs for setting object style.

Maciej Gołaszewski 6 ani în urmă
părinte
comite
97bc1e1f6a

+ 8 - 3
packages/ckeditor5-engine/src/view/stylesmap.js

@@ -150,16 +150,21 @@ export default class StylesMap {
 	 *			left: '2px',
 	 *		};
 	 *
+	 * This method allows also to set normalized values directly:
+	 *
+	 *		styles.set( 'border-color', { top: 'blue' } );
+	 *		styles.set( 'margin', { right: '2em' } );
+	 *
 	 * @param {String|Object} nameOrObject Style property name or object with multiple properties.
-	 * @param {String} value Value to set.
+	 * @param {String|Object} valueOrObject Value to set.
 	 */
-	set( nameOrObject, value ) {
+	set( nameOrObject, valueOrObject ) {
 		if ( isObject( nameOrObject ) ) {
 			for ( const [ key, value ] of Object.entries( nameOrObject ) ) {
 				this._styleProcessor.toNormalizedForm( key, value, this._styles );
 			}
 		} else {
-			this._styleProcessor.toNormalizedForm( nameOrObject, value, this._styles );
+			this._styleProcessor.toNormalizedForm( nameOrObject, valueOrObject, this._styles );
 		}
 	}
 

+ 2 - 2
packages/ckeditor5-engine/tests/view/styles/borderstyles.js

@@ -85,8 +85,8 @@ describe( 'Border styles normalization', () => {
 		} );
 
 		expect( styles.toString( 'border' ) ).to.equal( 'border-top:blue;' );
-		// TODO: expect( styles.has( 'border-top-color' ) ).to.be.true;
-		// expect( styles.getAsString( 'border-top-color' ) ).to.equal( 'blue' );
+		expect( styles.has( 'border-top-color' ) ).to.be.true;
+		expect( styles.getAsString( 'border-top-color' ) ).to.equal( 'blue' );
 	} );
 
 	it( 'should output inline shorthand rules #2', () => {