@wordpress/block-editor
Version:
40 lines (34 loc) • 879 B
JavaScript
/**
* Internal dependencies
*/
import { hasBackgroundImageValue } from '../background-panel';
describe( 'hasBackgroundImageValue', () => {
it( 'should return `true` when id and url exist', () => {
expect(
hasBackgroundImageValue( {
background: { backgroundImage: { id: 1, url: 'url' } },
} )
).toBe( true );
} );
it( 'should return `true` when only url exists', () => {
expect(
hasBackgroundImageValue( {
background: { backgroundImage: { url: 'url' } },
} )
).toBe( true );
} );
it( 'should return `true` when only id exists', () => {
expect(
hasBackgroundImageValue( {
background: { backgroundImage: { id: 1 } },
} )
).toBe( true );
} );
it( 'should return `false` when id and url do not exist', () => {
expect(
hasBackgroundImageValue( {
background: { backgroundImage: {} },
} )
).toBe( false );
} );
} );