diff --git a/tests/phpunit/tests/customize/nav-menus.php b/tests/phpunit/tests/customize/nav-menus.php
index 2eba4b3c24..d85e75c8b8 100644
--- a/tests/phpunit/tests/customize/nav-menus.php
+++ b/tests/phpunit/tests/customize/nav-menus.php
@@ -497,7 +497,7 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
if ( $post_types ) {
foreach ( $post_types as $type ) {
$this->assertContains( 'available-menu-items-post_type-' . esc_attr( $type->name ), $template );
- $this->assertContains( '
' . esc_html( $type->labels->singular_name ), $template );
+ $this->assertRegExp( '#\s*' . esc_html( $type->labels->singular_name ) . '#', $template );
$this->assertContains( 'data-type="post_type"', $template );
$this->assertContains( 'data-object="' . esc_attr( $type->name ) . '"', $template );
}
@@ -507,14 +507,14 @@ class Test_WP_Customize_Nav_Menus extends WP_UnitTestCase {
if ( $taxonomies ) {
foreach ( $taxonomies as $tax ) {
$this->assertContains( 'available-menu-items-taxonomy-' . esc_attr( $tax->name ), $template );
- $this->assertContains( '' . esc_html( $tax->labels->singular_name ), $template );
+ $this->assertRegExp( '#\s*' . esc_html( $tax->labels->singular_name ) . '#', $template );
$this->assertContains( 'data-type="taxonomy"', $template );
$this->assertContains( 'data-object="' . esc_attr( $tax->name ) . '"', $template );
}
}
$this->assertContains( 'available-menu-items-custom_type', $template );
- $this->assertContains( 'Custom', $template );
+ $this->assertRegExp( '#\s*Custom#', $template );
$this->assertContains( 'data-type="custom_type"', $template );
$this->assertContains( 'data-object="custom_object"', $template );
}