From 7dc76c9b414d52dea7798716931ae54c5767f732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Wed, 5 May 2021 12:35:28 +0200 Subject: [PATCH 1/3] Remove negation --- lib/class-wp-theme-json.php | 2 +- packages/edit-site/src/components/editor/utils.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/class-wp-theme-json.php b/lib/class-wp-theme-json.php index 5f01af35635c9..b36e8247c14c9 100644 --- a/lib/class-wp-theme-json.php +++ b/lib/class-wp-theme-json.php @@ -251,7 +251,7 @@ class WP_Theme_JSON { ); const ELEMENTS = array( - 'link' => 'a:not(.wp-block-button_link)', + 'link' => 'a', 'h1' => 'h1', 'h2' => 'h2', 'h3' => 'h3', diff --git a/packages/edit-site/src/components/editor/utils.js b/packages/edit-site/src/components/editor/utils.js index 54aa19320397b..f35b24baec2a2 100644 --- a/packages/edit-site/src/components/editor/utils.js +++ b/packages/edit-site/src/components/editor/utils.js @@ -28,7 +28,7 @@ export const ROOT_BLOCK_SUPPORTS = [ 'textTransform', ]; export const ELEMENTS = { - link: 'a:not(.wp-block-button_link)', + link: 'a', h1: 'h1', h2: 'h2', h3: 'h3', From 03b74f611f313d826bb9f5255287d9349bbc5949 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Wed, 5 May 2021 13:01:09 +0200 Subject: [PATCH 2/3] Update client tests --- .../src/components/editor/test/global-styles-renderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/editor/test/global-styles-renderer.js b/packages/edit-site/src/components/editor/test/global-styles-renderer.js index d6a8d2da02a48..eb693f1ab570a 100644 --- a/packages/edit-site/src/components/editor/test/global-styles-renderer.js +++ b/packages/edit-site/src/components/editor/test/global-styles-renderer.js @@ -315,7 +315,7 @@ describe( 'global styles renderer', () => { }; expect( toStyles( tree, blockSelectors ) ).toEqual( - 'a:not(.wp-block-button_link){color: var(--wp--style--color--link);}body{background-color: red;}h1{font-size: 42px;}h1,h2,h3,h4,h5,h6{color: orange;}h1,h2,h3,h4,h5,h6{--wp--style--color--link: hotpink;}.has-white-color{color: white !important;}.has-white-background-color{background-color: white !important;}.has-white-border-color{border-color: white !important;}.has-black-color{color: black !important;}.has-black-background-color{background-color: black !important;}.has-black-border-color{border-color: black !important;}' + 'a{color: var(--wp--style--color--link);}body{background-color: red;}h1{font-size: 42px;}h1,h2,h3,h4,h5,h6{color: orange;}h1,h2,h3,h4,h5,h6{--wp--style--color--link: hotpink;}.has-white-color{color: white !important;}.has-white-background-color{background-color: white !important;}.has-white-border-color{border-color: white !important;}.has-black-color{color: black !important;}.has-black-background-color{background-color: black !important;}.has-black-border-color{border-color: black !important;}' ); } ); } ); From 9a89f49466d8b96a8cf22811c222d247a35867a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= Date: Wed, 5 May 2021 13:03:11 +0200 Subject: [PATCH 3/3] Update server tests --- phpunit/class-wp-theme-json-schema-v0-test.php | 4 ++-- phpunit/class-wp-theme-json-test.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/phpunit/class-wp-theme-json-schema-v0-test.php b/phpunit/class-wp-theme-json-schema-v0-test.php index c5b39199017c5..64bc0beae4182 100644 --- a/phpunit/class-wp-theme-json-schema-v0-test.php +++ b/phpunit/class-wp-theme-json-schema-v0-test.php @@ -461,11 +461,11 @@ function test_get_stylesheet() { ); $this->assertEquals( - 'body{--wp--preset--color--grey: grey;--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;}a:not(.wp-block-button_link){color: var(--wp--style--color--link);}body{color: var(--wp--preset--color--grey);}body{--wp--style--color--link: #111;}h1{font-size: 1em;}h2{font-size: 2em;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group {--wp--style--color--link: #333;}h1 ,h2 ,h3 ,h4 ,h5 ,h6 {--wp--style--color--link: #222;}.wp-block-post-title{font-size: 5em;}.wp-block-post-title {--wp--style--color--link: #555;}.wp-block-query-title{font-size: 5em;}.wp-block-query-title {--wp--style--color--link: #555;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', + 'body{--wp--preset--color--grey: grey;--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;}a{color: var(--wp--style--color--link);}body{color: var(--wp--preset--color--grey);}body{--wp--style--color--link: #111;}h1{font-size: 1em;}h2{font-size: 2em;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group {--wp--style--color--link: #333;}h1 ,h2 ,h3 ,h4 ,h5 ,h6 {--wp--style--color--link: #222;}.wp-block-post-title{font-size: 5em;}.wp-block-post-title {--wp--style--color--link: #555;}.wp-block-query-title{font-size: 5em;}.wp-block-query-title {--wp--style--color--link: #555;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', $theme_json->get_stylesheet() ); $this->assertEquals( - 'a:not(.wp-block-button_link){color: var(--wp--style--color--link);}body{color: var(--wp--preset--color--grey);}body{--wp--style--color--link: #111;}h1{font-size: 1em;}h2{font-size: 2em;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group {--wp--style--color--link: #333;}h1 ,h2 ,h3 ,h4 ,h5 ,h6 {--wp--style--color--link: #222;}.wp-block-post-title{font-size: 5em;}.wp-block-post-title {--wp--style--color--link: #555;}.wp-block-query-title{font-size: 5em;}.wp-block-query-title {--wp--style--color--link: #555;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', + 'a{color: var(--wp--style--color--link);}body{color: var(--wp--preset--color--grey);}body{--wp--style--color--link: #111;}h1{font-size: 1em;}h2{font-size: 2em;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group {--wp--style--color--link: #333;}h1 ,h2 ,h3 ,h4 ,h5 ,h6 {--wp--style--color--link: #222;}.wp-block-post-title{font-size: 5em;}.wp-block-post-title {--wp--style--color--link: #555;}.wp-block-query-title{font-size: 5em;}.wp-block-query-title {--wp--style--color--link: #555;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', $theme_json->get_stylesheet( 'block_styles' ) ); $this->assertEquals( diff --git a/phpunit/class-wp-theme-json-test.php b/phpunit/class-wp-theme-json-test.php index 3e7d51479aa63..7c555ace3f1b1 100644 --- a/phpunit/class-wp-theme-json-test.php +++ b/phpunit/class-wp-theme-json-test.php @@ -149,11 +149,11 @@ function test_get_stylesheet() { ); $this->assertEquals( - 'body{--wp--preset--color--grey: grey;--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;}a:not(.wp-block-button_link){color: var(--wp--style--color--link);}body{color: var(--wp--preset--color--grey);}a:not(.wp-block-button_link){background-color: #333;}body{--wp--style--color--link: #111;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group {--wp--style--color--link: #111;}h1,h2,h3,h4,h5,h6{color: #123456;}h1 a:not(.wp-block-button_link),h2 a:not(.wp-block-button_link),h3 a:not(.wp-block-button_link),h4 a:not(.wp-block-button_link),h5 a:not(.wp-block-button_link),h6 a:not(.wp-block-button_link){background-color: #333;font-size: 60px;}h1 ,h2 ,h3 ,h4 ,h5 ,h6 {--wp--style--color--link: #111;}.wp-block-post-title{color: #123456;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', + 'body{--wp--preset--color--grey: grey;--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;}a{color: var(--wp--style--color--link);}body{color: var(--wp--preset--color--grey);}a{background-color: #333;}body{--wp--style--color--link: #111;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group {--wp--style--color--link: #111;}h1,h2,h3,h4,h5,h6{color: #123456;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{background-color: #333;font-size: 60px;}h1 ,h2 ,h3 ,h4 ,h5 ,h6 {--wp--style--color--link: #111;}.wp-block-post-title{color: #123456;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', $theme_json->get_stylesheet() ); $this->assertEquals( - 'a:not(.wp-block-button_link){color: var(--wp--style--color--link);}body{color: var(--wp--preset--color--grey);}a:not(.wp-block-button_link){background-color: #333;}body{--wp--style--color--link: #111;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group {--wp--style--color--link: #111;}h1,h2,h3,h4,h5,h6{color: #123456;}h1 a:not(.wp-block-button_link),h2 a:not(.wp-block-button_link),h3 a:not(.wp-block-button_link),h4 a:not(.wp-block-button_link),h5 a:not(.wp-block-button_link),h6 a:not(.wp-block-button_link){background-color: #333;font-size: 60px;}h1 ,h2 ,h3 ,h4 ,h5 ,h6 {--wp--style--color--link: #111;}.wp-block-post-title{color: #123456;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', + 'a{color: var(--wp--style--color--link);}body{color: var(--wp--preset--color--grey);}a{background-color: #333;}body{--wp--style--color--link: #111;}.wp-block-group{padding-top: 12px;padding-bottom: 24px;}.wp-block-group {--wp--style--color--link: #111;}h1,h2,h3,h4,h5,h6{color: #123456;}h1 a,h2 a,h3 a,h4 a,h5 a,h6 a{background-color: #333;font-size: 60px;}h1 ,h2 ,h3 ,h4 ,h5 ,h6 {--wp--style--color--link: #111;}.wp-block-post-title{color: #123456;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', $theme_json->get_stylesheet( 'block_styles' ) ); $this->assertEquals( @@ -193,11 +193,11 @@ function test_get_stylesheet_preset_rules_come_after_block_rules() { ); $this->assertEquals( - '.wp-block-group{--wp--preset--color--grey: grey;}a:not(.wp-block-button_link){color: var(--wp--style--color--link);}.wp-block-group{color: red;}.wp-block-group.has-grey-color{color: grey !important;}.wp-block-group.has-grey-background-color{background-color: grey !important;}.wp-block-group.has-grey-border-color{border-color: grey !important;}', + '.wp-block-group{--wp--preset--color--grey: grey;}a{color: var(--wp--style--color--link);}.wp-block-group{color: red;}.wp-block-group.has-grey-color{color: grey !important;}.wp-block-group.has-grey-background-color{background-color: grey !important;}.wp-block-group.has-grey-border-color{border-color: grey !important;}', $theme_json->get_stylesheet() ); $this->assertEquals( - 'a:not(.wp-block-button_link){color: var(--wp--style--color--link);}.wp-block-group{color: red;}.wp-block-group.has-grey-color{color: grey !important;}.wp-block-group.has-grey-background-color{background-color: grey !important;}.wp-block-group.has-grey-border-color{border-color: grey !important;}', + 'a{color: var(--wp--style--color--link);}.wp-block-group{color: red;}.wp-block-group.has-grey-color{color: grey !important;}.wp-block-group.has-grey-background-color{background-color: grey !important;}.wp-block-group.has-grey-border-color{border-color: grey !important;}', $theme_json->get_stylesheet( 'block_styles' ) ); } @@ -234,7 +234,7 @@ public function test_get_stylesheet_preset_values_are_marked_as_important() { ); $this->assertEquals( - 'body{--wp--preset--color--grey: grey;}a:not(.wp-block-button_link){color: var(--wp--style--color--link);}p{background-color: blue;color: red;font-size: 12px;line-height: 1.3;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', + 'body{--wp--preset--color--grey: grey;}a{color: var(--wp--style--color--link);}p{background-color: blue;color: red;font-size: 12px;line-height: 1.3;}.has-grey-color{color: grey !important;}.has-grey-background-color{background-color: grey !important;}.has-grey-border-color{border-color: grey !important;}', $theme_json->get_stylesheet() ); }