Sfoglia il codice sorgente

Add test for cusotm label.

Mateusz Samsel 6 anni fa
parent
commit
9cd611b301
1 ha cambiato i file con 16 aggiunte e 0 eliminazioni
  1. 16 0
      packages/ckeditor5-widget/tests/widgettoolbarrepository.js

+ 16 - 0
packages/ckeditor5-widget/tests/widgettoolbarrepository.js

@@ -104,6 +104,22 @@ describe( 'WidgetToolbarRepository', () => {
 
 			toolbarView.destroy();
 		} );
+
+		it( 'should create custom aria-label if is provided', () => {
+			widgetToolbarRepository.register( 'fake', {
+				items: editor.config.get( 'fake.toolbar' ),
+				getRelatedElement: () => null,
+				ariaLabel: 'Custom label'
+			} );
+
+			const toolbarView = widgetToolbarRepository._toolbarDefinitions.get( 'fake' ).view;
+
+			toolbarView.render();
+
+			expect( toolbarView.element.getAttribute( 'aria-label' ) ).to.equal( 'Custom label' );
+
+			toolbarView.destroy();
+		} );
 	} );
 
 	describe( 'integration tests', () => {