mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Tests: Remove the ::append_to_selector() method from Tests_Theme_wpThemeJson.
The method exists in the `WP_Theme_JSON` class and appears to be erroneously duplicated in the test class. Add a unit test that was meant to be included instead, as per https://github.com/WordPress/gutenberg/pull/32190. Follow-up to [51051]. See #52991. git-svn-id: https://develop.svn.wordpress.org/trunk@51054 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -170,6 +170,33 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
function test_get_stylesheet_preset_classes_work_with_compounded_selectors() {
|
||||
$theme_json = new WP_Theme_JSON(
|
||||
array(
|
||||
'version' => WP_Theme_JSON::LATEST_SCHEMA,
|
||||
'settings' => array(
|
||||
'blocks' => array(
|
||||
'core/heading' => array(
|
||||
'color' => array(
|
||||
'palette' => array(
|
||||
array(
|
||||
'slug' => 'white',
|
||||
'color' => '#fff',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$this->assertEquals(
|
||||
'h1.has-white-color,h2.has-white-color,h3.has-white-color,h4.has-white-color,h5.has-white-color,h6.has-white-color{color: #fff !important;}h1.has-white-background-color,h2.has-white-background-color,h3.has-white-background-color,h4.has-white-background-color,h5.has-white-background-color,h6.has-white-background-color{background-color: #fff !important;}',
|
||||
$theme_json->get_stylesheet( 'block_styles' )
|
||||
);
|
||||
}
|
||||
|
||||
function test_get_stylesheet_preset_rules_come_after_block_rules() {
|
||||
$theme_json = new WP_Theme_JSON(
|
||||
array(
|
||||
@@ -619,28 +646,6 @@ class Tests_Theme_wpThemeJson extends WP_UnitTestCase {
|
||||
$this->assertEqualSetsWithIndex( $expected, $actual );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function that appends a sub-selector to a existing one.
|
||||
*
|
||||
* Given the compounded $selector "h1, h2, h3"
|
||||
* and the $to_append selector ".some-class" the result will be
|
||||
* "h1.some-class, h2.some-class, h3.some-class".
|
||||
*
|
||||
* @param string $selector Original selector.
|
||||
* @param string $to_append Selector to append.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private static function append_to_selector( $selector, $to_append ) {
|
||||
$new_selectors = array();
|
||||
$selectors = explode( ',', $selector );
|
||||
foreach ( $selectors as $sel ) {
|
||||
$new_selectors[] = $sel . $to_append;
|
||||
}
|
||||
|
||||
return implode( ',', $new_selectors );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 52991
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user