From 5a0f4ea07ce7aff09fe38ccd7b604ec6f5a08644 Mon Sep 17 00:00:00 2001 From: panr Date: Mon, 13 Jul 2020 16:17:44 +0200 Subject: [PATCH] Update unit tests. --- .../tests/imageresize/imageresizeui.js | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/ckeditor5-image/tests/imageresize/imageresizeui.js b/packages/ckeditor5-image/tests/imageresize/imageresizeui.js index e934271e32b..d0d1ad912b4 100644 --- a/packages/ckeditor5-image/tests/imageresize/imageresizeui.js +++ b/packages/ckeditor5-image/tests/imageresize/imageresizeui.js @@ -264,21 +264,38 @@ describe( 'ImageResizeUI', () => { expect( editor.ui.componentFactory.create( 'imageResize:50' ) ).to.be.instanceof( ButtonView ); } ); - it( 'should be created with invisible "50%" label when is provided', () => { - const buttonView = editor.ui.componentFactory.create( 'imageResize:50' ); + it( 'should be created with invisible "Resize image: 30%" label when is provided', async () => { + const editor = await ClassicTestEditor + .create( editorElement, { + plugins: [ Image, ImageStyle, Paragraph, Undo, Table, ImageResizeUI ], + image: { + resizeUnit: '%', + resizeOptions: [ { + name: 'imageResize:30', + value: '30', + label: 'Resize image: 30%', + icon: 'small' + } ], + toolbar: [ 'imageResize:30' ] + } + } ); + + const buttonView = editor.ui.componentFactory.create( 'imageResize:30' ); buttonView.render(); expect( buttonView.withText ).to.be.false; - expect( buttonView.label ).to.equal( '50%' ); + expect( buttonView.label ).to.equal( 'Resize image: 30%' ); expect( buttonView.labelView ).to.be.instanceOf( View ); + + editor.destroy(); } ); - it( 'should be created with invisible "50%" label when is not provided', async () => { + it( 'should be created with invisible "Resize image to 50%" label when is not provided', async () => { const buttonView = editor.ui.componentFactory.create( 'imageResize:50' ); buttonView.render(); expect( buttonView.withText ).to.be.false; - expect( buttonView.label ).to.equal( '50%' ); + expect( buttonView.label ).to.equal( 'Resize image to 50%' ); expect( buttonView.labelView ).to.be.instanceOf( View ); editor.destroy();