Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix disappearing buttons inside of Services blocks #2613

Merged
merged 2 commits into from
Jun 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update cypress test to reflect change
  • Loading branch information
jgutierrezmoren-godaddy committed Jun 10, 2024
commit 30f429b9b5625071db482eb6773e5836e3b92e75
20 changes: 15 additions & 5 deletions src/blocks/services/test/services.cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,31 @@ describe( 'Test CoBlocks Services Block', function() {
} );

/**
* Test that we can add a services block to the content, enable
* action buttons and are able to successfully save the block without errors.
* Test that we can add a services block to the content with a nested button block
* and are able to successfully save the services and button blocks without errors.
*/
it( 'Test services block saves with action buttons enabled.', function() {
it( 'Test services block saves after adding button', function() {
helpers.addBlockToPost( 'coblocks/services', true );

cy.get( 'div.wp-block-button' ).should( 'not.exist' );

helpers.toggleSettingCheckbox( /display buttons/i );
const servicesBlock = cy.get( '[data-type="coblocks/services"]' );

cy.get( '.wp-block-buttons' ).should( 'have.length', 2 );
// Select the first child paragraph block of the parent services block
const servicesBlockParagraph = servicesBlock.find( '[data-type="core/paragraph"]' ).first();

// Insert a new buttons block into the services block
servicesBlockParagraph.click().type( '/buttons' ).type( '{enter}' );

cy.get( 'div.wp-block-button' ).should( 'exist' );

// Check ability to save page without errors
helpers.savePage();

helpers.checkForBlockErrors( 'coblocks/services' );

// Check button persists after saving
cy.get( 'div.wp-block-button' ).should( 'exist' );
} );

/**
Expand Down
Loading