From 0499ebedfee66081086cd4ec5951365341072c88 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 5 Mar 2014 17:00:09 +0100 Subject: added (failing) test case for broken jquery ui compression --- _test/tests/lib/exe/css_css_compress.test.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to '_test/tests/lib') diff --git a/_test/tests/lib/exe/css_css_compress.test.php b/_test/tests/lib/exe/css_css_compress.test.php index a614ea2fd..ba103813a 100644 --- a/_test/tests/lib/exe/css_css_compress.test.php +++ b/_test/tests/lib/exe/css_css_compress.test.php @@ -102,6 +102,13 @@ class css_css_compress_test extends DokuWikiTest { $this->assertEquals($expected, $input); } + function test_data() { + $input = 'list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);'; + $expect = 'list-style-image:url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7);'; + + $this->assertEquals($expect, css_compress($input)); + } + } //Setup VIM: ex: et ts=4 : -- cgit v1.2.3 From fe5a50c39e9bd837f887ea7ad8335717a6c6ab92 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 5 Mar 2014 19:37:43 +0100 Subject: fix single line comments in CSS compression double slashes in url() always have to be ignored --- _test/tests/lib/exe/css_css_compress.test.php | 32 +++++++++++++++++++-------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to '_test/tests/lib') diff --git a/_test/tests/lib/exe/css_css_compress.test.php b/_test/tests/lib/exe/css_css_compress.test.php index ba103813a..f0eb17968 100644 --- a/_test/tests/lib/exe/css_css_compress.test.php +++ b/_test/tests/lib/exe/css_css_compress.test.php @@ -10,33 +10,47 @@ class css_css_compress_test extends DokuWikiTest { * line *test* * check */'; - $this->assertEquals(css_compress($text), ''); + $this->assertEquals('', css_compress($text)); } function test_mlcom2(){ $text = '#comment/* */ { color: lime; }'; - $this->assertEquals(css_compress($text), '#comment/* */{color:lime;}'); + $this->assertEquals('#comment/* */{color:lime;}', css_compress($text)); } function test_slcom1(){ $text = '// this is a comment'; - $this->assertEquals(css_compress($text), ''); + $this->assertEquals('', css_compress($text)); } function test_slcom2(){ $text = '#foo { color: lime; // another comment }'; - $this->assertEquals(css_compress($text), '#foo{color:lime;}'); + $this->assertEquals('#foo{color:lime;}', css_compress($text)); } function test_slcom3(){ $text = '#foo { - background-image: url(http://foo.bar/baz.jpg); + background-image: url(http://foo.bar/baz.jpg); // this is a comment }'; - $this->assertEquals(css_compress($text), '#foo{background-image:url(http://foo.bar/baz.jpg);}'); + $this->assertEquals('#foo{background-image:url(http://foo.bar/baz.jpg);}', css_compress($text)); + } + + function test_slcom4(){ + $text = '#foo { + background-image: url(http://foo.bar/baz.jpg); background-image: url(http://foo.bar/baz.jpg); // this is a comment + }'; + $this->assertEquals('#foo{background-image:url(http://foo.bar/baz.jpg);background-image:url(http://foo.bar/baz.jpg);}', css_compress($text)); + } + + function test_slcom5(){ + $text = '#foo { + background-image: url(http://foo.bar/baz.jpg); // background-image: url(http://foo.bar/baz.jpg); this is all commented + }'; + $this->assertEquals('#foo{background-image:url(http://foo.bar/baz.jpg);}', css_compress($text)); } function test_hack(){ @@ -44,7 +58,7 @@ class css_css_compress_test extends DokuWikiTest { /* \\*/ display: inline; /* */'; - $this->assertEquals(css_compress($text), '/* \\*/display:inline;/* */'); + $this->assertEquals('/* \\*/display:inline;/* */', css_compress($text)); } function test_hack2(){ @@ -54,12 +68,12 @@ class css_css_compress_test extends DokuWikiTest { height: 450px; } /**/'; - $this->assertEquals(css_compress($text), '/*\\*/* html .page{height:450px;}/**/'); + $this->assertEquals('/*\\*/* html .page{height:450px;}/**/', css_compress($text)); } function test_nl1(){ $text = "a{left:20px;\ntop:20px}"; - $this->assertEquals(css_compress($text), 'a{left:20px;top:20px}'); + $this->assertEquals('a{left:20px;top:20px}', css_compress($text)); } function test_shortening() { -- cgit v1.2.3 From e80146ebf289d9243a864b9c8db1d97ba9516724 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 13 May 2014 20:01:51 +0200 Subject: added another test for fe5a50 That commit did not test what it actually made for. Handling protocol relative URLs in CSS. --- _test/tests/lib/exe/css_css_compress.test.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to '_test/tests/lib') diff --git a/_test/tests/lib/exe/css_css_compress.test.php b/_test/tests/lib/exe/css_css_compress.test.php index f0eb17968..4769684a8 100644 --- a/_test/tests/lib/exe/css_css_compress.test.php +++ b/_test/tests/lib/exe/css_css_compress.test.php @@ -53,6 +53,13 @@ class css_css_compress_test extends DokuWikiTest { $this->assertEquals('#foo{background-image:url(http://foo.bar/baz.jpg);}', css_compress($text)); } + function test_slcom6(){ + $text = '#foo { + background-image: url(//foo.bar/baz.jpg); // background-image: url(http://foo.bar/baz.jpg); this is all commented + }'; + $this->assertEquals('#foo{background-image:url(//foo.bar/baz.jpg);}', css_compress($text)); + } + function test_hack(){ $text = '/* Mac IE will not see this and continue with inline-block */ /* \\*/ -- cgit v1.2.3 From 918a4468877109c2ba2f82fa4e1a225a4738ed9a Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Wed, 14 May 2014 19:24:01 +0200 Subject: don't treat double slashes as comments when used in string This avoids treating double slashes as single line comments in CSS when they are used in a filter or content string. closes #638 --- _test/tests/lib/exe/css_css_compress.test.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to '_test/tests/lib') diff --git a/_test/tests/lib/exe/css_css_compress.test.php b/_test/tests/lib/exe/css_css_compress.test.php index 4769684a8..807317ca6 100644 --- a/_test/tests/lib/exe/css_css_compress.test.php +++ b/_test/tests/lib/exe/css_css_compress.test.php @@ -60,6 +60,14 @@ class css_css_compress_test extends DokuWikiTest { $this->assertEquals('#foo{background-image:url(//foo.bar/baz.jpg);}', css_compress($text)); } + function test_slcom7(){ + $text = '#foo a[href ^="https://"], #foo a[href ^=\'https://\'] { + background-image: url(//foo.bar/baz.jpg); // background-image: url(http://foo.bar/baz.jpg); this is \'all\' "commented" + }'; + $this->assertEquals('#foo a[href ^="https://"],#foo a[href ^=\'https://\']{background-image:url(//foo.bar/baz.jpg);}', css_compress($text)); + } + + function test_hack(){ $text = '/* Mac IE will not see this and continue with inline-block */ /* \\*/ -- cgit v1.2.3