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

Removed deregister and isRegistered functions.

Maciej Bukowski 7 лет назад
Родитель
Сommit
f3f423ba8e

+ 0 - 31
packages/ckeditor5-widget/src/widgettoolbarrepository.js

@@ -124,37 +124,6 @@ export default class WidgetToolbarRepository extends Plugin {
 	}
 
 	/**
-	 * Removes toolbar with the given toolbarId.
-	 *
-	 * @param {String} toolbarId Toolbar identificator.
-	 */
-	deregister( toolbarId ) {
-		const toolbar = this._toolbars.get( toolbarId );
-
-		if ( !toolbar ) {
-			/**
-			 * Toolbar with the given id was already added.
-			 *
-			 * @error widget-toolbar-does-not-exist
-			 * @param toolbarId Toolbar id.
-			 */
-			throw new CKEditorError( 'widget-toolbar-does-not-exist', { toolbarId } );
-		}
-
-		this._hideToolbar( toolbar );
-		this._toolbars.delete( toolbarId );
-	}
-
-	/**
-	 * Returns `true` when a toolbar with the given id is present in the widget toolbar repository.
-	 *
-	 * @param {String} toolbarId Toolbar identificator.
-	 */
-	isRegistered( toolbarId ) {
-		return this._toolbars.has( toolbarId );
-	}
-
-	/**
 	 * Iterates over stored toolbars and makes them visible or hidden.
 	 *
 	 * @private

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

@@ -82,50 +82,6 @@ describe( 'WidgetToolbar', () => {
 		} );
 	} );
 
-	describe( 'deregister', () => {
-		it( 'should remove given widget toolbar', () => {
-			widgetToolbarRepository.register( 'fake', {
-				toolbarItems: editor.config.get( 'fake.toolbar' ),
-				visibleWhen: () => false
-			} );
-
-			widgetToolbarRepository.deregister( 'fake' );
-
-			expect( widgetToolbarRepository._toolbars.size ).to.equal( 0 );
-		} );
-
-		it( 'should throw an error if a toolbar does not exist', () => {
-			widgetToolbarRepository.register( 'foo', {
-				toolbarItems: editor.config.get( 'fake.toolbar' ),
-				visibleWhen: () => false
-			} );
-
-			expect( () => {
-				widgetToolbarRepository.deregister( 'bar' );
-			} ).to.throw( CKEditorError, /^widget-toolbar-does-not-exist/ );
-		} );
-	} );
-
-	describe( 'isRegistered', () => {
-		it( 'should return `true` when a toolbar with given id was added', () => {
-			widgetToolbarRepository.register( 'foo', {
-				toolbarItems: editor.config.get( 'fake.toolbar' ),
-				visibleWhen: () => false
-			} );
-
-			expect( widgetToolbarRepository.isRegistered( 'foo' ) ).to.be.true;
-		} );
-
-		it( 'should return `false` when a toolbar with given id was not added', () => {
-			widgetToolbarRepository.register( 'foo', {
-				toolbarItems: editor.config.get( 'fake.toolbar' ),
-				visibleWhen: () => false
-			} );
-
-			expect( widgetToolbarRepository.isRegistered( 'bar' ) ).to.be.false;
-		} );
-	} );
-
 	describe( 'integration tests', () => {
 		beforeEach( () => {
 			editor.ui.focusTracker.isFocused = true;