Skip to content

Commit

Permalink
Introduce bail check when missing DOMDocument (#2619)
Browse files Browse the repository at this point in the history
* Start work to support WP 6.6 in the tests

* Extract sidebar class

* Escape the HTML in the editor of the posts and post carousel blocks

* Bump PHP unit to use WordPress 6.6

* Add 6.6 to e2e tests

* Fix selector of e2e helper savePage()

* introduce bail check when missing DOMDocument

* Change selector in services block test

* Change selector in services block test

* Add space to trigger services block test

* Revert test changes

* fix service block tests

---------

Co-authored-by: Olivier Lafleur <olafleur@godaddy.com>
Co-authored-by: Evan Herman <evan.m.herman@gmail.com>
Co-authored-by: aledesma-godaddy <aledesma@godaddy.com>
  • Loading branch information
4 people authored Jul 25, 2024
1 parent 2046d80 commit ab584a5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions includes/block-migrate/loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ function( WP_Post &$post ) {
return;
}

// Bail if DOMDocument is not available.
if ( ! class_exists( 'DOMDocument' ) ) {
return;
}

// Parse the blocks so we can search them in a standard way.
$parsed_blocks = parse_blocks( $post->post_content );

Expand Down
5 changes: 3 additions & 2 deletions src/blocks/services/test/services.cypress.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,16 @@ describe( 'Test CoBlocks Services Block', function() {
it( 'Test service block has the proper arrow orientation.', function() {
helpers.addBlockToPost( 'coblocks/services', true );

cy.get( '.edit-post-visual-editor [data-type="coblocks/service"]:first-child' ).click();
// helpers.selectBlock('service');
cy.get( '.edit-post-visual-editor [data-type="coblocks/service"]:first-child' ).focus();
cy.get( 'div.block-editor-block-mover' ).should( 'have.class', 'is-horizontal' );

// Select parent block
helpers.selectBlock( 'services' );

helpers.setInputValue( 'Services settings', 'Columns', 1, false );

cy.get( '.edit-post-visual-editor [data-type="coblocks/service"]:first-child' ).click();
cy.get( '.edit-post-visual-editor [data-type="coblocks/service"]:first-child' ).focus();
cy.get( 'div.block-editor-block-mover' ).should( 'not.have.class', 'is-horizontal' );

helpers.savePage();
Expand Down

0 comments on commit ab584a5

Please sign in to comment.