Skip to content

Commit

Permalink
check if the canvas is separated
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera committed Oct 8, 2024
1 parent 0880ea0 commit 39b3470
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/e2e/specs/site-editor/zoom-out.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,22 @@ test.describe( 'Zoom Out', () => {

//Check that the iframe is larger than the html
expect( iframeRect.width ).toBeGreaterThan( htmlRect.width );

//Check that the zoomed out content has a frame around it
expect( htmlRect.x ).toBeGreaterThan( iframeRect.x );

//We use border to separate the content from the frame so we need
//to check that that is present too, since boundingBox()
//includes the border to calculate the position
const borderWidths = await html.evaluate( ( el ) => {
const styles = window.getComputedStyle( el );
return {
top: parseFloat( styles.borderTopWidth ),
right: parseFloat( styles.borderRightWidth ),
bottom: parseFloat( styles.borderBottomWidth ),
left: parseFloat( styles.borderLeftWidth ),
};
} );
expect( htmlRect.y + borderWidths.top ).toBeGreaterThan( iframeRect.y );
} );
} );

0 comments on commit 39b3470

Please sign in to comment.