Skip to content

Commit 71daabc

Browse files
Block supports: Test that element styles do not output translate
1 parent 7aaae74 commit 71daabc

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎packages/block-editor/src/hooks/test/style.jsdom.test.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,13 +570,15 @@ describe( 'getElementCSSRules', () => {
570570
},
571571
heading: rotate,
572572
h1: rotate,
573+
h2: { transform: { translate: { x: '10px' } } },
573574
},
574575
'core/group',
575576
'.wp-elements-1'
576577
);
577578

578579
expect( css ).toContain( 'color: red;' );
579580
expect( css ).not.toContain( 'rotate' );
581+
expect( css ).not.toContain( 'translate' );
580582
} );
581583
} );
582584

@@ -640,7 +642,10 @@ describe( 'getResponsiveStateCSSRules', () => {
640642
elements: {
641643
link: {
642644
color: { text: 'red' },
643-
transform: { rotate: '10deg' },
645+
transform: {
646+
rotate: '10deg',
647+
translate: { x: '10px' },
648+
},
644649
},
645650
},
646651
},
@@ -651,6 +656,7 @@ describe( 'getResponsiveStateCSSRules', () => {
651656

652657
expect( rules.join( '' ) ).toContain( 'color: red' );
653658
expect( rules.join( '' ) ).not.toContain( 'rotate' );
659+
expect( rules.join( '' ) ).not.toContain( 'translate' );
654660
} );
655661

656662
it( 'routes a viewport rotation through the transform feature selector', () => {

‎phpunit/block-supports/elements-test.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,6 +393,7 @@ public function data_elements_block_support_styles() {
393393
),
394394
'heading' => array( 'transform' => array( 'rotate' => '10deg' ) ),
395395
'h1' => array( 'transform' => array( 'rotate' => '10deg' ) ),
396+
'h2' => array( 'transform' => array( 'translate' => array( 'x' => '10px' ) ) ),
396397
),
397398
'expected_styles' => '/^.wp-elements-(?:[a-f0-9]{32}|[0-9]+) a:where\(:not\(.wp-element-button\)\)' . $color_css_rules . '$/',
398399
),

‎phpunit/block-supports/states-test.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,8 @@ public function test_responsive_element_transform_is_not_output() {
15161516
),
15171517
':hover' => array(
15181518
'transform' => array(
1519-
'rotate' => '20deg',
1519+
'rotate' => '20deg',
1520+
'translate' => array( 'x' => '10px' ),
15201521
),
15211522
),
15221523
),
@@ -1531,6 +1532,7 @@ public function test_responsive_element_transform_is_not_output() {
15311532

15321533
$this->assertStringContainsString( 'color:#00ff00 !important;', $actual_stylesheet );
15331534
$this->assertStringNotContainsString( 'rotate', $actual_stylesheet );
1535+
$this->assertStringNotContainsString( 'translate', $actual_stylesheet );
15341536
}
15351537

15361538
/**

0 commit comments

Comments
 (0)