Skip to content

Commit

Permalink
added docs or fixed them
Browse files Browse the repository at this point in the history
  • Loading branch information
MaggieCabrera committed Jun 16, 2023
1 parent f2e9440 commit 22c8544
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/wp-includes/block-supports/duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,6 @@ function wp_register_duotone_support( $block_type ) {
* @since 6.1.0 Allow unset for preset colors.
* @access private
*
* @deprecated 6.3.0 Use WP_Duotone::render_duotone_support() instead.
*
* @param string $block_content Rendered block content.
* @param array $block Block object.
* @deprecated 6.3.0 Use WP_Duotone::render_duotone_support() instead.
Expand Down
4 changes: 2 additions & 2 deletions src/wp-includes/class-wp-duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ private static function colord_parse( $input ) {
}

/**
* Take the inline CSS duotone variable from a block and return the slug. Handles styles slugs like:
* Takes the inline CSS duotone variable from a block and return the slug. Handles styles slugs like:
* var:preset|duotone|blue-orange
* var(--wp--preset--duotone--blue-orange)
*
Expand All @@ -459,7 +459,7 @@ private static function get_slug_from_attribute( $duotone_attr ) {
}

/**
* Check if we have a valid duotone preset.
* Checks if we have a valid duotone preset.
*
* @param string $duotone_attr The duotone attribute from a block.
* @return bool True if the duotone preset present and valid.
Expand Down
18 changes: 18 additions & 0 deletions tests/phpunit/tests/block-supports/duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ public static function wpTearDownAfterClass() {
WP_Style_Engine_CSS_Rules_Store::remove_all_stores();
}

/**
* Tests whether the duotone preset class is added to the block.
*
* @covers ::render_duotone_support
*/
public function test_render_duotone_support_preset() {
$block = array(
'blockName' => 'core/image',
Expand All @@ -25,6 +30,11 @@ public function test_render_duotone_support_preset() {
$this->assertSame( $expected, WP_Duotone::render_duotone_support( $block_content, $block ) );
}

/**
* Tests whether the duotone unset class is added to the block.
*
* @covers ::render_duotone_support
*/
public function test_render_duotone_support_css() {
$block = array(
'blockName' => 'core/image',
Expand All @@ -35,6 +45,11 @@ public function test_render_duotone_support_css() {
$this->assertMatchesRegularExpression( $expected, WP_Duotone::render_duotone_support( $block_content, $block ) );
}

/**
* Tests whether the duotone custom class is added to the block.
*
* @covers ::render_duotone_support
*/
public function test_render_duotone_support_custom() {
$block = array(
'blockName' => 'core/image',
Expand All @@ -60,7 +75,10 @@ public function data_get_slug_from_attribute() {
}

/**
* Tests whether the slug is extracted from the attribute.
*
* @dataProvider data_get_slug_from_attribute
* @covers ::get_slug_from_attribute
*/
public function test_get_slug_from_attribute( $data_attr, $expected ) {

Expand Down

0 comments on commit 22c8544

Please sign in to comment.