Przeglądaj źródła

Tests: Fixed to.be.equal() use.

Piotrek Koszuliński 5 lat temu
rodzic
commit
f6685baea3

+ 9 - 9
packages/ckeditor5-widget/tests/widgetresize.js

@@ -84,7 +84,7 @@ describe( 'WidgetResize', () => {
 
 			resizerMouseSimulator.dragTo( editor, domParts.resizeHandle, finalPointerPosition );
 
-			expect( commitStub.callCount ).to.be.equal( 1 );
+			expect( commitStub.callCount ).to.equal( 1 );
 			sinon.assert.calledWithExactly( commitStub, '120px' );
 		} );
 
@@ -97,7 +97,7 @@ describe( 'WidgetResize', () => {
 			document.body.dispatchEvent( event );
 
 			// Ensure nothing got called.
-			expect( plugin._mouseDownListener.callCount ).to.be.equal( 0 );
+			expect( plugin._mouseDownListener.callCount ).to.equal( 0 );
 		} );
 
 		it( 'nothing bad happens if activeResizer got unset', () => {
@@ -166,7 +166,7 @@ describe( 'WidgetResize', () => {
 				resizerMouseSimulator.dragTo( editor, domParts.resizeHandle, finalPointerPosition );
 				sinon.assert.calledWithExactly( commitStub.secondCall, '200px' );
 
-				expect( commitStub.callCount ).to.be.equal( 2 );
+				expect( commitStub.callCount ).to.equal( 2 );
 			} );
 
 			it( 'shrinks correctly with left-bottom handler', generateResizeTest( {
@@ -322,7 +322,7 @@ describe( 'WidgetResize', () => {
 				resizerMouseSimulator.dragTo( editor, domParts.resizeHandle, finalPointerPosition );
 				sinon.assert.calledWithExactly( commitStub.secondCall, '75%' );
 
-				expect( commitStub.callCount ).to.be.equal( 2 );
+				expect( commitStub.callCount ).to.equal( 2 );
 			} );
 
 			it( 'shrinks correctly with bottom-left handler', generateResizeTest( {
@@ -408,7 +408,7 @@ describe( 'WidgetResize', () => {
 
 			resizerMouseSimulator.dragTo( editor, domParts.resizeHandle, finalPointerPosition );
 
-			expect( renderListener.callCount ).to.be.equal( 1 );
+			expect( renderListener.callCount ).to.equal( 1 );
 		} );
 
 		it( 'returns proper value when resize host is different from widget wrapper', () => {
@@ -430,7 +430,7 @@ describe( 'WidgetResize', () => {
 
 			resizerMouseSimulator.dragTo( editor, domParts.resizeHandle, finalPointerPosition );
 			expect( commitStub.callCount, 'call count' ).to.be.eql( 1 );
-			expect( commitStub.args[ 0 ][ 0 ], 'width' ).to.be.equal( expectedWidth );
+			expect( commitStub.args[ 0 ][ 0 ], 'width' ).to.equal( expectedWidth );
 			sinon.assert.calledOnce( commitStub );
 		} );
 
@@ -496,7 +496,7 @@ describe( 'WidgetResize', () => {
 				writer.setSelection( widgetModel, 'on' );
 			} );
 
-			expect( redrawSpy.callCount ).to.be.equal( 1 );
+			expect( redrawSpy.callCount ).to.equal( 1 );
 		} );
 	} );
 
@@ -518,7 +518,7 @@ describe( 'WidgetResize', () => {
 			resizer.cancel();
 
 			// Value should be restored to the initial value (#6060).
-			expect( widget.getStyle( 'width' ) ).to.be.equal( INITIAL_WIDGET_WIDTH );
+			expect( widget.getStyle( 'width' ) ).to.equal( INITIAL_WIDGET_WIDTH );
 		} );
 	} );
 
@@ -551,7 +551,7 @@ describe( 'WidgetResize', () => {
 
 			resizerMouseSimulator.dragTo( editor, domParts.resizeHandle, finalPointerPosition );
 			expect( commitStub.callCount, 'call count' ).to.be.eql( 1 );
-			expect( commitStub.args[ 0 ][ 0 ], 'width' ).to.be.equal( options.expectedWidth );
+			expect( commitStub.args[ 0 ][ 0 ], 'width' ).to.equal( options.expectedWidth );
 			sinon.assert.calledOnce( commitStub );
 		};
 	}

+ 13 - 13
packages/ckeditor5-widget/tests/widgetresize/resizer.js

@@ -73,12 +73,12 @@ describe( 'Resizer', () => {
 			];
 
 			for ( const selector of handleSelectors ) {
-				expect( renderedElement.querySelectorAll( selector ).length, `Selector "${ selector }" matches` ).to.be.equal( 1 );
+				expect( renderedElement.querySelectorAll( selector ).length, `Selector "${ selector }" matches` ).to.equal( 1 );
 			}
 		} );
 
 		it( 'renders sizeUi', () => {
-			expect( renderedElement.querySelectorAll( '.ck-size-view' ).length ).to.be.equal( 1 );
+			expect( renderedElement.querySelectorAll( '.ck-size-view' ).length ).to.equal( 1 );
 		} );
 	} );
 
@@ -89,7 +89,7 @@ describe( 'Resizer', () => {
 			resizerInstance.attach();
 
 			const domResizeeWrapper = resizerInstance._viewResizerWrapper.render( document );
-			expect( domResizeeWrapper.style.display ).to.be.equal( 'none' );
+			expect( domResizeeWrapper.style.display ).to.equal( 'none' );
 		} );
 
 		it( 'hides the resizer if it gets disabled at a runtime', () => {
@@ -99,7 +99,7 @@ describe( 'Resizer', () => {
 			const domResizeeWrapper = resizerInstance._viewResizerWrapper.render( document );
 
 			resizerInstance.isEnabled = false;
-			expect( domResizeeWrapper.style.display ).to.be.equal( 'none' );
+			expect( domResizeeWrapper.style.display ).to.equal( 'none' );
 		} );
 
 		it( 'restores the resizer if it gets enabled at a runtime', () => {
@@ -109,7 +109,7 @@ describe( 'Resizer', () => {
 			const domResizeeWrapper = resizerInstance._viewResizerWrapper.render( document );
 
 			resizerInstance.isEnabled = true;
-			expect( domResizeeWrapper.style.display ).to.be.equal( '' );
+			expect( domResizeeWrapper.style.display ).to.equal( '' );
 		} );
 	} );
 
@@ -158,9 +158,9 @@ describe( 'Resizer', () => {
 				pageY: 50
 			} );
 
-			expect( proposedSize.width, 'width' ).to.be.equal( 60 );
-			expect( proposedSize.height, 'height' ).to.be.equal( 60 );
-			expect( proposedSize.widthPercents, 'widthPercents' ).to.be.equal( 15 );
+			expect( proposedSize.width, 'width' ).to.equal( 60 );
+			expect( proposedSize.height, 'height' ).to.equal( 60 );
+			expect( proposedSize.widthPercents, 'widthPercents' ).to.equal( 15 );
 		} );
 
 		it( 'enlarges objects correctly', () => {
@@ -171,9 +171,9 @@ describe( 'Resizer', () => {
 				pageY: 50
 			} );
 
-			expect( proposedSize.width, 'width' ).to.be.equal( 50 );
-			expect( proposedSize.height, 'height' ).to.be.equal( 50 );
-			expect( proposedSize.widthPercents, 'widthPercents' ).to.be.equal( 12.5 );
+			expect( proposedSize.width, 'width' ).to.equal( 50 );
+			expect( proposedSize.height, 'height' ).to.equal( 50 );
+			expect( proposedSize.widthPercents, 'widthPercents' ).to.equal( 12.5 );
 		} );
 
 		it( 'rounds returned width and height properties', () => {
@@ -182,8 +182,8 @@ describe( 'Resizer', () => {
 				pageY: 50.000000000002
 			} );
 
-			expect( proposedSize.width, 'width' ).to.be.equal( 60 );
-			expect( proposedSize.height, 'height' ).to.be.equal( 60 );
+			expect( proposedSize.width, 'width' ).to.equal( 60 );
+			expect( proposedSize.height, 'height' ).to.equal( 60 );
 		} );
 	} );
 

+ 10 - 10
packages/ckeditor5-widget/tests/widgetresize/resizerstate.js

@@ -67,14 +67,14 @@ describe( 'ResizerState', () => {
 			const state = new ResizerState();
 			state.begin( domResizeHandle, domHandleHost, domResizeHost );
 
-			expect( state.activeHandlePosition, 'activeHandlePosition' ).to.be.equal( 'bottom-right' );
+			expect( state.activeHandlePosition, 'activeHandlePosition' ).to.equal( 'bottom-right' );
 
-			expect( state.originalWidth, 'originalWidth' ).to.be.equal( 400 );
-			expect( state.originalHeight, 'originalHeight' ).to.be.equal( 200 );
+			expect( state.originalWidth, 'originalWidth' ).to.equal( 400 );
+			expect( state.originalHeight, 'originalHeight' ).to.equal( 200 );
 
-			expect( state.aspectRatio, 'aspectRatio' ).to.be.equal( 2 );
+			expect( state.aspectRatio, 'aspectRatio' ).to.equal( 2 );
 
-			expect( state.originalWidthPercents, 'originalWidthPercents' ).to.be.equal( 25 );
+			expect( state.originalWidthPercents, 'originalWidthPercents' ).to.equal( 25 );
 		} );
 	} );
 
@@ -90,11 +90,11 @@ describe( 'ResizerState', () => {
 				handleHostHeight: 160
 			} );
 
-			expect( state.proposedWidthPercents, 'proposedWidthPercents' ).to.be.equal( 25 );
-			expect( state.proposedWidth, 'proposedWidth' ).to.be.equal( 100 );
-			expect( state.proposedHeight, 'proposedHeight' ).to.be.equal( 200 );
-			expect( state.proposedHandleHostWidth, 'proposedHandleHostWidth' ).to.be.equal( 80 );
-			expect( state.proposedHandleHostHeight, 'proposedHandleHostHeight' ).to.be.equal( 160 );
+			expect( state.proposedWidthPercents, 'proposedWidthPercents' ).to.equal( 25 );
+			expect( state.proposedWidth, 'proposedWidth' ).to.equal( 100 );
+			expect( state.proposedHeight, 'proposedHeight' ).to.equal( 200 );
+			expect( state.proposedHandleHostWidth, 'proposedHandleHostWidth' ).to.equal( 80 );
+			expect( state.proposedHandleHostHeight, 'proposedHandleHostHeight' ).to.equal( 160 );
 		} );
 	} );
 } );