Skip to content

Commit

Permalink
Removed options arg until we need it. Thanks, linter.
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonjd committed Apr 14, 2022
1 parent 6f35126 commit 44949c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 21 deletions.
5 changes: 2 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,14 @@ protected static function get_classnames( $style, $style_definition ) {
* Styles are bundled based on the instructions in BLOCK_STYLE_DEFINITIONS_METADATA.
*
* @param array $block_styles An array of styles from a block's attributes.
* @param array $options An optional array of options.
*
* @return array|null array(
* 'styles' => (string) A CSS ruleset formatted to be placed in an HTML `style` attribute or tag.
* 'classnames' => (string) Classnames separated by a space.
* );
*/
public function generate( $block_styles, $options = array() ) {
if ( empty( $block_styles ) ) {
public function generate( $block_styles ) {
if ( empty( $block_styles ) || ! is_array( $block_styles ) ) {
return null;
}

Expand Down
21 changes: 3 additions & 18 deletions packages/style-engine/phpunit/class-wp-style-engine-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,9 @@ class WP_Style_Engine_Test extends WP_UnitTestCase {
*
* @dataProvider data_generate_styles_fixtures
*/
function test_generate_styles( $block_styles, $options, $expected_output ) {
function test_generate_styles( $block_styles, $expected_output ) {
$style_engine = wp_get_style_engine();
$generated_styles = $style_engine->generate(
$block_styles,
$options
);
$generated_styles = $style_engine->generate( $block_styles );
$this->assertSame( $expected_output, $generated_styles );
}

Expand All @@ -35,29 +32,25 @@ public function data_generate_styles_fixtures() {
return array(
'default_return_value' => array(
'block_styles' => array(),
'options' => null,
'expected_output' => null,
),

'inline_invalid_block_styles_empty' => array(
'block_styles' => array(),
'options' => array(),
'block_styles' => 'hello world!',
'expected_output' => null,
),

'inline_invalid_block_styles_unknown_style' => array(
'block_styles' => array(
'pageBreakAfter' => 'verso',
),
'options' => array(),
'expected_output' => array(),
),

'inline_invalid_block_styles_unknown_definition' => array(
'block_styles' => array(
'pageBreakAfter' => 'verso',
),
'options' => array(),
'expected_output' => array(),
),

Expand All @@ -67,7 +60,6 @@ public function data_generate_styles_fixtures() {
'gap' => '1000vw',
),
),
'options' => array(),
'expected_output' => array(),
),

Expand All @@ -82,7 +74,6 @@ public function data_generate_styles_fixtures() {
'margin' => '111px',
),
),
'options' => array(),
'expected_output' => array(
'css' => 'margin: 111px;',
'classnames' => 'has-text-color has-texas-flood-color',
Expand All @@ -106,7 +97,6 @@ public function data_generate_styles_fixtures() {
),
),
),
'options' => array(),
'expected_output' => array(
'css' => 'padding-top: 42px; padding-left: 2%; padding-bottom: 44px; padding-right: 5rem; margin-top: 12rem; margin-left: 2vh; margin-bottom: 2px; margin-right: 10em;',
),
Expand All @@ -125,7 +115,6 @@ public function data_generate_styles_fixtures() {
'letterSpacing' => '2',
),
),
'options' => array(),
'expected_output' => array(
'css' => '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 All @@ -152,7 +141,6 @@ public function data_generate_styles_fixtures() {
),
),
),
'options' => array(),
'expected_output' => array(
'classnames' => 'has-text-color has-copper-socks-color has-background has-splendid-carrot-background-color has-like-wow-dude-gradient-background has-fantastic-font-size has-totally-awesome-font-family',
),
Expand All @@ -170,7 +158,6 @@ public function data_generate_styles_fixtures() {
),
),
),
'options' => array(),
'expected_output' => array(
'css' => 'color: #fff;',
'classnames' => 'has-text-color',
Expand All @@ -187,7 +174,6 @@ public function data_generate_styles_fixtures() {
),
),
),
'options' => array(),
'expected_output' => array(),
),
'invalid_classnames_options' => array(
Expand All @@ -201,7 +187,6 @@ public function data_generate_styles_fixtures() {
),
),
),
'options' => array(),
'expected_output' => array(),
),
);
Expand Down

0 comments on commit 44949c6

Please sign in to comment.