' . $input . '' ); $block = new WP_Block( $parsed_blocks[0] ); $actual = $block->render(); $this->assertSame( $expected_result, $actual ); } public function data_css_class_examples() { return array( 'should add a class name to a vanilla p element' => array( '
Hello World
', 'Hello World
', ), 'should not add a class name to a div element' => array( 'Hello World
', 'Hello World
', ), 'should handle single quotes' => array( "Hello World
", 'Hello World
', ), 'should handle single quotes with double quotes inside' => array( "Hello World
", 'Hello World
', ), 'should not add a class name even when it is already defined' => array( 'Hello World
', 'Hello World
', ), 'should add a class name even when there are other HTML attributes present' => array( 'Hello World
', 'Hello World
', ), 'should add a class name even when the class attribute is already defined and has many entries' => array( 'Hello World
', 'Hello World
', ), 'should not add a class name to a nested p' => array( 'Hello World
', 'Hello World
', ), 'should not add a class name to a nested p when the parent has another attribute' => array( 'Hello World
', 'Hello World
', ), 'should add a class name even when the class attribute is surrounded by other attributes' => array( 'Hello World
', 'Hello World
', ), 'should add a class name without getting confused when there is a tricky data-class attribute present' => array( 'Hello World
', 'Hello World
', ), ); } }