-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blocks: Add initial API for Block Patterns (#18270)
* Blocks: Add initial API for Block Patterns * Update packages/blocks/src/api/registration.js * Convert all public APIs to experimental * Expose block patterns registration APIs * Fix typo in the name of selector * Blocks: Update Patterns API integration with the store * Update packages/blocks/src/store/selectors.js Co-Authored-By: Andrew Duthie <[email protected]>
- Loading branch information
Showing
8 changed files
with
300 additions
and
17 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
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,43 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { | ||
__experimentalAddBlockPatterns, | ||
__experimentalRemoveBlockPatterns, | ||
} from '../actions'; | ||
|
||
describe( 'actions', () => { | ||
describe( 'addBlockPatterns', () => { | ||
const blockName = 'block/name'; | ||
const patternName = 'my-pattern'; | ||
|
||
it( 'should return the ADD_BLOCK_PATTERNS action', () => { | ||
const pattern = { | ||
name: patternName, | ||
label: 'My Pattern', | ||
attributes: { | ||
example: 'foo', | ||
}, | ||
}; | ||
const result = __experimentalAddBlockPatterns( blockName, pattern ); | ||
expect( result ).toEqual( { | ||
type: 'ADD_BLOCK_PATTERNS', | ||
patterns: [ | ||
pattern, | ||
], | ||
blockName, | ||
} ); | ||
} ); | ||
|
||
it( 'should return the REMOVE_BLOCK_PATTERNS action', () => { | ||
const result = __experimentalRemoveBlockPatterns( blockName, patternName ); | ||
expect( result ).toEqual( { | ||
type: 'REMOVE_BLOCK_PATTERNS', | ||
patternNames: [ | ||
patternName, | ||
], | ||
blockName, | ||
} ); | ||
} ); | ||
} ); | ||
} ); |
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
Oops, something went wrong.