Skip to content

Commit d49a755

Browse files
committed
Add test for <a><a> replacement nesting
1 parent 1aef27a commit d49a755

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

tests/phpunit/tests/html-api/wpHtmlTemplate.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,4 +1176,22 @@ public function test_multiple_duplicate_attributes_removed() {
11761176
);
11771177
$this->assertEqualHTML( '<input type="text">', $result );
11781178
}
1179+
1180+
/**
1181+
* Test that a template replacement cannot template structure HTML.
1182+
*
1183+
* @ticket 60229
1184+
*
1185+
* @covers ::render
1186+
*/
1187+
public function test_replacements_cannot_modify_template_structure() {
1188+
$this->markTestSkipped( 'Template HTML structure protection is not implemented.' );
1189+
1190+
// Three occurrences of "disabled": placeholder + two duplicates.
1191+
$result = T::render(
1192+
'<a></%link-text></a>',
1193+
array( 'link-text' => WP_HTML_Template::template( '<a>A elements cannot nest in HTML</a>' ) )
1194+
);
1195+
$this->assertFalse( $result, 'Should have rejected the template with an invalid replacement.' );
1196+
}
11791197
}

0 commit comments

Comments
 (0)