Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Tests: Added test for render count.
Browse files Browse the repository at this point in the history
As requested in #122 (comment).
  • Loading branch information
mlewand committed Apr 22, 2020
1 parent 5991e03 commit de2922f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tests/widgetresize.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,19 @@ describe( 'WidgetResize', () => {
it( 'restores the original view width after resize is done', () => {
// Note that ultimately width should be changed, but through a model converter, not with direct view changes (#6060).
createResizer();
const renderListener = sinon.stub();

const usedHandle = 'bottom-right';
const domParts = getWidgetDomParts( editor, widget, usedHandle );
const finalPointerPosition = getHandleCenterPoint( domParts.widget, usedHandle ).moveBy( 40, 40 );

editor.editing.view.on( 'render', renderListener );

resizerMouseSimulator.dragTo( editor, domParts.resizeHandle, finalPointerPosition );

expect( widget.getStyle( 'width' ) ).to.equal( INITIAL_WIDGET_WIDTH );
// Verify render count https://github.com/ckeditor/ckeditor5-widget/pull/122#issuecomment-617012777.
expect( renderListener.callCount ).to.be.equal( 3 );
} );

it( 'returns proper value when resize host is different from widget wrapper', () => {
Expand Down

0 comments on commit de2922f

Please sign in to comment.