Skip to content

Commit

Permalink
whitespace fixes in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Aug 3, 2022
1 parent 9cce0a3 commit 2ccd54e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function test_generate_css_declarations_string() {
$css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );

$this->assertSame(
'color: red; border-top-left-radius: 99px; text-decoration: underline;',
'color:red;border-top-left-radius:99px;text-decoration:underline;',
$css_declarations->get_declarations_string()
);
}
Expand All @@ -101,7 +101,7 @@ public function test_remove_unsafe_properties_and_values() {
$css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );

$this->assertSame(
'color: <red/>; margin-right: 10em;',
'margin-right:10em;',
$css_declarations->get_declarations_string()
);
}
Expand All @@ -118,13 +118,13 @@ public function test_remove_declaration() {
$css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );

$this->assertSame(
'color: tomato; margin: 10em 10em 20em 1px; font-family: Happy Font serif;',
'color:tomato;margin:10em 10em 20em 1px;font-family:Happy Font serif;',
$css_declarations->get_declarations_string()
);

$css_declarations->remove_declaration( 'color' );
$this->assertSame(
'margin: 10em 10em 20em 1px; font-family: Happy Font serif;',
'margin:10em 10em 20em 1px;font-family:Happy Font serif;',
$css_declarations->get_declarations_string()
);
}
Expand All @@ -141,7 +141,7 @@ public function test_remove_declarations() {
$css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );

$this->assertSame(
'color: cucumber; margin: 10em 10em 20em 1px; font-family: Happy Font serif;',
'color:cucumber;margin:10em 10em 20em 1px;font-family:Happy Font serif;',
$css_declarations->get_declarations_string()
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function test_instantiate_with_selector_and_rules() {

$this->assertSame( $selector, $css_rule->get_selector() );

$expected = "$selector {{$css_declarations->get_declarations_string()}}";
$expected = "$selector{{$css_declarations->get_declarations_string()}}";
$this->assertSame( $expected, $css_rule->get_css() );
}

Expand All @@ -45,7 +45,7 @@ public function test_dedupe_properties_in_rules() {
$css_rule = new WP_Style_Engine_CSS_Rule( $selector, $first_declaration );
$css_rule->add_declarations( new WP_Style_Engine_CSS_Declarations( $overwrite_first_declaration ) );

$expected = '.taggart {font-size: 4px;}';
$expected = '.taggart{font-size:4px;}';
$this->assertSame( $expected, $css_rule->get_css() );
}

Expand All @@ -60,7 +60,7 @@ public function test_add_declarations() {
$css_rule = new WP_Style_Engine_CSS_Rule( '.hill-street-blues', $some_css_declarations );
$css_rule->add_declarations( $some_more_css_declarations );

$expected = '.hill-street-blues {margin-top: 10px; font-size: 1rem;}';
$expected = '.hill-street-blues{margin-top:10px;font-size:1rem;}';
$this->assertSame( $expected, $css_rule->get_css() );
}

Expand Down Expand Up @@ -89,7 +89,7 @@ public function test_get_css() {
);
$css_declarations = new WP_Style_Engine_CSS_Declarations( $input_declarations );
$css_rule = new WP_Style_Engine_CSS_Rule( $selector, $css_declarations );
$expected = "$selector {{$css_declarations->get_declarations_string()}}";
$expected = "$selector{{$css_declarations->get_declarations_string()}}";

$this->assertSame( $expected, $css_rule->get_css() );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public function test_add_rule() {
$new_pie_store = WP_Style_Engine_CSS_Rules_Store::get_store( 'meat-pie' );
$selector = '.wp-block-sauce a:hover';
$store_rule = $new_pie_store->add_rule( $selector );
$expected = "$selector {}";
$expected = '';
$this->assertEquals( $expected, $store_rule->get_css() );

$pie_declarations = array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function test_return_rules_as_css() {
$a_nice_processor = new WP_Style_Engine_Processor();
$a_nice_processor->add_rules( array( $a_nice_css_rule, $a_nicer_css_rule ) );
$this->assertEquals(
'.a-nice-rule {color: var(--nice-color); background-color: purple;}.a-nicer-rule {font-family: Nice sans; font-size: 1em; background-color: purple;}',
'.a-nice-rule{color:var(--nice-color);background-color:purple;}.a-nicer-rule{font-family:Nice sans;font-size:1em;background-color:purple;}',
$a_nice_processor->get_css()
);
}
Expand All @@ -62,7 +62,7 @@ public function test_return_store_rules_as_css() {
$a_nice_renderer = new WP_Style_Engine_Processor();
$a_nice_renderer->add_store( $a_nice_store );
$this->assertEquals(
'.a-nice-rule {color: var(--nice-color); background-color: purple;}.a-nicer-rule {font-family: Nice sans; font-size: 1em; background-color: purple;}',
'.a-nice-rule{color:var(--nice-color);background-color:purple;}.a-nicer-rule{font-family:Nice sans;font-size:1em;background-color:purple;}',
$a_nice_renderer->get_css()
);
}
Expand Down Expand Up @@ -91,7 +91,7 @@ public function test_dedupe_and_merge_css_declarations() {
);
$an_excellent_processor->add_rules( $another_excellent_rule );
$this->assertEquals(
'.an-excellent-rule {color: var(--excellent-color); border-style: dotted; border-color: brown;}',
'.an-excellent-rule{color:var(--excellent-color);border-style:dotted;border-color:brown;}',
$an_excellent_processor->get_css()
);

Expand All @@ -105,7 +105,7 @@ public function test_dedupe_and_merge_css_declarations() {
);
$an_excellent_processor->add_rules( $yet_another_excellent_rule );
$this->assertEquals(
'.an-excellent-rule {color: var(--excellent-color); border-style: dashed; border-color: brown; border-width: 2px;}',
'.an-excellent-rule{color:var(--excellent-color);border-style:dashed;border-color:brown;border-width:2px;}',
$an_excellent_processor->get_css()
);
}
Expand Down Expand Up @@ -194,7 +194,7 @@ public function test_combine_previously_added_css_rules() {
)
);
$a_lovely_processor->add_rules( $a_lovelier_rule );
$this->assertEquals( '.a-lovely-rule,.a-lovelier-rule {border-color: purple;}', $a_lovely_processor->get_css() );
$this->assertEquals( '.a-lovely-rule,.a-lovelier-rule{border-color:purple;}', $a_lovely_processor->get_css() );

$a_most_lovely_rule = new WP_Style_Engine_CSS_Rule(
'.a-most-lovely-rule',
Expand Down
30 changes: 15 additions & 15 deletions packages/style-engine/phpunit/class-wp-style-engine-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function data_get_styles_fixtures() {
),
'options' => array( 'convert_vars_to_classnames' => true ),
'expected_output' => array(
'css' => 'border-style: dotted; border-width: 2rem; padding: 0; margin: 111px;',
'css' => 'border-style:dotted;border-width:2rem;padding:0;margin:111px;',
'declarations' => array(
'border-style' => 'dotted',
'border-width' => '2rem',
Expand All @@ -125,7 +125,7 @@ public function data_get_styles_fixtures() {
'context' => 'block-supports',
),
'expected_output' => array(
'css' => 'margin: 20px;',
'css' => 'margin:20px;',
'declarations' => array(
'margin' => '20px',
),
Expand Down Expand Up @@ -176,7 +176,7 @@ public function data_get_styles_fixtures() {
),
'options' => null,
'expected_output' => array(
'css' => 'border-top-left-radius: 99px; border-top-right-radius: 98px; border-bottom-left-radius: 97px; border-bottom-right-radius: 96px; padding-top: 42px; padding-left: 2%; padding-bottom: 44px; padding-right: 5rem; margin-top: 12rem; margin-left: 2vh; margin-bottom: 2px; margin-right: 10em;',
'css' => 'border-top-left-radius:99px;border-top-right-radius:98px;border-bottom-left-radius:97px;border-bottom-right-radius:96px;padding-top:42px;padding-left:2%;padding-bottom:44px;padding-right:5rem;margin-top:12rem;margin-left:2vh;margin-bottom:2px;margin-right:10em;',
'declarations' => array(
'border-top-left-radius' => '99px',
'border-top-right-radius' => '98px',
Expand Down Expand Up @@ -209,7 +209,7 @@ public function data_get_styles_fixtures() {
),
'options' => null,
'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;',
'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;',
'declarations' => array(
'font-size' => 'clamp(2em, 2vw, 4em)',
'font-family' => 'Roboto,Oxygen-Sans,Ubuntu,sans-serif',
Expand All @@ -236,7 +236,7 @@ public function data_get_styles_fixtures() {
),
'options' => array( 'selector' => '.wp-selector > p' ),
'expected_output' => array(
'css' => '.wp-selector > p {padding-top: 42px; padding-left: 2%; padding-bottom: 44px; padding-right: 5rem;}',
'css' => '.wp-selector > p{padding-top:42px;padding-left:2%;padding-bottom:44px;padding-right:5rem;}',
'declarations' => array(
'padding-top' => '42px',
'padding-left' => '2%',
Expand All @@ -256,7 +256,7 @@ public function data_get_styles_fixtures() {
'selector' => '.wp-selector',
),
'expected_output' => array(
'css' => '.wp-selector {color: var(--wp--preset--color--my-little-pony);}',
'css' => '.wp-selector{color:var(--wp--preset--color--my-little-pony);}',
'declarations' => array(
'color' => 'var(--wp--preset--color--my-little-pony)',
),
Expand Down Expand Up @@ -302,7 +302,7 @@ public function data_get_styles_fixtures() {
),
'options' => array(),
'expected_output' => array(
'css' => 'color: var(--wp--preset--color--teal-independents);',
'css' => 'color:var(--wp--preset--color--teal-independents);',
'declarations' => array(
'color' => 'var(--wp--preset--color--teal-independents)',
),
Expand All @@ -319,7 +319,7 @@ public function data_get_styles_fixtures() {
),
'options' => array(),
'expected_output' => array(
'css' => 'color: #fff;',
'css' => 'color:#fff;',
'declarations' => array(
'color' => '#fff',
),
Expand Down Expand Up @@ -353,7 +353,7 @@ public function data_get_styles_fixtures() {
),
'options' => array(),
'expected_output' => array(
'css' => 'padding: var(--wp--preset--spacing--20); margin: var(--wp--preset--spacing--10);',
'css' => 'padding:var(--wp--preset--spacing--20);margin:var(--wp--preset--spacing--10);',
'declarations' => array(
'padding' => 'var(--wp--preset--spacing--20)',
'margin' => 'var(--wp--preset--spacing--10)',
Expand All @@ -380,7 +380,7 @@ public function data_get_styles_fixtures() {
),
'options' => array(),
'expected_output' => array(
'css' => 'padding-left: var(--wp--preset--spacing--30); padding-right: var(--wp--preset--spacing--40); padding-top: 14px; padding-bottom: 14px; margin-left: var(--wp--preset--spacing--10); margin-right: var(--wp--preset--spacing--20); margin-top: 1rem; margin-bottom: 1rem;',
'css' => 'padding-left:var(--wp--preset--spacing--30);padding-right:var(--wp--preset--spacing--40);padding-top:14px;padding-bottom:14px;margin-left:var(--wp--preset--spacing--10);margin-right:var(--wp--preset--spacing--20);margin-top:1rem;margin-bottom:1rem;',
'declarations' => array(
'padding-left' => 'var(--wp--preset--spacing--30)',
'padding-right' => 'var(--wp--preset--spacing--40)',
Expand All @@ -407,7 +407,7 @@ public function data_get_styles_fixtures() {
),
'options' => array(),
'expected_output' => array(
'css' => 'margin-top: 1rem; margin-bottom: 0;',
'css' => 'margin-top:1rem;margin-bottom:0;',
'declarations' => array(
'margin-top' => '1rem',
'margin-bottom' => '0',
Expand Down Expand Up @@ -456,7 +456,7 @@ public function data_get_styles_fixtures() {
),
'options' => array(),
'expected_output' => array(
'css' => 'border-top-color: #fe1; border-top-width: 1.5rem; border-top-style: dashed; border-right-color: #fe2; border-right-width: 1.4rem; border-right-style: solid; border-bottom-color: #fe3; border-bottom-width: 1.3rem; border-left-color: var(--wp--preset--color--swampy-yellow); border-left-width: 0.5rem; border-left-style: dotted;',
'css' => 'border-top-color:#fe1;border-top-width:1.5rem;border-top-style:dashed;border-right-color:#fe2;border-right-width:1.4rem;border-right-style:solid;border-bottom-color:#fe3;border-bottom-width:1.3rem;border-left-color:var(--wp--preset--color--swampy-yellow);border-left-width:0.5rem;border-left-style:dotted;',
'declarations' => array(
'border-top-color' => '#fe1',
'border-top-width' => '1.5rem',
Expand Down Expand Up @@ -499,7 +499,7 @@ public function data_get_styles_fixtures() {
),
'options' => array(),
'expected_output' => array(
'css' => 'border-bottom-color: var(--wp--preset--color--terrible-lizard);',
'css' => 'border-bottom-color:var(--wp--preset--color--terrible-lizard);',
'declarations' => array(
'border-bottom-color' => 'var(--wp--preset--color--terrible-lizard)',
),
Expand Down Expand Up @@ -610,7 +610,7 @@ public function test_get_stylesheet_from_css_rules() {
);

$compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules );
$this->assertSame( '.saruman {color: white; height: 100px; border-style: solid; align-self: unset;}.gandalf {color: grey; height: 90px; border-style: dotted; align-self: safe center;}.radagast {color: brown; height: 60px; border-style: dashed; align-self: stretch;}', $compiled_stylesheet );
$this->assertSame( '.saruman{color:white;height:100px;border-style:solid;align-self:unset;}.gandalf{color:grey;height:90px;border-style:dotted;align-self:safe center;}.radagast{color:brown;height:60px;border-style:dashed;align-self:stretch;}', $compiled_stylesheet );
}

/**
Expand Down Expand Up @@ -654,6 +654,6 @@ public function test_get_deduped_and_merged_stylesheet() {
);

$compiled_stylesheet = wp_style_engine_get_stylesheet_from_css_rules( $css_rules );
$this->assertSame( '.gandalf {color: white; height: 190px; border-style: dotted; padding: 10px; margin-bottom: 100px;}.dumbledore,.rincewind {color: grey; height: 90px; border-style: dotted;}', $compiled_stylesheet );
$this->assertSame( '.gandalf{color:white;height:190px;border-style:dotted;padding:10px;margin-bottom:100px;}.dumbledore,.rincewind{color:grey;height:90px;border-style:dotted;}', $compiled_stylesheet );
}
}

0 comments on commit 2ccd54e

Please sign in to comment.