Skip to content

Commit

Permalink
fix tests by supporting only src attribute if it's found
Browse files Browse the repository at this point in the history
  • Loading branch information
wordpressfan committed Jun 6, 2024
1 parent c46e6ca commit fbc765e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion inc/Engine/Media/AboveTheFold/AJAX/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ public function check_lcp_data() {
* @return bool
*/
private function validate_image( $image_object ) {
$valid_image = $this->validate_image_src( $image_object->src ?? '' );
$valid_image = ! empty( $image_object->src ) ? $this->validate_image_src( $image_object->src ?? '' ) : true;

/**
* Filters If the image src is a valid image or not.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
(object) [
'label' => 'lcp',
'type' => 'bg-img',
'src' => 'http://example.org/lcp.jpg',
'src' => '',
'bg_set' => [
[
'src' => 'http://example.org/anotherlcp.jpg'
Expand Down Expand Up @@ -428,6 +428,10 @@
],
]
),
'filetype' => [
'ext' => 'jpg',
'type' => 'image/jpeg',
],
],
'expected' => [
'images_valid_sources' => [],
Expand Down

0 comments on commit fbc765e

Please sign in to comment.