Skip to content

Commit e42e65d

Browse files
committed
Editor: Update the ThemeJson unit test to cover custom CSS feature.
In #59499 a fix have been shipped to theme.json custom CSS when applied to blocks with multiple CSS selectors. This commit covers that fix with a unit test. Props wildworks. Fixes #60294. git-svn-id: https://develop.svn.wordpress.org/trunk@57333 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d0262ec commit e42e65d

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

tests/phpunit/tests/theme/wpThemeJson.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4688,29 +4688,37 @@ public function test_process_blocks_custom_css( $input, $expected ) {
46884688
*/
46894689
public function data_process_blocks_custom_css() {
46904690
return array(
4691-
// Simple CSS without any child selectors.
4692-
'no child selectors' => array(
4691+
// Simple CSS without any nested selectors.
4692+
'no nested selectors' => array(
46934693
'input' => array(
46944694
'selector' => '.foo',
46954695
'css' => 'color: red; margin: auto;',
46964696
),
46974697
'expected' => '.foo{color: red; margin: auto;}',
46984698
),
4699-
// CSS with child selectors.
4700-
'with children' => array(
4699+
// CSS with nested selectors.
4700+
'with nested selector' => array(
47014701
'input' => array(
47024702
'selector' => '.foo',
4703-
'css' => 'color: red; margin: auto; & .bar{color: blue;}',
4703+
'css' => 'color: red; margin: auto; &.one{color: blue;} & .two{color: green;}',
47044704
),
4705-
'expected' => '.foo{color: red; margin: auto;}.foo .bar{color: blue;}',
4705+
'expected' => '.foo{color: red; margin: auto;}.foo.one{color: blue;}.foo .two{color: green;}',
47064706
),
4707-
// CSS with child selectors and pseudo elements.
4708-
'with children and pseudo elements' => array(
4707+
// CSS with pseudo elements.
4708+
'with pseudo elements' => array(
47094709
'input' => array(
47104710
'selector' => '.foo',
4711-
'css' => 'color: red; margin: auto; & .bar{color: blue;} &::before{color: green;}',
4711+
'css' => 'color: red; margin: auto; &::before{color: blue;} & ::before{color: green;} &.one::before{color: yellow;} & .two::before{color: purple;}',
47124712
),
4713-
'expected' => '.foo{color: red; margin: auto;}.foo .bar{color: blue;}.foo::before{color: green;}',
4713+
'expected' => '.foo{color: red; margin: auto;}.foo::before{color: blue;}.foo ::before{color: green;}.foo.one::before{color: yellow;}.foo .two::before{color: purple;}',
4714+
),
4715+
// CSS with multiple root selectors.
4716+
'with multiple root selectors' => array(
4717+
'input' => array(
4718+
'selector' => '.foo, .bar',
4719+
'css' => 'color: red; margin: auto; &.one{color: blue;} & .two{color: green;} &::before{color: yellow;} & ::before{color: purple;} &.three::before{color: orange;} & .four::before{color: skyblue;}',
4720+
),
4721+
'expected' => '.foo, .bar{color: red; margin: auto;}.foo.one, .bar.one{color: blue;}.foo .two, .bar .two{color: green;}.foo::before, .bar::before{color: yellow;}.foo ::before, .bar ::before{color: purple;}.foo.three::before, .bar.three::before{color: orange;}.foo .four::before, .bar .four::before{color: skyblue;}',
47144722
),
47154723
);
47164724
}

0 commit comments

Comments
 (0)