Răsfoiți Sursa

Test checking if autoformat is disabled for headings that are not configured.

Szymon Kupś 8 ani în urmă
părinte
comite
fab4eab3f5
1 a modificat fișierele cu 23 adăugiri și 0 ștergeri
  1. 23 0
      packages/ckeditor5-autoformat/tests/autoformat.js

+ 23 - 0
packages/ckeditor5-autoformat/tests/autoformat.js

@@ -220,5 +220,28 @@ describe( 'Autoformat', () => {
 
 			expect( getData( doc ) ).to.equal( '<paragraph>*foobar*[]</paragraph>' );
 		} );
+
+		it( 'should use only configured headings', () => {
+			return VirtualTestEditor.create( {
+				plugins: [ Enter, Paragraph, Autoformat, ListEngine, HeadingEngine ],
+				heading: {
+					options: [
+						{ modelElement: 'paragraph' },
+						{ modelElement: 'heading1', viewElement: 'h2' }
+					]
+				}
+			} )
+			.then( editor => {
+				doc = editor.document;
+				batch = doc.batch();
+
+				setData( doc, '<paragraph>##[]</paragraph>' );
+				doc.enqueueChanges( () => {
+					batch.insert( doc.selection.getFirstPosition(), ' ' );
+				} );
+
+				expect( getData( doc ) ).to.equal( '<paragraph>## []</paragraph>' );
+			} );
+		} );
 	} );
 } );