Skip to content

Commit 5510d1c

Browse files
KSES: Simplify the color function filter test and update stale test comments.
Test a single rejecting filter at the default priority, since the color function check runs before the filter at any priority. Reword two comments that said RGB and RGBA values need the filter to be allowed.
1 parent 53e013c commit 5510d1c

1 file changed

Lines changed: 5 additions & 21 deletions

File tree

‎tests/phpunit/tests/kses.php‎

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2461,12 +2461,12 @@ public static function data_safecss_filter_attr_filtered() {
24612461
'css' => 'height: expression( body.scrollTop + 50 + "px" )',
24622462
'expected' => 'height: expression( body.scrollTop + 50 + "px" )',
24632463
),
2464-
// RGB color values can be allowed with the 'safecss_filter_attr_allow_css' filter.
2464+
// RGB color values are still allowed with the 'safecss_filter_attr_allow_css' filter.
24652465
array(
24662466
'css' => 'color: rgb( 100, 100, 100 )',
24672467
'expected' => 'color: rgb( 100, 100, 100 )',
24682468
),
2469-
// RGBA color values can be allowed with the 'safecss_filter_attr_allow_css' filter.
2469+
// RGBA color values are still allowed with the 'safecss_filter_attr_allow_css' filter.
24702470
array(
24712471
'css' => 'color: rgb( 100, 100, 100, .4 )',
24722472
'expected' => 'color: rgb( 100, 100, 100, .4 )',
@@ -2478,33 +2478,17 @@ public static function data_safecss_filter_attr_filtered() {
24782478
* Tests that a safecss_filter_attr_allow_css filter can reject an allowed color function.
24792479
*
24802480
* @ticket 66387
2481-
*
2482-
* @dataProvider data_safecss_filter_attr_rejecting_filter_priorities
2483-
*
2484-
* @param int $priority Priority of the rejecting filter.
24852481
*/
2486-
public function test_safecss_filter_attr_filter_can_reject_color_functions( $priority ) {
2487-
add_filter( 'safecss_filter_attr_allow_css', '__return_false', $priority );
2482+
public function test_safecss_filter_attr_filter_can_reject_color_functions() {
2483+
add_filter( 'safecss_filter_attr_allow_css', '__return_false' );
24882484

24892485
$result = safecss_filter_attr( 'color: rgb(0 0 0)' );
24902486

2491-
remove_filter( 'safecss_filter_attr_allow_css', '__return_false', $priority );
2487+
remove_filter( 'safecss_filter_attr_allow_css', '__return_false' );
24922488

24932489
$this->assertSame( '', $result );
24942490
}
24952491

2496-
/**
2497-
* Data provider for test_safecss_filter_attr_filter_can_reject_color_functions().
2498-
*
2499-
* @return array[]
2500-
*/
2501-
public function data_safecss_filter_attr_rejecting_filter_priorities() {
2502-
return array(
2503-
'priority 5' => array( 5 ),
2504-
'priority 10' => array( 10 ),
2505-
);
2506-
}
2507-
25082492
/**
25092493
* Tests that the style engine keeps a box-shadow containing rgba().
25102494
*

0 commit comments

Comments
 (0)