[ "foo { content: '\"'; }", "foo{content:'\"'}" ],
// - Whitespace in string values
[ 'foo { content: " "; }', 'foo{content:" "}' ],
+
+ // Whitespaces after opening and before closing parentheses and brackets
+ [ 'a:not( [ href ] ) { prop: url( foobar.png ); }', 'a:not([href]){prop:url(foobar.png)}' ],
+
+ // Ensure that the invalid "url (" will not become the valid "url(" by minification
+ [ 'foo { prop: url ( foobar.png ); }', 'foo{prop:url (foobar.png)}' ],
];
}
];
}
+ /**
+ * Cases with empty url() for CSSMin::remap.
+ *
+ * Regression test for T191237.
+ *
+ * @dataProvider provideRemapEmptyUrl
+ * @covers CSSMin
+ */
+ public function testRemapEmptyUrl( $params, $expected ) {
+ $remapped = call_user_func_array( 'CSSMin::remap', $params );
+ $this->assertEquals( $expected, $remapped, 'Ignore empty url' );
+ }
+
+ public static function provideRemapEmptyUrl() {
+ return [
+ 'Empty' => [
+ [ "background-image: url();", false, '/example', false ],
+ "background-image: url();",
+ ],
+ 'Single quote' => [
+ [ "background-image: url('');", false, '/example', false ],
+ "background-image: url('');",
+ ],
+ 'Double quote' => [
+ [ 'background-image: url("");', false, '/example', false ],
+ 'background-image: url("");',
+ ],
+ ];
+ }
+
/**
* This tests the basic functionality of CSSMin::remap.
*