Browse Source

Refactor: Use singular class and styles in ViewElementDefinition.

Maciej Gołaszewski 8 years ago
parent
commit
1b1d918669

+ 5 - 5
packages/ckeditor5-font/src/fontsize/fontsizeediting.js

@@ -93,7 +93,7 @@ const namedPresets = {
 		model: 'text-tiny',
 		view: {
 			name: 'span',
-			classes: 'text-tiny'
+			class: 'text-tiny'
 		}
 	},
 	small: {
@@ -101,7 +101,7 @@ const namedPresets = {
 		model: 'text-small',
 		view: {
 			name: 'span',
-			classes: 'text-small'
+			class: 'text-small'
 		}
 	},
 	big: {
@@ -109,7 +109,7 @@ const namedPresets = {
 		model: 'text-big',
 		view: {
 			name: 'span',
-			classes: 'text-big'
+			class: 'text-big'
 		}
 	},
 	huge: {
@@ -117,7 +117,7 @@ const namedPresets = {
 		model: 'text-huge',
 		view: {
 			name: 'span',
-			classes: 'text-huge'
+			class: 'text-huge'
 		}
 	}
 };
@@ -154,7 +154,7 @@ function generatePixelPreset( size ) {
 		model: sizeName,
 		view: {
 			name: 'span',
-			styles: {
+			style: {
 				'font-size': `${ size }px`
 			}
 		}

+ 17 - 17
packages/ckeditor5-font/tests/fontsize/fontsizeediting.js

@@ -65,7 +65,7 @@ describe( 'FontSizeEditing', () => {
 				.create( {
 					plugins: [ FontSizeEditing ],
 					fontSize: {
-						items: [ { label: 'My Size', model: 'my-size', view: { name: 'span', styles: 'font-size: 12em;' } } ]
+						items: [ { label: 'My Size', model: 'my-size', view: { name: 'span', style: 'font-size: 12em;' } } ]
 					}
 				} )
 				.then( newEditor => {
@@ -77,7 +77,7 @@ describe( 'FontSizeEditing', () => {
 						{
 							label: 'My Size',
 							model: 'my-size',
-							view: { name: 'span', styles: 'font-size: 12em;' }
+							view: { name: 'span', style: 'font-size: 12em;' }
 						}
 					] );
 				} );
@@ -98,10 +98,10 @@ describe( 'FontSizeEditing', () => {
 						const plugin = editor.plugins.get( FontSizeEditing );
 
 						expect( plugin.configuredItems ).to.deep.equal( [
-							{ label: 'Tiny', model: 'text-tiny', view: { name: 'span', classes: 'text-tiny' } },
-							{ label: 'Small', model: 'text-small', view: { name: 'span', classes: 'text-small' } },
-							{ label: 'Big', model: 'text-big', view: { name: 'span', classes: 'text-big' } },
-							{ label: 'Huge', model: 'text-huge', view: { name: 'span', classes: 'text-huge' } }
+							{ label: 'Tiny', model: 'text-tiny', view: { name: 'span', class: 'text-tiny' } },
+							{ label: 'Small', model: 'text-small', view: { name: 'span', class: 'text-small' } },
+							{ label: 'Big', model: 'text-big', view: { name: 'span', class: 'text-big' } },
+							{ label: 'Huge', model: 'text-huge', view: { name: 'span', class: 'text-huge' } }
 						] );
 					} );
 			} );
@@ -122,10 +122,10 @@ describe( 'FontSizeEditing', () => {
 						const plugin = editor.plugins.get( FontSizeEditing );
 
 						expect( plugin.configuredItems ).to.deep.equal( [
-							{ label: '10', model: '10', view: { name: 'span', styles: { 'font-size': '10px' } } },
-							{ label: '12', model: '12', view: { name: 'span', styles: { 'font-size': '12px' } } },
-							{ label: '14', model: '14', view: { name: 'span', styles: { 'font-size': '14px' } } },
-							{ label: '18', model: '18', view: { name: 'span', styles: { 'font-size': '18px' } } }
+							{ label: '10', model: '10', view: { name: 'span', style: { 'font-size': '10px' } } },
+							{ label: '12', model: '12', view: { name: 'span', style: { 'font-size': '12px' } } },
+							{ label: '14', model: '14', view: { name: 'span', style: { 'font-size': '14px' } } },
+							{ label: '18', model: '18', view: { name: 'span', style: { 'font-size': '18px' } } }
 						] );
 					} );
 			} );
@@ -147,8 +147,8 @@ describe( 'FontSizeEditing', () => {
 								model: 'my',
 								view: {
 									name: 'mark',
-									styles: { 'font-size': '30px' },
-									classes: 'my-style'
+									style: { 'font-size': '30px' },
+									class: 'my-style'
 								}
 							}
 						]
@@ -201,8 +201,8 @@ describe( 'FontSizeEditing', () => {
 								model: 'my',
 								view: {
 									name: 'mark',
-									styles: { 'font-size': '30px' },
-									classes: 'my-style'
+									style: { 'font-size': '30px' },
+									class: 'my-style'
 								}
 							},
 							{
@@ -210,7 +210,7 @@ describe( 'FontSizeEditing', () => {
 								model: 'big-multiple',
 								view: {
 									name: 'span',
-									classes: [ 'foo', 'foo-big' ]
+									class: [ 'foo', 'foo-big' ]
 								}
 							},
 							{
@@ -218,10 +218,10 @@ describe( 'FontSizeEditing', () => {
 								model: 'complex',
 								view: {
 									name: 'span',
-									classes: [ 'text-complex' ]
+									class: [ 'text-complex' ]
 								},
 								acceptsAlso: [
-									{ name: 'span', styles: { 'font-size': '77em' } },
+									{ name: 'span', style: { 'font-size': '77em' } },
 									{ name: 'span', attributes: { 'data-size': '77em' } }
 								]
 							}