Merge "resourceloader: Make various CSSMin performance optimizations and cleanups"
[lhc/web/wiklou.git] / tests / phpunit / includes / libs / CSSMinTest.php
index cc2fda9..354dae2 100644 (file)
@@ -35,7 +35,7 @@ class CSSMinTest extends MediaWikiTestCase {
        public static function provideSerializeStringValue() {
                return [
                        [ 'Hello World!', '"Hello World!"' ],
-                       [ "Null\0Null", "\"Null\\fffd Null\"" ],
+                       [ "Null\0Null", "\"Null\xEF\xBF\xBDNull\"" ],
                        [ '"', '"\\""' ],
                        [ "'", '"\'"' ],
                        [ "\\", '"\\\\"' ],
@@ -322,6 +322,10 @@ class CSSMinTest extends MediaWikiTestCase {
                                [ 'background-image: url("");', false, '/example', false ],
                                'background-image: url("");',
                        ],
+                       'Single quote with outer spacing' => [
+                               [ "background-image: url( '' );", false, '/example', false ],
+                               "background-image: url( '' );",
+                       ],
                ];
        }
 
@@ -396,6 +400,11 @@ class CSSMinTest extends MediaWikiTestCase {
                                'foo { background: url(/static/foo.png?query=yes); }',
                                'foo { background: url(https://expand.example/static/foo.png?query=yes); }',
                        ],
+                       [
+                               'Path-relative URL with query',
+                               "foo { background: url(?query=yes); }",
+                               'foo { background: url(http://localhost/w/?query=yes); }',
+                       ],
                        [
                                'Remote URL (unnecessary quotes not preserved)',
                                'foo { background: url("http://example.org/w/unnecessary-quotes.png"); }',
@@ -521,7 +530,7 @@ class CSSMinTest extends MediaWikiTestCase {
                                'foo { background: url(//localhost/styles.css?quoted=single) }',
                        ],
                        [
-                               'Background URL (containing parentheses; T60473)',
+                               'Background URL (double quoted, containing parentheses; T60473)',
                                'foo { background: url("//localhost/styles.css?query=(parens)") }',
                                'foo { background: url("//localhost/styles.css?query=(parens)") }',
                        ],
@@ -535,6 +544,16 @@ class CSSMinTest extends MediaWikiTestCase {
                                'foo { background: url(\'//localhost/styles.css?quote="\') }',
                                'foo { background: url("//localhost/styles.css?quote=\"") }',
                        ],
+                       [
+                               'Background URL (double quoted with outer spacing)',
+                               'foo { background: url( "http://localhost/styles.css?quoted=double" ) }',
+                               'foo { background: url(http://localhost/styles.css?quoted=double) }',
+                       ],
+                       [
+                               'Background URL (single quoted, containing spaces, with outer spacing)',
+                               "foo { background: url( ' red.gif ' ); }",
+                               'foo { background: url("http://localhost/w/ red.gif "); }',
+                       ],
                        [
                                'Simple case with comments before url',
                                'foo { prop: /* some {funny;} comment */ url(bar.png); }',