浏览代码

Removed isNarrow state from RotatorView.

Oskar Wróbel 6 年之前
父节点
当前提交
d9a44e065e

+ 1 - 18
packages/ckeditor5-ui/src/panel/balloon/contextualballoon.js

@@ -272,7 +272,6 @@ export default class ContextualBalloon extends Plugin {
 		}
 
 		this.view.pin( this._getBalloonPosition() );
-		this._rotatorView.updateIsNarrow();
 		this._fakePanelsView.updatePosition();
 	}
 
@@ -494,13 +493,6 @@ class RotatorView extends View {
 		this.set( 'isNavigationVisible', true );
 
 		/**
-		 * Defines whether balloon should be marked as narrow or not.
-		 *
-		 * @member {Boolean} #isNarrow
-		 */
-		this.set( 'isNarrow', false );
-
-		/**
 		 * Used for checking if view is focused or not.
 		 *
 		 * @type {module:utils/focustracker~FocusTracker}
@@ -554,8 +546,7 @@ class RotatorView extends View {
 
 							attributes: {
 								class: [
-									'ck-balloon-rotator__counter',
-									bind.to( 'isNarrow', value => value ? 'ck-hidden' : '' )
+									'ck-balloon-rotator__counter'
 								]
 							},
 
@@ -589,13 +580,6 @@ class RotatorView extends View {
 	}
 
 	/**
-	 * Checks if view width is narrow and updated {@link ~RotatorView#isNarrow} state.
-	 */
-	updateIsNarrow() {
-		this.isNarrow = this.element.clientWidth <= 200;
-	}
-
-	/**
 	 * Shows given view.
 	 *
 	 * @param {module:ui/view~View} view The view to show.
@@ -603,7 +587,6 @@ class RotatorView extends View {
 	showView( view ) {
 		this.hideView();
 		this.content.add( view );
-		this.updateIsNarrow();
 	}
 
 	/**

+ 0 - 27
packages/ckeditor5-ui/tests/panel/balloon/contextualballoon.js

@@ -742,33 +742,6 @@ describe( 'ContextualBalloon', () => {
 			expect( counterElement.textContent ).to.equal( '2 of 2' );
 		} );
 
-		it( 'should hide counter when element width is less then 200px', () => {
-			// To be sure navigation is displayed.
-			balloon.add( {
-				view: viewB,
-				stackId: 'second'
-			} );
-
-			const counterElement = rotatorView.element.querySelector( '.ck-balloon-rotator__counter' );
-			let mockedWidth = 201;
-
-			sinon.stub( rotatorView.element, 'clientWidth' ).get( () => mockedWidth );
-
-			balloon.showStack( 'second' );
-
-			expect( counterElement.classList.contains( 'ck-hidden' ) ).to.equal( false );
-
-			mockedWidth = 200;
-			balloon.showStack( 'main' );
-
-			expect( counterElement.classList.contains( 'ck-hidden' ) ).to.equal( true );
-
-			mockedWidth = 201;
-			balloon.updatePosition();
-
-			expect( counterElement.classList.contains( 'ck-hidden' ) ).to.equal( false );
-		} );
-
 		it( 'should switch stack to the next one after clicking next button', () => {
 			balloon.add( {
 				view: viewB,