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