Skip to content

Commit

Permalink
Tests: Improve code comments for block supports tests
Browse files Browse the repository at this point in the history
Follow-up for [53085].

Props ramonopoly, antonvlasenko, peterwilsoncc.
See #55505.



git-svn-id: https://develop.svn.wordpress.org/trunk@53128 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
gziolo committed Apr 11, 2022
1 parent 2c5e50e commit 43aba3b
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 7 deletions.
7 changes: 6 additions & 1 deletion tests/phpunit/tests/block-supports/border.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
* @group block-supports
*/
class Test_Block_Supports_Border extends WP_UnitTestCase {

/**
* @ticket 55505
*
* @covers ::wp_apply_border_support
*/
function test_border_color_slug_with_numbers_is_kebab_cased_properly() {
$block_name = 'test/border-color-slug-with-numbers-is-kebab-cased-properly';
Expand Down Expand Up @@ -56,6 +57,8 @@ function test_border_color_slug_with_numbers_is_kebab_cased_properly() {

/**
* @ticket 55505
*
* @covers ::wp_apply_border_support
*/
function test_border_with_skipped_serialization_block_supports() {
$block_name = 'test/border-with-skipped-serialization-block-supports';
Expand Down Expand Up @@ -101,6 +104,8 @@ function test_border_with_skipped_serialization_block_supports() {

/**
* @ticket 55505
*
* @covers ::wp_apply_border_support
*/
function test_radius_with_individual_skipped_serialization_block_supports() {
$block_name = 'test/radius-with-individual-skipped-serialization-block-supports';
Expand Down
10 changes: 9 additions & 1 deletion tests/phpunit/tests/block-supports/colors.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* @group block-supports
*/
class Tests_Block_Supports_Colors extends WP_UnitTestCase {

/**
* @ticket 54337
*
* @covers ::wp_apply_colors_support
*/
function test_color_slugs_with_numbers_are_kebab_cased_properly() {
register_block_type(
'test/color-slug-with-numbers',
Expand Down Expand Up @@ -47,6 +51,8 @@ function test_color_slugs_with_numbers_are_kebab_cased_properly() {

/**
* @ticket 55505
*
* @covers ::wp_apply_colors_support
*/
function test_color_with_skipped_serialization_block_supports() {
$block_name = 'test/color-with-skipped-serialization-block-supports';
Expand Down Expand Up @@ -89,6 +95,8 @@ function test_color_with_skipped_serialization_block_supports() {

/**
* @ticket 55505
*
* @covers ::wp_apply_colors_support
*/
function test_gradient_with_individual_skipped_serialization_block_supports() {
$block_name = 'test/gradient-with-individual-skipped-serialization-block-support';
Expand Down
9 changes: 9 additions & 0 deletions tests/phpunit/tests/block-supports/elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ private static function make_unique_id_one( $string ) {

/**
* Test wp_render_elements_support() with a simple paragraph and link color preset.
* @ticket 54337
*
* @covers ::wp_render_elements_support
*/
public function test_simple_paragraph_link_color() {
$result = self::make_unique_id_one(
Expand Down Expand Up @@ -45,6 +48,9 @@ public function test_simple_paragraph_link_color() {

/**
* Test wp_render_elements_support() with a paragraph containing a class.
* @ticket 54337
*
* @covers ::wp_render_elements_support
*/
public function test_class_paragraph_link_color() {
$result = self::make_unique_id_one(
Expand Down Expand Up @@ -75,6 +81,9 @@ public function test_class_paragraph_link_color() {

/**
* Test wp_render_elements_support() with a paragraph containing a anchor.
* @ticket 54337
*
* @covers ::wp_render_elements_support
*/
public function test_anchor_paragraph_link_color() {
$result = self::make_unique_id_one(
Expand Down
8 changes: 8 additions & 0 deletions tests/phpunit/tests/block-supports/layout.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ function filter_set_theme_root() {

/**
* @ticket 55505
*
* @covers ::wp_restore_image_outer_container
*/
function test_outer_container_not_restored_for_non_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
Expand All @@ -69,6 +71,8 @@ function test_outer_container_not_restored_for_non_aligned_image_block_with_non_

/**
* @ticket 55505
*
* @covers ::wp_restore_image_outer_container
*/
function test_outer_container_restored_for_aligned_image_block_with_non_themejson_theme() {
// The "default" theme doesn't have theme.json support.
Expand All @@ -86,6 +90,8 @@ function test_outer_container_restored_for_aligned_image_block_with_non_themejso
/**
* @ticket 55505
*
* @covers ::wp_restore_image_outer_container
*
* @dataProvider data_block_image_html_restored_outer_container
*
* @param string $block_image_html The block image HTML passed to `wp_restore_image_outer_container`.
Expand Down Expand Up @@ -143,6 +149,8 @@ public function data_block_image_html_restored_outer_container() {

/**
* @ticket 55505
*
* @covers ::wp_restore_image_outer_container
*/
function test_outer_container_not_restored_for_aligned_image_block_with_themejson_theme() {
switch_theme( 'block-theme' );
Expand Down
7 changes: 6 additions & 1 deletion tests/phpunit/tests/block-supports/spacing.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
* @group block-supports
*/
class Test_Block_Supports_Spacing extends WP_UnitTestCase {

/**
* @ticket 55505
*
* @covers ::wp_apply_spacing_support
*/
function test_spacing_style_is_applied() {
$block_name = 'test/spacing-style-is-applied';
Expand Down Expand Up @@ -55,6 +56,8 @@ function test_spacing_style_is_applied() {

/**
* @ticket 55505
*
* @covers ::wp_apply_spacing_support
*/
function test_spacing_with_skipped_serialization_block_supports() {
$block_name = 'test/spacing-with-skipped-serialization-block-supports';
Expand Down Expand Up @@ -103,6 +106,8 @@ function test_spacing_with_skipped_serialization_block_supports() {

/**
* @ticket 55505
*
* @covers ::wp_apply_spacing_support
*/
function test_margin_with_individual_skipped_serialization_block_supports() {
$block_name = 'test/margin-with-individual-skipped-serialization-block-supports';
Expand Down
28 changes: 24 additions & 4 deletions tests/phpunit/tests/block-supports/typography.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
* @group block-supports
*/
class Tests_Block_Supports_Typography extends WP_UnitTestCase {

/**
* @ticket 54337
*
* @covers ::wp_apply_typography_support
*/
function test_font_size_slug_with_numbers_is_kebab_cased_properly() {
register_block_type(
'test/font-size-slug-with-numbers',
Expand Down Expand Up @@ -32,7 +36,11 @@ function test_font_size_slug_with_numbers_is_kebab_cased_properly() {
$this->assertSame( $expected, $actual );
unregister_block_type( 'test/font-size-slug-with-numbers' );
}

/**
* @ticket 54337
*
* @covers ::wp_apply_typography_support
*/
function test_font_family_with_legacy_inline_styles_using_a_value() {
$block_name = 'test/font-family-with-inline-styles-using-value';
register_block_type(
Expand Down Expand Up @@ -64,6 +72,8 @@ function test_font_family_with_legacy_inline_styles_using_a_value() {

/**
* @ticket 55505
*
* @covers ::wp_apply_typography_support
*/
function test_typography_with_skipped_serialization_block_supports() {
$block_name = 'test/typography-with-skipped-serialization-block-supports';
Expand Down Expand Up @@ -109,6 +119,8 @@ function test_typography_with_skipped_serialization_block_supports() {

/**
* @ticket 55505
*
* @covers ::wp_apply_typography_support
*/
function test_letter_spacing_with_individual_skipped_serialization_block_supports() {
$block_name = 'test/letter-spacing-with-individua-skipped-serialization-block-supports';
Expand Down Expand Up @@ -141,7 +153,11 @@ function test_letter_spacing_with_individual_skipped_serialization_block_support
$this->assertSame( $expected, $actual );
unregister_block_type( $block_name );
}

/**
* @ticket 54337
*
* @covers ::wp_apply_typography_support
*/
function test_font_family_with_legacy_inline_styles_using_a_css_var() {
$block_name = 'test/font-family-with-inline-styles-using-css-var';
register_block_type(
Expand Down Expand Up @@ -170,7 +186,11 @@ function test_font_family_with_legacy_inline_styles_using_a_css_var() {
$this->assertSame( $expected, $actual );
unregister_block_type( $block_name );
}

/**
* @ticket 54337
*
* @covers ::wp_apply_typography_support
*/
function test_font_family_with_class() {
$block_name = 'test/font-family-with-class';
register_block_type(
Expand Down

0 comments on commit 43aba3b

Please sign in to comment.