Make WordPress Core


Ignore:
Timestamp:
01/23/2026 06:04:10 PM (8 months ago)
Author:
jonsurrell
Message:

Build/Test Tools: Ensure assertEqualHTML() recognizes whitespace text.

Ensure whitespace text nodes are correctly represented by build_visual_html_tree().

The build_visual_html_tree() function used by assertEqualHTML() would remove some leading whitespace from text nodes. Some whitespace-only text nodes were omitted from the tree.

Developed in https://github.com/WordPress/wordpress-develop/pull/10765.

Follow-up to [60295].

Props jonsurrell, dmsnell, bernhard-reiter.
Fixes #64531.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/dependencies/styles.php

    r61416 r61519  
    883883/*# sourceURL=css-inline-concat-one%2Ctwo */
    884884</style>
     885
    885886HTML;
    886887
     
    936937                $markup = get_echo( 'wp_print_styles' );
    937938
    938                 $expected = "<link rel='stylesheet' href='/test-style.css?{$expected_query_string}' id='test-style-css' media='all' />";
     939                $expected = "<link rel='stylesheet' href='/test-style.css?{$expected_query_string}' id='test-style-css' media='all' />\n";
    939940                $this->assertEqualHTML( $expected, $markup, '<body>', 'Expected equal snapshot for wp_print_styles() with version ' . var_export( $version, true ) . ":\n$markup" );
    940941        }
     
    957958                $markup = get_echo( 'wp_print_styles' );
    958959
    959                 $expected = "<link rel='stylesheet' href='/test-style.css?{$expected_query_string}' id='test-style-css' media='all' />";
     960                $expected = "<link rel='stylesheet' href='/test-style.css?{$expected_query_string}' id='test-style-css' media='all' />\n";
    960961                $this->assertEqualHTML( $expected, $markup, '<body>', 'Expected equal snapshot for wp_print_styles() with version ' . var_export( $version, true ) . ":\n$markup" );
    961962        }
Note: See TracChangeset for help on using the changeset viewer.