Skip to content

Commit 9fa4f93

Browse files
committed
Updating classnames for wpGetBlockCssSelector.php tests
Reverting changes to Tests_Theme_wpThemeJson that will need to be reinstated after #4619 merges
1 parent cbc9265 commit 9fa4f93

2 files changed

Lines changed: 14 additions & 29 deletions

File tree

tests/phpunit/tests/theme/wpGetBlockCssSelector.php

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -100,21 +100,6 @@ public function test_get_duotone_selector_via_selectors_api() {
100100
$this->assertEquals( '.duotone-selector', $selector );
101101
}
102102

103-
public function test_get_duotone_selector_via_experimental_property() {
104-
$block_type = self::register_test_block(
105-
'test/experimental-duotone-selector',
106-
null,
107-
array(
108-
'color' => array(
109-
'__experimentalDuotone' => '.experimental-duotone',
110-
),
111-
)
112-
);
113-
114-
$selector = wp_get_block_css_selector( $block_type, 'filters.duotone' );
115-
$this->assertEquals( '.experimental-duotone', $selector );
116-
}
117-
118103
public function test_no_duotone_selector_set() {
119104
$block_type = self::register_test_block(
120105
'test/null-duotone-selector',
@@ -347,11 +332,11 @@ public function test_editor_only_root_selector() {
347332
'test/editor-only-selectors',
348333
array( 'root' => '.wp-custom-block-class' ),
349334
null,
350-
array( 'root' => '.editor-only.wp-custom-block-class' )
335+
array( 'root' => '.wp-custom-block-class' )
351336
);
352337

353338
$selector = wp_get_block_css_selector( $block_type, 'root' );
354-
$this->assertEquals( '.editor-only.wp-custom-block-class', $selector );
339+
$this->assertEquals( '.wp-custom-block-class', $selector );
355340
}
356341

357342
public function test_editor_only_duotone_selector() {
@@ -364,12 +349,12 @@ public function test_editor_only_duotone_selector() {
364349
),
365350
null,
366351
array(
367-
'filters' => array( 'duotone' => '.editor-duotone-selector' ),
352+
'filters' => array( 'duotone' => '.duotone-selector' ),
368353
)
369354
);
370355

371356
$selector = wp_get_block_css_selector( $block_type, 'filters.duotone' );
372-
$this->assertEquals( '.editor-duotone-selector', $selector );
357+
$this->assertEquals( '.duotone-selector', $selector );
373358
}
374359

375360
public function test_editor_only_feature_selector() {
@@ -379,11 +364,11 @@ public function test_editor_only_feature_selector() {
379364
'test/editor-feature-selector',
380365
array( 'typography' => array( 'root' => '.typography' ) ),
381366
null,
382-
array( 'typography' => array( 'root' => '.editor-typography' ) )
367+
array( 'typography' => array( 'root' => '.typography' ) )
383368
);
384369

385370
$selector = wp_get_block_css_selector( $block_type, 'typography' );
386-
$this->assertEquals( '.editor-typography', $selector );
371+
$this->assertEquals( '.typography', $selector );
387372
}
388373

389374
public function test_editor_only_feature_selector_shorthand() {
@@ -393,11 +378,11 @@ public function test_editor_only_feature_selector_shorthand() {
393378
'test/editor-feature-selector',
394379
array( 'typography' => '.typography' ),
395380
null,
396-
array( 'typography' => '.editor-typography' )
381+
array( 'typography' => '.typography' )
397382
);
398383

399384
$selector = wp_get_block_css_selector( $block_type, 'typography' );
400-
$this->assertEquals( '.editor-typography', $selector );
385+
$this->assertEquals( '.typography', $selector );
401386
}
402387

403388
public function test_editor_only_subfeature_selector() {
@@ -407,11 +392,11 @@ public function test_editor_only_subfeature_selector() {
407392
'test/editor-subfeature-selector',
408393
array( 'typography' => array( 'fontSize' => '.font-size' ) ),
409394
null,
410-
array( 'typography' => array( 'fontSize' => '.editor-font-size' ) )
395+
array( 'typography' => array( 'fontSize' => '.font-size' ) )
411396
);
412397

413398
$selector = wp_get_block_css_selector( $block_type, 'typography.fontSize' );
414-
$this->assertEquals( '.editor-font-size', $selector );
399+
$this->assertEquals( '.font-size', $selector );
415400
}
416401

417402
public function test_non_editor_subfeature_does_not_fall_back_to_editor_only_feature_selector() {
@@ -421,7 +406,7 @@ public function test_non_editor_subfeature_does_not_fall_back_to_editor_only_fea
421406
'test/editor-subfeature-selector',
422407
array( 'typography' => array( 'fontSize' => '.font-size' ) ),
423408
null,
424-
array( 'typography' => '.editor-font-size' )
409+
array( 'typography' => '.font-size' )
425410
);
426411

427412
$selector = wp_get_block_css_selector( $block_type, 'typography.fontSize', true );
@@ -435,11 +420,11 @@ public function test_unspecified_subfeature_falls_back_to_editor_only_feature_se
435420
'test/editor-subfeature-selector',
436421
array( 'typography' => '.typography' ),
437422
null,
438-
array( 'typography' => '.editor-typography' )
423+
array( 'typography' => '.typography' )
439424
);
440425

441426
$selector = wp_get_block_css_selector( $block_type, 'typography.fontSize', true );
442-
$this->assertEquals( '.editor-typography', $selector );
427+
$this->assertEquals( '.typography', $selector );
443428
}
444429
}
445430

tests/phpunit/tests/theme/wpThemeJson.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ public function test_get_stylesheet() {
621621
);
622622

623623
$variables = "body{--wp--preset--color--grey: grey;--wp--preset--gradient--custom-gradient: linear-gradient(135deg,rgba(0,0,0) 0%,rgb(0,0,0) 100%);--wp--preset--duotone--custom-duotone: url('#wp-duotone-custom-duotone');--wp--preset--font-family--small: 14px;--wp--preset--font-family--big: 41px;}.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;}";
624-
$styles = 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }body{color: var(--wp--preset--color--grey);}a:where(:not(.wp-element-button)){background-color: #333;color: #111;}.wp-element-button, .wp-block-button__link{box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.66);}.wp-block-group{background: var(--wp--preset--gradient--custom-gradient);border-radius: 10px;padding: 24px;}.wp-block-group a:where(:not(.wp-element-button)){color: #111;}.wp-block-heading{color: #123456;}.wp-block-heading a:where(:not(.wp-element-button)){background-color: #333;color: #111;font-size: 60px;}.wp-block-post-date{color: #123456;}.wp-block-post-date a:where(:not(.wp-element-button)){background-color: #777;color: #555;}.wp-block-image{margin-bottom: 30px;}.wp-block-image img, .wp-block-image .components-placeholder{filter: var(--wp--preset--duotone--custom-duotone);}.wp-block-image img{border-top-left-radius: 10px;border-bottom-right-radius: 1em;}';
624+
$styles = 'body { margin: 0; }.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }body{color: var(--wp--preset--color--grey);}a:where(:not(.wp-element-button)){background-color: #333;color: #111;}.wp-element-button, .wp-block-button__link{box-shadow: 10px 10px 5px 0px rgba(0,0,0,0.66);}.wp-block-group{background: var(--wp--preset--gradient--custom-gradient);border-radius: 10px;padding: 24px;}.wp-block-group a:where(:not(.wp-element-button)){color: #111;}.wp-block-heading{color: #123456;}.wp-block-heading a:where(:not(.wp-element-button)){background-color: #333;color: #111;font-size: 60px;}.wp-block-post-date{color: #123456;}.wp-block-post-date a:where(:not(.wp-element-button)){background-color: #777;color: #555;}.wp-block-image{margin-bottom: 30px;}.wp-block-image img, .wp-block-image .components-placeholder{filter: var(--wp--preset--duotone--custom-duotone);}.wp-block-image img, .wp-block-image .wp-block-image__crop-area{border-top-left-radius: 10px;border-bottom-right-radius: 1em;}';
625625
$presets = '.has-grey-color{color: var(--wp--preset--color--grey) !important;}.has-grey-background-color{background-color: var(--wp--preset--color--grey) !important;}.has-grey-border-color{border-color: var(--wp--preset--color--grey) !important;}.has-custom-gradient-gradient-background{background: var(--wp--preset--gradient--custom-gradient) !important;}.has-small-font-family{font-family: var(--wp--preset--font-family--small) !important;}.has-big-font-family{font-family: var(--wp--preset--font-family--big) !important;}';
626626
$all = $variables . $styles . $presets;
627627
$this->assertSame( $all, $theme_json->get_stylesheet() );

0 commit comments

Comments
 (0)