Skip to content

Commit 25531e1

Browse files
committed
Read the script-on flag and ignore tests
1 parent a1e5bc9 commit 25531e1

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,7 @@ public static function parse_html5_dat_testfile( $filename ) {
371371
$test_html = '';
372372
$test_dom = '';
373373
$test_context_element = null;
374+
$test_script_flag = false;
374375
$test_line_number = 0;
375376

376377
while ( false !== ( $line = fgets( $handle ) ) ) {
@@ -379,8 +380,12 @@ public static function parse_html5_dat_testfile( $filename ) {
379380
if ( '#' === $line[0] ) {
380381
// Finish section.
381382
if ( "#data\n" === $line ) {
382-
// Yield when switching from a previous state.
383-
if ( $state ) {
383+
/*
384+
* Yield when switching from a previous state.
385+
* Do not yield tests with the scripting flag enabled. The scripting flag
386+
* is always disabled in the HTML API.
387+
*/
388+
if ( $state && ! $test_script_flag ) {
384389
yield array(
385390
$test_line_number,
386391
$test_context_element,
@@ -395,6 +400,10 @@ public static function parse_html5_dat_testfile( $filename ) {
395400
$test_html = '';
396401
$test_dom = '';
397402
$test_context_element = null;
403+
$test_script_flag = false;
404+
}
405+
if ( "#script-on\n" === $line ) {
406+
$test_script_flag = true;
398407
}
399408

400409
$state = trim( substr( $line, 1 ) );

0 commit comments

Comments
 (0)