Merge "Sanitizer::escapeId: Decode entity before replacing spaces"
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / CSSJanusTest.php
index c8b20d2..e4283b0 100644 (file)
@@ -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'
+                       );
                }
        }
 
@@ -221,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,