Parcourir la source

Add test for view/Document.addStyleProcessorRules().

Maciej Gołaszewski il y a 6 ans
Parent
commit
a57ff3a5d0

+ 11 - 0
packages/ckeditor5-engine/src/view/document.js

@@ -161,6 +161,17 @@ export default class Document {
 		this.stopListening();
 	}
 
+	/**
+	 * Adds a style processor normalization rules.
+	 *
+	 * Available style rules are:
+	 * - background: {@link module:engine/view/styles/background~addBackgroundRules}
+	 * - border: {@link module:engine/view/styles/border~addBorderRules}
+	 * - margin: {@link module:engine/view/styles/background~addMarginRules}
+	 * - padding: {@link module:engine/view/styles/padding~addPaddingRules}
+	 *
+	 * @param {Function} callback
+	 */
 	addStyleProcessorRules( callback ) {
 		callback( StylesMap._styleProcessor );
 	}

+ 12 - 0
packages/ckeditor5-engine/tests/view/document.js

@@ -10,6 +10,7 @@ import Document from '../../src/view/document';
 import testUtils from '@ckeditor/ckeditor5-core/tests/_utils/utils';
 import count from '@ckeditor/ckeditor5-utils/src/count';
 import createViewRoot from './_utils/createroot';
+import StylesMap from '../../src/view/stylesmap';
 
 describe( 'Document', () => {
 	let domRoot, viewDocument;
@@ -91,4 +92,15 @@ describe( 'Document', () => {
 			expect( calls ).to.equal( 4 );
 		} );
 	} );
+
+	describe( 'addStyleProcessorRules()', () => {
+		it( 'should ', () => {
+			const spy = sinon.spy();
+
+			viewDocument.addStyleProcessorRules( spy );
+
+			sinon.assert.calledOnce( spy );
+			sinon.assert.calledWithExactly( spy, StylesMap._styleProcessor );
+		} );
+	} );
 } );