|
|
@@ -230,76 +230,6 @@ describe( 'ImageResize', () => {
|
|
|
} );
|
|
|
} );
|
|
|
|
|
|
- describe( 'percent resizing', () => {
|
|
|
- beforeEach( () => createEditor( {
|
|
|
- plugins: [ Image, ImageStyle, Paragraph, Undo, Table, ImageResize ]
|
|
|
- } ) );
|
|
|
-
|
|
|
- describe( 'standard image', () => {
|
|
|
- beforeEach( () => {
|
|
|
- setData( editor.model, `<paragraph>foo</paragraph>[<image src="${ IMAGE_SRC_FIXTURE }"></image>]` );
|
|
|
-
|
|
|
- widget = viewDocument.getRoot().getChild( 1 );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'shrinks correctly with left-bottom handler', generateResizeTest( {
|
|
|
- expectedWidth: 16,
|
|
|
- modelRegExp: /<paragraph>foo<\/paragraph><image src=".+?" width="([\d]{2}(?:\.[\d]{1,2}))%"><\/image>/,
|
|
|
- pointerOffset: {
|
|
|
- x: 10,
|
|
|
- y: -10
|
|
|
- },
|
|
|
- resizerPosition: 'bottom-left'
|
|
|
- } ) );
|
|
|
-
|
|
|
- it( 'enlarges correctly with right-bottom handler', generateResizeTest( {
|
|
|
- expectedWidth: 22,
|
|
|
- modelRegExp: /<paragraph>foo<\/paragraph><image src=".+?" width="([\d]{2}(?:\.[\d]{1,2}))%"><\/image>/,
|
|
|
- pointerOffset: {
|
|
|
- x: 0,
|
|
|
- y: 5
|
|
|
- },
|
|
|
- resizerPosition: 'bottom-right'
|
|
|
- } ) );
|
|
|
-
|
|
|
- it( 'enlarges correctly an image with unsupported width unit', async () => {
|
|
|
- setData( editor.model, `<paragraph>foo</paragraph>[<image src="${ IMAGE_SRC_FIXTURE }" width="50pt"></image>]` );
|
|
|
-
|
|
|
- widget = viewDocument.getRoot().getChild( 1 );
|
|
|
-
|
|
|
- await generateResizeTest( {
|
|
|
- expectedWidth: 15,
|
|
|
- modelRegExp: /<paragraph>foo<\/paragraph><image src=".+?" width="([\d]{2}(?:\.[\d]{1,2}))%"><\/image>/,
|
|
|
- pointerOffset: {
|
|
|
- x: 0,
|
|
|
- y: 5
|
|
|
- },
|
|
|
- resizerPosition: 'bottom-right'
|
|
|
- } )();
|
|
|
- } );
|
|
|
- } );
|
|
|
-
|
|
|
- describe( 'side image', () => {
|
|
|
- beforeEach( () => {
|
|
|
- setData( editor.model, `<paragraph>foo</paragraph>[<image imageStyle="side" src="${ IMAGE_SRC_FIXTURE }"></image>]` );
|
|
|
-
|
|
|
- view = editor.editing.view;
|
|
|
- viewDocument = view.document;
|
|
|
- widget = viewDocument.getRoot().getChild( 1 );
|
|
|
- } );
|
|
|
-
|
|
|
- it( 'shrinks correctly with left-bottom handler', generateResizeTest( {
|
|
|
- expectedWidth: 18,
|
|
|
- modelRegExp: /<paragraph>foo<\/paragraph><image imageStyle="side" src=".+?" width="([\d]{2}(?:\.[\d]{1,2}))%"><\/image>/,
|
|
|
- pointerOffset: {
|
|
|
- x: 10,
|
|
|
- y: -10
|
|
|
- },
|
|
|
- resizerPosition: 'bottom-left'
|
|
|
- } ) );
|
|
|
- } );
|
|
|
- } );
|
|
|
-
|
|
|
describe( 'undo integration', () => {
|
|
|
beforeEach( () => createEditor() );
|
|
|
|