Bladeren bron

Tests: Added more tests for Template style attribute rendering.

Aleksander Nowodzinski 9 jaren geleden
bovenliggende
commit
ba5cd9fa28
1 gewijzigde bestanden met toevoegingen van 30 en 1 verwijderingen
  1. 30 1
      packages/ckeditor5-ui/tests/template.js

+ 30 - 1
packages/ckeditor5-ui/tests/template.js

@@ -337,7 +337,18 @@ describe( 'Template', () => {
 					}
 				} );
 
-				expect( el.outerHTML ).to.equal( '<p style="color: red;"></p>' );
+				expect( el.outerHTML ).to.equal( '<p style="color: red"></p>' );
+			} );
+
+			it( 'renders as a static value (Array of values)', () => {
+				setElement( {
+					tag: 'p',
+					attributes: {
+						style: [ 'color: red;', 'display: block;' ]
+					}
+				} );
+
+				expect( el.outerHTML ).to.equal( '<p style="color: red; display: block;"></p>' );
 			} );
 
 			it( 'renders as a value bound to the model', () => {
@@ -355,6 +366,24 @@ describe( 'Template', () => {
 				expect( el.outerHTML ).to.equal( '<p style="width: 1em"></p>' );
 			} );
 
+			it( 'renders as a value bound to the model (Array of bindings)', () => {
+				setElement( {
+					tag: 'p',
+					attributes: {
+						style: [
+							bind.to( 'width', w => `width: ${ w };` ),
+							bind.to( 'backgroundColor', c => `background-color: ${ c };` )
+						]
+					}
+				} );
+
+				expect( el.outerHTML ).to.equal( '<p style="width: 10px; background-color: yellow;"></p>' );
+
+				observable.width = '1em';
+
+				expect( el.outerHTML ).to.equal( '<p style="width: 1em; background-color: yellow;"></p>' );
+			} );
+
 			describe( 'object', () => {
 				it( 'renders with static and bound attributes', () => {
 					setElement( {