Changeset 51054 for trunk/tests/phpunit/tests/theme/wpThemeJson.php
- Timestamp:
- 06/01/2021 11:30:05 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/theme/wpThemeJson.php
r51051 r51054 168 168 'body{--wp--preset--color--grey: grey;}.wp-block-group{--wp--custom--base-font: 16;--wp--custom--line-height--small: 1.2;--wp--custom--line-height--medium: 1.4;--wp--custom--line-height--large: 1.8;}', 169 169 $theme_json->get_stylesheet( 'css_variables' ) 170 ); 171 } 172 173 function test_get_stylesheet_preset_classes_work_with_compounded_selectors() { 174 $theme_json = new WP_Theme_JSON( 175 array( 176 'version' => WP_Theme_JSON::LATEST_SCHEMA, 177 'settings' => array( 178 'blocks' => array( 179 'core/heading' => array( 180 'color' => array( 181 'palette' => array( 182 array( 183 'slug' => 'white', 184 'color' => '#fff', 185 ), 186 ), 187 ), 188 ), 189 ), 190 ), 191 ) 192 ); 193 194 $this->assertEquals( 195 '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;}', 196 $theme_json->get_stylesheet( 'block_styles' ) 170 197 ); 171 198 } … … 621 648 622 649 /** 623 * Function that appends a sub-selector to a existing one.624 *625 * Given the compounded $selector "h1, h2, h3"626 * and the $to_append selector ".some-class" the result will be627 * "h1.some-class, h2.some-class, h3.some-class".628 *629 * @param string $selector Original selector.630 * @param string $to_append Selector to append.631 *632 * @return string633 */634 private static function append_to_selector( $selector, $to_append ) {635 $new_selectors = array();636 $selectors = explode( ',', $selector );637 foreach ( $selectors as $sel ) {638 $new_selectors[] = $sel . $to_append;639 }640 641 return implode( ',', $new_selectors );642 }643 644 /**645 650 * @ticket 52991 646 651 */
Note: See TracChangeset
for help on using the changeset viewer.