Skip to content

Commit

Permalink
Merge branch 'trunk' into add/cache-control-site-health-test
Browse files Browse the repository at this point in the history
  • Loading branch information
b1ink0 committed Jan 23, 2025
2 parents 24963c8 + b9154cc commit d275b36
Show file tree
Hide file tree
Showing 116 changed files with 2,880 additions and 1,392 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# Improve highlighting for PHPStan stub files.
*.stub linguist-language=PHP

# Hide diffs for Optimization Detective snapshots.
plugins/*/tests/test-cases/*/expected.html linguist-generated=true
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
$elements[] = array_merge(
$element_data,
array(
'xpath' => "/HTML/BODY/DIV/*[{$i}][self::FIGURE]/*[1][self::DIV]",
'xpath' => "/HTML/BODY/DIV[@class='wp-site-blocks']/*[{$i}][self::FIGURE]/*[1][self::DIV]",
)
);
}
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 1,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]/*[1][self::VIDEO]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]/*[1][self::VIDEO]',
'isLCP' => false,
'intersectionRatio' => 1,
),
array(
'xpath' => '/HTML/BODY/DIV/*[2][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[2][self::FIGURE]/*[1][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 654 ) ),
),
array(
'xpath' => '/HTML/BODY/DIV/*[2][self::FIGURE]/*[1][self::DIV]/*[1][self::FIGURE]/*[2][self::VIDEO]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[2][self::FIGURE]/*[1][self::DIV]/*[1][self::FIGURE]/*[2][self::VIDEO]',
'isLCP' => false,
'intersectionRatio' => 0,
),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => true,
'intersectionRatio' => 1,
// Intentionally omitting resizedBoundingClientRect here to test behavior when data isn't supplied.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => true,
'intersectionRatio' => 1,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $i => $viewport_width ) {
$elements = array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => true,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 + $i * 100 ) ),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => true,
'intersectionRatio' => 1,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $i => $viewport_width ) {
$elements = array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => true,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 + $i * 100 ) ),
),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'viewport_width' => 100,
'elements' => array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 1,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => true,
'intersectionRatio' => 1,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
foreach ( array_merge( od_get_breakpoint_max_widths(), array( 1000 ) ) as $viewport_width ) {
$elements = array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => true,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'viewport_width' => 100,
'elements' => array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::FIGURE]/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::FIGURE]/*[1][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0,
'resizedBoundingClientRect' => array_merge( $test_case->get_sample_dom_rect(), array( 'height' => 500 ) ),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::BOGUS]',
'xpath' => '/HTML/BODY/DIV[@class=\'wp-site-blocks\']/*[1][self::BOGUS]',
'isLCP' => false,
'intersectionRatio' => 0.0,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static function () use ( $breakpoint_max_widths ) {
'viewport_width' => $non_desktop_viewport_width,
'elements' => array(
array(
'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'intersectionRect' => $outside_viewport_rect,
Expand All @@ -47,7 +47,7 @@ static function () use ( $breakpoint_max_widths ) {
'viewport_width' => 1000,
'elements' => array(
array(
'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0.3,
),
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static function () use ( $breakpoint_max_widths ) {
'viewport_width' => $non_desktop_viewport_width,
'elements' => array(
array(
'xpath' => '/HTML/BODY/DIV/*[2][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[2][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'intersectionRect' => $outside_viewport_rect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]',
'isLCP' => true,
),
array(
'xpath' => '/HTML/BODY/DIV/*[3][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[3][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'intersectionRect' => $outside_viewport_rect,
'boundingClientRect' => $outside_viewport_rect,
),
array(
'xpath' => '/HTML/BODY/DIV/*[4][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[4][self::DIV]',
'isLCP' => false,
'intersectionRatio' => 0.0,
'intersectionRect' => $outside_viewport_rect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$test_case->populate_url_metrics(
array(
array(
'xpath' => '/HTML/BODY/DIV/*[1][self::DIV]',
'xpath' => '/HTML/BODY/DIV[@id=\'page\']/*[1][self::DIV]',
'isLCP' => true,
),
)
Expand Down
Loading

0 comments on commit d275b36

Please sign in to comment.