Przeglądaj źródła

Renamed isViewInStack to hasView.

Oskar Wróbel 8 lat temu
rodzic
commit
2edbc5b9bd

+ 3 - 3
packages/ckeditor5-ui/src/contextualballoon.js

@@ -73,7 +73,7 @@ export default class ContextualBalloon extends Plugin {
 	 * @param {module:ui/view~View} view
 	 * @returns {Boolean}
 	 */
-	isViewInStack( view ) {
+	hasView( view ) {
 		return this._stack.has( view );
 	}
 
@@ -83,7 +83,7 @@ export default class ContextualBalloon extends Plugin {
 	 * @param {module:ui/contextualballoon~ViewConfig} data Configuration of the view.
 	 */
 	add( data ) {
-		if ( this.isViewInStack( data.view ) ) {
+		if ( this.hasView( data.view ) ) {
 			/**
 			 * Trying to add configuration of the same view more than once.
 			 *
@@ -112,7 +112,7 @@ export default class ContextualBalloon extends Plugin {
 	 * @param {module:ui/view~View} view A view to be removed from the balloon.
 	 */
 	remove( view ) {
-		if ( !this.isViewInStack( view ) ) {
+		if ( !this.hasView( view ) ) {
 			/**
 			 * Trying to remove configuration of the view not defined in the stack.
 			 *

+ 4 - 4
packages/ckeditor5-ui/tests/contextualballoon.js

@@ -59,14 +59,14 @@ describe( 'ContextualBalloon', () => {
 		} );
 	} );
 
-	describe( 'isViewInStack()', () => {
+	describe( 'hasView()', () => {
 		it( 'should return true when given view is in stack', () => {
 			balloon.add( {
 				view: viewA,
 				position: { target: 'fake' }
 			} );
 
-			expect( balloon.isViewInStack( viewA ) ).to.true;
+			expect( balloon.hasView( viewA ) ).to.true;
 		} );
 
 		it( 'should return true when given view is in stack but is not visible', () => {
@@ -81,11 +81,11 @@ describe( 'ContextualBalloon', () => {
 			} );
 
 			expect( balloon.visible.view === viewB ).to.true;
-			expect( balloon.isViewInStack( viewA ) ).to.true;
+			expect( balloon.hasView( viewA ) ).to.true;
 		} );
 
 		it( 'should return false when given view is not in stack', () => {
-			expect( balloon.isViewInStack( viewA ) ).to.false;
+			expect( balloon.hasView( viewA ) ).to.false;
 		} );
 	} );
 

+ 3 - 3
packages/ckeditor5-ui/tests/manual/contextualballoon/contextualballoon.js

@@ -157,7 +157,7 @@ class PluginGeneric extends Plugin {
 	}
 
 	_showPanel() {
-		if ( this._balloon.isViewInStack( this.view ) ) {
+		if ( this._balloon.hasView( this.view ) ) {
 			return;
 		}
 
@@ -172,7 +172,7 @@ class PluginGeneric extends Plugin {
 	}
 
 	_hidePanel() {
-		if ( !this._balloon.isViewInStack( this.view ) ) {
+		if ( !this._balloon.hasView( this.view ) ) {
 			return;
 		}
 
@@ -265,7 +265,7 @@ function createContextualToolbar( editor ) {
 
 	// Remove toolbar from balloon.
 	function close() {
-		if ( balloon.isViewInStack( toolbar ) ) {
+		if ( balloon.hasView( toolbar ) ) {
 			balloon.remove( toolbar );
 		}
 	}