@@ -450,16 +450,22 @@ define(function (require, exports, module) {
450450 ) . toBeRejectedWithError ( "rect width and height must be greater than 0" ) ;
451451 } ) ;
452452
453- it ( "Should throw when rect exceeds window width bounds" , async function ( ) {
454- await expectAsync (
455- Phoenix . app . screenShotBinary ( { x : 0 , y : 0 , width : 999999 , height : 100 } )
456- ) . toBeRejectedWithError ( "rect x + width exceeds window innerWidth" ) ;
453+ it ( "Should clamp an oversize width rect and return a valid PNG" , async function ( ) {
454+ const bytes = await Phoenix . app . screenShotBinary ( { x : 0 , y : 0 , width : 999999 , height : 100 } ) ;
455+ expect ( bytes instanceof Uint8Array ) . toBeTrue ( ) ;
456+ expect ( isPNG ( bytes ) ) . withContext ( "Result should be valid PNG data" ) . toBeTrue ( ) ;
457+ } ) ;
458+
459+ it ( "Should clamp an oversize height rect and return a valid PNG" , async function ( ) {
460+ const bytes = await Phoenix . app . screenShotBinary ( { x : 0 , y : 0 , width : 100 , height : 999999 } ) ;
461+ expect ( bytes instanceof Uint8Array ) . toBeTrue ( ) ;
462+ expect ( isPNG ( bytes ) ) . withContext ( "Result should be valid PNG data" ) . toBeTrue ( ) ;
457463 } ) ;
458464
459- it ( "Should throw when rect exceeds window height bounds " , async function ( ) {
465+ it ( "Should throw when rect origin leaves no capturable area " , async function ( ) {
460466 await expectAsync (
461- Phoenix . app . screenShotBinary ( { x : 0 , y : 0 , width : 100 , height : 999999 } )
462- ) . toBeRejectedWithError ( "rect y + height exceeds window innerHeight " ) ;
467+ Phoenix . app . screenShotBinary ( { x : 999999 , y : 0 , width : 100 , height : 100 } )
468+ ) . toBeRejectedWithError ( "rect origin leaves no capturable area " ) ;
463469 } ) ;
464470
465471 it ( "Should capture a screenshot of a DOM element" , async function ( ) {
0 commit comments