X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Flibs%2FCSSJanusTest.php;h=e4283b0bf57587af2e50925add72ebce6434d5bf;hb=eddce194b22b80f46ce578362250bb402312c7a2;hp=5a3c161980265bb40bc7f7055f815169dff5554d;hpb=7a9011cc01ae2aa0f7b4a696c0deca46b24df0b5;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/libs/CSSJanusTest.php b/tests/phpunit/includes/libs/CSSJanusTest.php index 5a3c161980..e4283b0bf5 100644 --- a/tests/phpunit/includes/libs/CSSJanusTest.php +++ b/tests/phpunit/includes/libs/CSSJanusTest.php @@ -15,15 +15,27 @@ class CSSJanusTest extends MediaWikiTestCase { if ( $cssB ) { $transformedA = CSSJanus::transform( $cssA ); - $this->assertEquals( $transformedA, $cssB, 'Test A-B transformation' ); + $this->assertEquals( + $transformedA, + str_replace( '/* @noflip */ ', '', $cssB ), + 'Test A-B transformation' + ); $transformedB = CSSJanus::transform( $cssB ); - $this->assertEquals( $transformedB, $cssA, 'Test B-A transformation' ); + $this->assertEquals( + $transformedB, + str_replace( '/* @noflip */ ', '', $cssA ), + 'Test B-A transformation' + ); } else { // If no B version is provided, it means - // the output should equal the input. + // the output should equal the input (modulo @noflip annotations). $transformedA = CSSJanus::transform( $cssA ); - $this->assertEquals( $transformedA, $cssA, 'Nothing was flipped' ); + $this->assertEquals( + $transformedA, + str_replace( '/* @noflip */ ', '', $cssA ), + 'Nothing was flipped' + ); } } @@ -31,8 +43,10 @@ class CSSJanusTest extends MediaWikiTestCase { * @dataProvider provideTransformAdvancedCases */ public function testTransformAdvanced( $code, $expectedOutput, $options = array() ) { - $swapLtrRtlInURL = isset( $options['swapLtrRtlInURL'] ) ? $options['swapLtrRtlInURL'] : false; - $swapLeftRightInURL = isset( $options['swapLeftRightInURL'] ) ? $options['swapLeftRightInURL'] : false; + $swapLtrRtlInURL = isset( $options['swapLtrRtlInURL'] ) ? + $options['swapLtrRtlInURL'] : false; + $swapLeftRightInURL = isset( $options['swapLeftRightInURL'] ) ? + $options['swapLeftRightInURL'] : false; $flipped = CSSJanus::transform( $code, $swapLtrRtlInURL, $swapLeftRightInURL ); @@ -219,6 +233,11 @@ class CSSJanusTest extends MediaWikiTestCase { // Don't mangle zeroes '.foo { text-shadow: orange 0 2px; }' ), + array( + // Make sure floats are not considered zero + '.foo { box-shadow: inset .5em 0 0 white; }', + '.foo { box-shadow: inset -.5em 0 0 white; }', + ), // Direction // Note: This differs from the Python implementation, @@ -437,6 +456,26 @@ class CSSJanusTest extends MediaWikiTestCase { 'div { float: left; /* @noflip */ text-align: left; }', 'div { float: right; /* @noflip */ text-align: left; }' ), + array( + // before a *= attribute selector with multiple properties + '/* @noflip */ div.foo[bar*=baz] { float:left; clear: left; }' + ), + array( + // before a ^= attribute selector with multiple properties + '/* @noflip */ div.foo[bar^=baz] { float:left; clear: left; }' + ), + array( + // before a ~= attribute selector with multiple properties + '/* @noflip */ div.foo[bar~=baz] { float:left; clear: left; }' + ), + array( + // before a = attribute selector with multiple properties + '/* @noflip */ div.foo[bar=baz] { float:left; clear: left; }' + ), + array( + // before a quoted attribute selector with multiple properties + '/* @noflip */ div.foo[bar=\'baz{quux\'] { float:left; clear: left; }' + ), // Guard against css3 stuff array(