From aa98bcf59572a972341d3cd475f710aa44200d24 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Thu, 22 Aug 2024 08:23:18 -0700 Subject: [PATCH] Fix logic inversion in error message Co-authored-by: Pascal Birchler --- plugins/optimization-detective/class-od-url-metric.php | 2 +- plugins/optimization-detective/detect.js | 2 +- .../optimization-detective/tests/test-class-od-url-metric.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/optimization-detective/class-od-url-metric.php b/plugins/optimization-detective/class-od-url-metric.php index 7748726267..83eca93e81 100644 --- a/plugins/optimization-detective/class-od-url-metric.php +++ b/plugins/optimization-detective/class-od-url-metric.php @@ -97,7 +97,7 @@ private function validate_data( array $data ): void { esc_html( sprintf( /* translators: 1: current aspect ratio, 2: minimum aspect ratio, 3: maximum aspect ratio */ - __( 'Viewport aspect ratio (%1$s) is in the accepted range of %2$s to %3$s.', 'optimization-detective' ), + __( 'Viewport aspect ratio (%1$s) is not in the accepted range of %2$s to %3$s.', 'optimization-detective' ), $aspect_ratio, $min_aspect_ratio, $max_aspect_ratio diff --git a/plugins/optimization-detective/detect.js b/plugins/optimization-detective/detect.js index 6fe7b55077..d7e0e2c8d9 100644 --- a/plugins/optimization-detective/detect.js +++ b/plugins/optimization-detective/detect.js @@ -202,7 +202,7 @@ export default async function detect( { ) { if ( isDebug ) { warn( - `Viewport aspect ratio (${ aspectRatio }) is in the accepted range of ${ minViewportAspectRatio } to ${ maxViewportAspectRatio }.` + `Viewport aspect ratio (${ aspectRatio }) is not in the accepted range of ${ minViewportAspectRatio } to ${ maxViewportAspectRatio }.` ); } return; diff --git a/plugins/optimization-detective/tests/test-class-od-url-metric.php b/plugins/optimization-detective/tests/test-class-od-url-metric.php index 216c0a6c6d..d301997d58 100644 --- a/plugins/optimization-detective/tests/test-class-od-url-metric.php +++ b/plugins/optimization-detective/tests/test-class-od-url-metric.php @@ -101,7 +101,7 @@ public function data_provider(): array { 'timestamp' => microtime( true ), 'elements' => array(), ), - 'error' => 'Viewport aspect ratio (0.1) is in the accepted range of 0.4 to 2.5.', + 'error' => 'Viewport aspect ratio (0.1) is not in the accepted range of 0.4 to 2.5.', ), 'viewport_aspect_ratio_too_large' => array( 'data' => array( @@ -114,7 +114,7 @@ public function data_provider(): array { 'timestamp' => microtime( true ), 'elements' => array(), ), - 'error' => 'Viewport aspect ratio (10) is in the accepted range of 0.4 to 2.5.', + 'error' => 'Viewport aspect ratio (10) is not in the accepted range of 0.4 to 2.5.', ), 'missing_timestamp' => array( 'data' => array(