Skip to content

Commit

Permalink
Adding whitespace to inline output
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Apr 7, 2022
1 parent 45f1519 commit 48e733f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions packages/style-engine/class-wp-style-engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ public function generate( $block_styles, $options = array() ) {
// Generate inline style rules.
if ( isset( $options['inline'] ) && true === $options['inline'] ) {
foreach ( $rules as $rule => $value ) {
$filtered_css = esc_html( safecss_filter_attr( "{$rule}:{$value}" ) );
$filtered_css = esc_html( safecss_filter_attr( "{$rule}: {$value}" ) );
if ( ! empty( $filtered_css ) ) {
$output .= $filtered_css . ';';
$output .= $filtered_css . '; ';
}
}
}
}

return $output;
return trim( $output );
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/style-engine/phpunit/class-wp-style-engine-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function data_block_styles_fixtures() {
'path' => array( 'spacing', 'margin' ),
'inline' => true,
),
'expected_output' => 'margin:111px;',
'expected_output' => 'margin: 111px;',
),

'inline_valid_single_style' => array(
Expand All @@ -128,7 +128,7 @@ public function data_block_styles_fixtures() {
'path' => array( 'spacing', 'padding' ),
'inline' => true,
),
'expected_output' => 'padding-top:42px;padding-left:2%;padding-bottom:44px;padding-right:5rem;',
'expected_output' => 'padding-top: 42px; padding-left: 2%; padding-bottom: 44px; padding-right: 5rem;',
),

'inline_valid_multiple_spacing_style' => array(
Expand All @@ -151,7 +151,7 @@ public function data_block_styles_fixtures() {
'options' => array(
'inline' => true,
),
'expected_output' => 'padding-top:42px;padding-left:2%;padding-bottom:44px;padding-right:5rem;margin-top:12rem;margin-left:2vh;margin-bottom:2px;margin-right:10em;',
'expected_output' => 'padding-top: 42px; padding-left: 2%; padding-bottom: 44px; padding-right: 5rem; margin-top: 12rem; margin-left: 2vh; margin-bottom: 2px; margin-right: 10em;',
),

'inline_valid_multiple_typography_style' => array(
Expand All @@ -170,7 +170,7 @@ public function data_block_styles_fixtures() {
'options' => array(
'inline' => true,
),
'expected_output' => 'font-family:Roboto,Oxygen-Sans,Ubuntu,sans-serif;font-style:italic;font-weight:800;line-height:1.3;text-decoration:underline;text-transform:uppercase;letter-spacing:2;',
'expected_output' => 'font-family: Roboto,Oxygen-Sans,Ubuntu,sans-serif; font-style: italic; font-weight: 800; line-height: 1.3; text-decoration: underline; text-transform: uppercase; letter-spacing: 2;',
),
);
}
Expand Down

0 comments on commit 48e733f

Please sign in to comment.