File size: 812 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/**
 * @jest-environment jsdom
 */
import { render, screen } from '@testing-library/react';
import { ImageEditorCanvas } from '../image-editor-canvas';

jest.mock( 'calypso/blocks/image-editor/image-editor-crop', () => () => (
	<div data-testid="image-editor-crop-mock" />
) );

describe( 'ImageEditorToolbar', () => {
	test( 'should render cropping area when the image meets the minimum height and width', () => {
		render( <ImageEditorCanvas isImageLoaded showCrop /> );
		expect( screen.queryByTestId( 'image-editor-crop-mock' ) ).toBeDefined();
	} );

	test( 'should not render cropping area when the image is smaller than the minimum dimensions', () => {
		render( <ImageEditorCanvas isImageLoaded showCrop={ false } /> );
		expect( screen.queryByTestId( 'image-editor-crop-mock' ) ).toBeNull();
	} );
} );