8
0
Просмотр исходного кода

Tests: Add test for other alignments.

Maciej Gołaszewski 8 лет назад
Родитель
Сommit
b0955cfd86
1 измененных файлов с 60 добавлено и 9 удалено
  1. 60 9
      packages/ckeditor5-alignment/tests/alignmentediting.js

+ 60 - 9
packages/ckeditor5-alignment/tests/alignmentediting.js

@@ -41,20 +41,71 @@ describe( 'AlignmentEditing', () => {
 		expect( doc.schema.check( { name: '$block', inside: '$root', attributes: 'alignment' } ) ).to.be.true;
 	} );
 
-	// describe('alignLef')
+	describe( 'alignLeft', () => {
+		it( 'adds converters to the data pipeline', () => {
+			const data = '<p style="text-align:left;">x</p>';
 
-	it( 'adds converters to the data pipeline', () => {
-		const data = '<p style="text-align:center;">x</p>';
+			editor.setData( data );
 
-		editor.setData( data );
+			expect( getModelData( doc ) ).to.equal( '<paragraph alignment="left">[]x</paragraph>' );
+			expect( editor.getData() ).to.equal( data );
+		} );
 
-		expect( getModelData( doc ) ).to.equal( '<paragraph alignment="center">[]x</paragraph>' );
-		expect( editor.getData() ).to.equal( data );
+		it( 'adds a converter to the view pipeline', () => {
+			setModelData( doc, '<paragraph alignment="left">[]x</paragraph>' );
+
+			expect( editor.getData() ).to.equal( '<p style="text-align:left;">x</p>' );
+		} );
+	} );
+
+	describe( 'alignCenter', () => {
+		it( 'adds converters to the data pipeline', () => {
+			const data = '<p style="text-align:center;">x</p>';
+
+			editor.setData( data );
+
+			expect( getModelData( doc ) ).to.equal( '<paragraph alignment="center">[]x</paragraph>' );
+			expect( editor.getData() ).to.equal( data );
+		} );
+
+		it( 'adds a converter to the view pipeline', () => {
+			setModelData( doc, '<paragraph alignment="center">[]x</paragraph>' );
+
+			expect( editor.getData() ).to.equal( '<p style="text-align:center;">x</p>' );
+		} );
+	} );
+
+	describe( 'alignRight', () => {
+		it( 'adds converters to the data pipeline', () => {
+			const data = '<p style="text-align:right;">x</p>';
+
+			editor.setData( data );
+
+			expect( getModelData( doc ) ).to.equal( '<paragraph alignment="right">[]x</paragraph>' );
+			expect( editor.getData() ).to.equal( data );
+		} );
+
+		it( 'adds a converter to the view pipeline', () => {
+			setModelData( doc, '<paragraph alignment="right">[]x</paragraph>' );
+
+			expect( editor.getData() ).to.equal( '<p style="text-align:right;">x</p>' );
+		} );
 	} );
 
-	it( 'adds a converter to the view pipeline', () => {
-		setModelData( doc, '<paragraph alignment="right">[]x</paragraph>' );
+	describe( 'alignJustify', () => {
+		it( 'adds converters to the data pipeline', () => {
+			const data = '<p style="text-align:justify;">x</p>';
+
+			editor.setData( data );
+
+			expect( getModelData( doc ) ).to.equal( '<paragraph alignment="justify">[]x</paragraph>' );
+			expect( editor.getData() ).to.equal( data );
+		} );
+
+		it( 'adds a converter to the view pipeline', () => {
+			setModelData( doc, '<paragraph alignment="justify">[]x</paragraph>' );
 
-		expect( editor.getData() ).to.equal( '<p style="text-align:right;">x</p>' );
+			expect( editor.getData() ).to.equal( '<p style="text-align:justify;">x</p>' );
+		} );
 	} );
 } );