-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unused "parentDirectoryURI" prop in block editor settings
Added/updated unit tests Bad horsie
- Loading branch information
Showing
7 changed files
with
132 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { setBackgroundStyleDefaults } from '../background'; | ||
import { ROOT_BLOCK_SELECTOR } from '../../components/global-styles/utils'; | ||
|
||
describe( 'background', () => { | ||
describe( 'setBackgroundStyleDefaults', () => { | ||
it( 'should return the block styles if the block styles do not have a background', () => { | ||
const blockStyles = { color: 'red' }; | ||
expect( setBackgroundStyleDefaults( blockStyles ) ).toEqual( | ||
blockStyles | ||
); | ||
} ); | ||
|
||
it( 'should return the block styles if `background` is not an object', () => { | ||
const blockStyles = { background: 'red' }; | ||
expect( setBackgroundStyleDefaults( blockStyles ) ).toEqual( | ||
blockStyles | ||
); | ||
} ); | ||
|
||
it( 'should return the background size defaults', () => { | ||
const blockStyles = { | ||
background: { backgroundImage: 'some-image.jpg' }, | ||
}; | ||
expect( setBackgroundStyleDefaults( blockStyles ) ).toEqual( { | ||
background: { | ||
backgroundImage: 'some-image.jpg', | ||
backgroundSize: 'cover', | ||
}, | ||
} ); | ||
} ); | ||
|
||
it( 'should return an absolute theme URL path', () => { | ||
const blockStyles = { | ||
background: { | ||
backgroundImage: { | ||
source: 'theme', | ||
url: '/some-image.jpg', | ||
}, | ||
}, | ||
}; | ||
const options = { themeDirURI: 'http://example.com' }; | ||
expect( | ||
setBackgroundStyleDefaults( blockStyles, options ) | ||
).toEqual( { | ||
background: { | ||
backgroundImage: { | ||
source: 'theme', | ||
url: 'http://example.com/some-image.jpg', | ||
}, | ||
backgroundSize: 'cover', | ||
}, | ||
} ); | ||
} ); | ||
|
||
it( 'should not add background size defaults for root selector', () => { | ||
const blockStyles = { | ||
background: { | ||
backgroundImage: { | ||
source: 'theme', | ||
url: '/some-image.jpg', | ||
}, | ||
}, | ||
}; | ||
const options = { | ||
themeDirURI: 'http://example.com', | ||
selector: ROOT_BLOCK_SELECTOR, | ||
}; | ||
expect( | ||
setBackgroundStyleDefaults( blockStyles, options ) | ||
).toEqual( { | ||
background: { | ||
backgroundImage: { | ||
source: 'theme', | ||
url: 'http://example.com/some-image.jpg', | ||
}, | ||
}, | ||
} ); | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters