diff --git a/.wp-env.json b/.wp-env.json index b0d7a7d..61aaf47 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,6 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/wp-env.json", - "core": "https://wordpress.org/wordpress-6.9.zip", + "core": "https://wordpress.org/wordpress-7.0-beta1.zip", "plugins": ["."], "phpVersion": "8.2", "env": { diff --git a/tests/RenderCardBlockTest.php b/tests/RenderCardBlockTest.php index b0f143a..2d39d5b 100644 --- a/tests/RenderCardBlockTest.php +++ b/tests/RenderCardBlockTest.php @@ -16,6 +16,13 @@ class RenderCardBlockTest extends WP_UnitTestCase { * Note: assertEqualHTML normalizes class order — so it doesn't matter * whether add_class() puts "is-style-outlined" before or after * "wp-block-my-plugin-card". + * + * Whitespace tip: attributes can span multiple lines (they are part of the + * opening tag, not text nodes). But whitespace *between* elements — like a + * newline between `>` and `

` — creates a text node that must match the + * actual output. Since the render callback concatenates $content directly + * with no surrounding whitespace, the expected string must do the same: + * `...>

...

` with no gaps. */ public function test_card_block_renders_with_background_color(): void { $attributes = array( @@ -28,14 +35,13 @@ public function test_card_block_renders_with_background_color(): void { $output = my_plugin_render_card_block( $attributes, $inner_content ); // Attribute order and class order don't need to match exactly. - $expected = ' -
-

Hello

-
- '; + // Attributes may be on separate lines for readability — that's fine. + // But there must be no whitespace between > and

, since the actual + // output has none (whitespace-only text nodes are compared as-is). + $expected = '

Hello

'; $this->assertEqualHTML( $expected, $output ); }