Skip to content

Commit

Permalink
Add a test to verify the SVG Icon block works
Browse files Browse the repository at this point in the history
  • Loading branch information
dkotter committed Nov 20, 2024
1 parent 2a7f47c commit 3dddb28
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/cypress/e2e/safe-svg.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,24 @@ describe('Safe SVG Tests', () => {
});
});

it('Admin can add SVG block to a post', () => {
cy.uploadMedia('.wordpress-org/icon.svg');

cy.createPost( {
title: 'SVG Block Test',
beforeSave: () => {
cy.insertBlock( 'safe-svg/svg-icon' );
cy.getBlockEditor().find( '.block-editor-media-placeholder' ).contains( 'button', 'Media Library' ).click();
cy.get( '#menu-item-browse' ).click();
cy.get( '.attachments-wrapper li:first .thumbnail' ).click();
cy.get( '.media-modal .media-button-select' ).click();
},
} ).then( post => {
cy.visit( `/wp-admin/post.php?post=${post.id}&action=edit` );
cy.getBlockEditor().find( '.wp-block-safe-svg-svg-icon' );
} );
} );

/**
* Flow for verify SVG sanitization.
*
Expand Down

0 comments on commit 3dddb28

Please sign in to comment.