xref: /dokuwiki/_test/tests/lib/exe/css_css_compress.test.php (revision 68389009e322909ba9f85af41320c4886ca27309)
1<?php
2
3require_once DOKU_INC.'lib/exe/css.php';
4
5class css_css_compress_test extends DokuWikiTest {
6
7    function test_mlcom1(){
8        $text = '/**
9                  * A multi
10                  * line *test*
11                  * check
12                  */';
13        $this->assertEquals(css_compress($text), '');
14    }
15
16    function test_mlcom2(){
17        $text = '#comment/* */ {
18                    color: lime;
19                }';
20        $this->assertEquals(css_compress($text), '#comment/* */{color:lime;}');
21    }
22
23    function test_slcom1(){
24        $text = '// this is a comment';
25        $this->assertEquals(css_compress($text), '');
26    }
27
28    function test_slcom2(){
29        $text = '#foo {
30                    color: lime; // another comment
31                }';
32        $this->assertEquals(css_compress($text), '#foo{color:lime;}');
33    }
34
35    function test_slcom3(){
36        $text = '#foo {
37                    background-image: url(http://foo.bar/baz.jpg);
38                }';
39        $this->assertEquals(css_compress($text), '#foo{background-image:url(http://foo.bar/baz.jpg);}');
40    }
41
42    function test_hack(){
43        $text = '/* Mac IE will not see this and continue with inline-block */
44                 /* \\*/
45                 display: inline;
46                 /* */';
47        $this->assertEquals(css_compress($text), '/* \\*/display:inline;/* */');
48    }
49
50    function test_hack2(){
51        $text = '/* min-height hack for Internet Explorer http://www.cssplay.co.uk/boxes/minheight.html */
52                 /*\\*/
53                 * html .page {
54                     height: 450px;
55                 }
56                 /**/';
57        $this->assertEquals(css_compress($text), '/*\\*/* html .page{height:450px;}/**/');
58    }
59
60    function test_nl1(){
61        $text = "a{left:20px;\ntop:20px}";
62        $this->assertEquals(css_compress($text), 'a{left:20px;top:20px}');
63    }
64
65}
66
67//Setup VIM: ex: et ts=4 :
68