Browse Source

Always add trailing semicolon to styles output.

Maciej Gołaszewski 6 years ago
parent
commit
6276748d03

+ 1 - 1
packages/ckeditor5-engine/src/view/styles.js

@@ -77,7 +77,7 @@ export default class Styles {
 			parsed.push( toInlineStyle( key, model ) );
 		}
 
-		return parsed.join( ';' );
+		return parsed.join( ';' ) + ';';
 	}
 
 	getInlineRule( name ) {

+ 4 - 4
packages/ckeditor5-engine/tests/view/element.js

@@ -516,7 +516,7 @@ describe( 'Element', () => {
 				el._setStyle( 'color', 'red' );
 				el._setStyle( 'top', '10px' );
 
-				expect( el.getAttribute( 'style' ) ).to.equal( 'color:red;top:10px' );
+				expect( el.getAttribute( 'style' ) ).to.equal( 'color:red;top:10px;' );
 			} );
 
 			it( 'should return undefined if no style attribute', () => {
@@ -539,7 +539,7 @@ describe( 'Element', () => {
 				el._setStyle( 'font-weight', 'bold' );
 
 				expect( Array.from( el.getAttributes() ) ).to.deep.equal( [
-					[ 'class', 'abc xyz' ], [ 'style', 'font-weight:bold;width:20px' ]
+					[ 'class', 'abc xyz' ], [ 'style', 'font-weight:bold;width:20px;' ]
 				] );
 			} );
 		} );
@@ -1037,7 +1037,7 @@ describe( 'Element', () => {
 				style: 'border: 1px solid red; background-color: red'
 			} );
 
-			expect( el.getIdentity() ).to.equal( 'foo style="background-color:red;border:1px solid red"' );
+			expect( el.getIdentity() ).to.equal( 'foo style="background-color:red;border:1px solid red;"' );
 		} );
 
 		it( 'should return attributes in sorted order', () => {
@@ -1060,7 +1060,7 @@ describe( 'Element', () => {
 			el._addClass( [ 'three', 'two', 'one' ] );
 
 			expect( el.getIdentity() ).to.equal(
-				'baz class="one,three,two" style="border-radius:10px;text-align:center" bar="two" foo="one"'
+				'baz class="one,three,two" style="border-radius:10px;text-align:center;" bar="two" foo="one"'
 			);
 		} );
 	} );

+ 6 - 6
packages/ckeditor5-engine/tests/view/styles.js

@@ -68,7 +68,7 @@ describe( 'Styles', () => {
 	it( 'should output', () => {
 		styleProxy.setStyle( 'border:1px solid blue;' );
 
-		expect( styleProxy.getInlineStyle() ).to.equal( 'border:1px solid blue' );
+		expect( styleProxy.getInlineStyle() ).to.equal( 'border:1px solid blue;' );
 		expect( styleProxy.getInlineRule( 'border' ) ).to.equal( '1px solid blue' );
 		expect( styleProxy.getInlineRule( 'border-top' ) ).to.equal( '1px solid blue' );
 		expect( styleProxy.getInlineRule( 'border-right' ) ).to.equal( '1px solid blue' );
@@ -80,7 +80,7 @@ describe( 'Styles', () => {
 		styleProxy.setStyle( 'border:1px solid blue;border-left:#665511 dashed 2.7em;border-top:7px dotted #ccc;' );
 
 		expect( styleProxy.getInlineStyle() ).to.equal(
-			'border-top:7px dotted #ccc;border-right:1px solid blue;border-bottom:1px solid blue;border-left:2.7em dashed #665511'
+			'border-top:7px dotted #ccc;border-right:1px solid blue;border-bottom:1px solid blue;border-left:2.7em dashed #665511;'
 		);
 		expect( styleProxy.getInlineRule( 'border' ) ).to.be.undefined;
 		expect( styleProxy.getInlineRule( 'border-top' ) ).to.equal( '7px dotted #ccc' );
@@ -95,7 +95,7 @@ describe( 'Styles', () => {
 		styleProxy.insertRule( 'border-top', '7px dotted #ccc' );
 
 		expect( styleProxy.getInlineStyle() ).to.equal(
-			'border-top:7px dotted #ccc;border-right:1px solid blue;border-bottom:1px solid blue;border-left:2.7em dashed #665511'
+			'border-top:7px dotted #ccc;border-right:1px solid blue;border-bottom:1px solid blue;border-left:2.7em dashed #665511;'
 		);
 		expect( styleProxy.getInlineRule( 'border' ) ).to.be.undefined;
 		expect( styleProxy.getInlineRule( 'border-top' ) ).to.equal( '7px dotted #ccc' );
@@ -105,11 +105,11 @@ describe( 'Styles', () => {
 	} );
 
 	it( 'should output', () => {
-		styleProxy.setStyle( 'border:1px solid blue' );
+		styleProxy.setStyle( 'border:1px solid blue;' );
 		styleProxy.removeRule( 'border-top' );
 
 		expect( styleProxy.getInlineStyle() ).to.equal(
-			'border-right:1px solid blue;border-bottom:1px solid blue;border-left:1px solid blue'
+			'border-right:1px solid blue;border-bottom:1px solid blue;border-left:1px solid blue;'
 		);
 		expect( styleProxy.getInlineRule( 'border' ) ).to.be.undefined;
 		expect( styleProxy.getInlineRule( 'border-top' ) ).to.be.undefined;
@@ -121,7 +121,7 @@ describe( 'Styles', () => {
 	it( 'pass-through', () => {
 		styleProxy.setStyle( 'foo-bar:baz 1px abc;margin: 2px 3em;' );
 
-		expect( styleProxy.getInlineStyle() ).to.equal( 'foo-bar:baz 1px abc;margin:2px 3em' );
+		expect( styleProxy.getInlineStyle() ).to.equal( 'foo-bar:baz 1px abc;margin:2px 3em;' );
 		expect( styleProxy.getInlineRule( 'foo-bar' ) ).to.equal( 'baz 1px abc' );
 		expect( styleProxy.getInlineRule( 'margin' ) ).to.equal( '2px 3em' );
 	} );