diff --git a/includes/sanitizers/class-amp-auto-lightbox-disable-sanitizer.php b/includes/sanitizers/class-amp-auto-lightbox-disable-sanitizer.php index e4b87e95b95..61e503ebdf1 100644 --- a/includes/sanitizers/class-amp-auto-lightbox-disable-sanitizer.php +++ b/includes/sanitizers/class-amp-auto-lightbox-disable-sanitizer.php @@ -19,6 +19,6 @@ class AMP_Auto_Lightbox_Disable_Sanitizer extends AMP_Base_Sanitizer { * @return void */ public function sanitize() { - $this->dom->body->setAttributeNode( $this->dom->createAttribute( 'data-amp-auto-lightbox-disable' ) ); + $this->dom->html->setAttributeNode( $this->dom->createAttribute( 'data-amp-auto-lightbox-disable' ) ); } } diff --git a/tests/e2e/specs/block-editor/featured-image-notice.js b/tests/e2e/specs/block-editor/featured-image-notice.js index 117bc2b9344..8e652120d80 100644 --- a/tests/e2e/specs/block-editor/featured-image-notice.js +++ b/tests/e2e/specs/block-editor/featured-image-notice.js @@ -35,6 +35,8 @@ describe( 'Featured Image Notice', () => { // This should not suggest cropping. await expect( page ).not.toMatch( cropImageText ); + + await clickButton( 'Featured image' ); } ); it( 'should display a notice when the image is too small, but not suggest cropping', async () => { diff --git a/tests/php/test-class-amp-auto-lightbox-disable-sanitizer.php b/tests/php/test-class-amp-auto-lightbox-disable-sanitizer.php index 898598bb27a..0aa069c1036 100644 --- a/tests/php/test-class-amp-auto-lightbox-disable-sanitizer.php +++ b/tests/php/test-class-amp-auto-lightbox-disable-sanitizer.php @@ -25,6 +25,6 @@ public function test_sanitize() { $sanitizer = new AMP_Auto_Lightbox_Disable_Sanitizer( $dom ); $sanitizer->sanitize(); - $this->assertTrue( $dom->body->hasAttribute( 'data-amp-auto-lightbox-disable' ) ); + $this->assertTrue( $dom->html->hasAttribute( 'data-amp-auto-lightbox-disable' ) ); } } diff --git a/tests/php/test-class-amp-theme-support.php b/tests/php/test-class-amp-theme-support.php index dda5ffadf2a..a053ec6e73b 100644 --- a/tests/php/test-class-amp-theme-support.php +++ b/tests/php/test-class-amp-theme-support.php @@ -1906,7 +1906,7 @@ public function test_prepare_response_standard_mode_non_amp( $with_amp_live_list $sanitized_html = AMP_Theme_Support::prepare_response( $original_html, [ ConfigurationArgument::ENABLE_OPTIMIZER => false ] ); - $this->assertStringContainsString( '', $sanitized_html, 'The AMP attribute is removed from the HTML element' ); + $this->assertDoesNotMatchRegularExpression( '/]*[\s]amp[^>]*>/', $sanitized_html, 'The AMP attribute is removed from the HTML element' ); $this->assertStringContainsString( '