File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
tests/phpunit/tests/blocks Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -128,4 +128,32 @@ public function test_register_block_style_with_label() {
128128 'The registered block style should have the same label. '
129129 );
130130 }
131+
132+ /**
133+ * Should register the block style when `label` is missing, using `name` as the label.
134+ *
135+ * @ticket 52592
136+ *
137+ * @covers WP_Block_Styles_Registry::register
138+ * @covers WP_Block_Styles_Registry::is_registered
139+ * @covers WP_Block_Styles_Registry::get_registered_styles_for_block
140+ */
141+ public function test_register_block_style_without_label () {
142+ $ name = 'core/paragraph ' ;
143+ $ style_properties = array (
144+ 'name ' => 'fancy ' ,
145+ );
146+ $ result = $ this ->registry ->register ( $ name , $ style_properties );
147+
148+ $ this ->assertTrue ( $ result , 'The block style should be registered when the label is missing. ' );
149+ $ this ->assertTrue (
150+ $ this ->registry ->is_registered ( $ name , 'fancy ' ),
151+ 'The block type should have the block style registered when the label is missing. '
152+ );
153+ $ this ->assertEquals (
154+ $ style_properties ['name ' ],
155+ $ this ->registry ->get_registered_styles_for_block ( $ name )['fancy ' ]['label ' ],
156+ 'The registered block style should have a name and label equal. '
157+ );
158+ }
131159}
You can’t perform that action at this time.
0 commit comments