diff --git a/src/blocks/counter/index.php b/src/blocks/counter/index.php index 3846e7c1578..416b58a7d5c 100644 --- a/src/blocks/counter/index.php +++ b/src/blocks/counter/index.php @@ -17,12 +17,14 @@ function coblocks_counter_register_block_patterns() { 'title' => __( 'Counter and Icon block Group', 'coblocks' ), 'blockTypes' => array( 'core/group', 'coblocks/counter', 'coblocks/icon' ), 'content' => '
1000
Hours Worked
', + 'categories' => array( 'coblocks' ), ); $multi_digits_array = array( 'title' => __( 'Counter with multiple inline digits', 'coblocks' ), 'blockTypes' => array( 'coblocks/counter' ), 'content' => '
10 days, 20 hours
Since Last Incident
', + 'categories' => array( 'coblocks' ), ); if ( $should_include_viewport ) { @@ -35,6 +37,13 @@ function coblocks_counter_register_block_patterns() { register_block_pattern( 'counter/with-icon', $icon_array ); register_block_pattern( 'counter/with-multiple-digits', $multi_digits_array ); + register_block_pattern_category( + 'coblocks', + array( + 'label' => 'Coblocks', + 'description' => 'Coblocks Patterns', + ) + ); } add_action( 'init', 'coblocks_counter_register_block_patterns' ); diff --git a/src/utils/duplicate-pattern.cypress.js b/src/utils/duplicate-pattern.cypress.js new file mode 100644 index 00000000000..1d2479e632e --- /dev/null +++ b/src/utils/duplicate-pattern.cypress.js @@ -0,0 +1,21 @@ +import { isWP65AtLeast } from '../../.dev/tests/cypress/helpers'; + +describe( 'Category for CoBlocks patterns', () => { + beforeEach( () => { + cy.visit( Cypress.env( 'testURL' ) + '/wp-admin/site-editor.php?path=%2Fpatterns&categoryType=pattern&categoryId=coblocks' ); + } ); + + it( 'can be duplicated without errors', () => { + cy.get( '[aria-label="Actions"]' ).first().click(); + + cy.get( '[role="menuitem"]' ).contains( 'Duplicate' ).click( { force: true } ); + + if ( isWP65AtLeast() ) { + cy.get( '.components-modal__header-heading-container' ).contains( 'Duplicate pattern' ); + + cy.get( '.components-button.is-primary ' ).contains( 'Duplicate' ).click(); + } + + cy.get( '.components-snackbar__content' ).contains( 'duplicated' ); + } ); +} );