Index: modules/simpletest/files/css_test_files/css_input_without_import.css.optimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/css_input_without_import.css.optimized.css diff -N modules/simpletest/files/css_test_files/css_input_without_import.css.optimized.css --- modules/simpletest/files/css_test_files/css_input_without_import.css.optimized.css 10 Nov 2009 17:27:53 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,11 +0,0 @@ - - - - - -body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949;}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949;} - -.this -.is -.a -.test{font:1em/100% Verdana,sans-serif;color:#494949;}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949;} \ No newline at end of file Index: modules/simpletest/files/css_test_files/css_input_without_import.css.unoptimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/css_input_without_import.css.unoptimized.css diff -N modules/simpletest/files/css_test_files/css_input_without_import.css.unoptimized.css --- modules/simpletest/files/css_test_files/css_input_without_import.css.unoptimized.css 10 Nov 2009 17:27:53 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,38 +0,0 @@ -/* $Id: css_input_without_import.css.unoptimized.css,v 1.2 2009/11/10 17:27:53 webchick Exp $ */ - -/** - * @file Basic css that does not use import - */ - - -body { - margin: 0; - padding: 0; - background: #edf5fa; - font: 76%/170% Verdana, sans-serif; - color: #494949; -} - -.this .is .a .test { - font: 1em/100% Verdana, sans-serif; - color: #494949; -} - -/** - * CSS spec says that all whitespace is valid whitespace, so this selector should be just as - * good as the one above. - */ - -.this -.is -.a -.test { -font: 1em/100% Verdana, sans-serif; -color: #494949; -} - -textarea, select { - font: 1em/160% Verdana, sans-serif; - color: #494949; -} - Index: modules/simpletest/files/css_test_files/css_input_without_import.css =================================================================== RCS file: modules/simpletest/files/css_test_files/css_input_without_import.css diff -N modules/simpletest/files/css_test_files/css_input_without_import.css --- modules/simpletest/files/css_test_files/css_input_without_import.css 10 Nov 2009 17:27:53 -0000 1.2 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,38 +0,0 @@ -/* $Id: css_input_without_import.css,v 1.2 2009/11/10 17:27:53 webchick Exp $ */ - -/** - * @file Basic css that does not use import - */ - - -body { - margin: 0; - padding: 0; - background: #edf5fa; - font: 76%/170% Verdana, sans-serif; - color: #494949; -} - -.this .is .a .test { - font: 1em/100% Verdana, sans-serif; - color: #494949; -} - -/** - * CSS spec says that all whitespace is valid whitespace, so this selector should be just as - * good as the one above. - */ - -.this -.is -.a -.test { -font: 1em/100% Verdana, sans-serif; -color: #494949; -} - -textarea, select { - font: 1em/160% Verdana, sans-serif; - color: #494949; -} - Index: modules/simpletest/tests/common.test =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v retrieving revision 1.93 diff -u -r1.93 common.test --- modules/simpletest/tests/common.test 2 Dec 2009 19:26:22 -0000 1.93 +++ modules/simpletest/tests/common.test 2 Dec 2009 19:47:28 -0000 @@ -565,11 +565,14 @@ * Tests rendering inline stylesheets with preprocessing on. */ function testRenderInlinePreprocess() { + variable_set('preprocess_css', 1); + $this->refreshVariables(); + $css = 'body { padding: 0px; }'; - $css_preprocessed = ''; - drupal_add_css($css, 'inline'); + $items = drupal_add_css($css, 'inline'); + $css_preprocessed = ''; $styles = drupal_get_css(); - $this->assertEqual($styles, "\n" . $css_preprocessed . "\n", t('Rendering preprocessed inline CSS adds it to the page.')); + $this->assertEqual($styles, $css_preprocessed . "\n", t('Rendering preprocessed inline CSS adds it to the page.')); } /** @@ -583,11 +586,32 @@ } /** + * Tests rendering inline stylesheets with a seperate media type. + * + * @see http://drupal.org/node/646238 + * Inline css should be combined per media type + */ + function testRenderInlineMediaPrint() { + variable_set('preprocess_css', 1); + $this->refreshVariables(); + + $css = 'body { padding: 0px; }'; + $items = drupal_add_css($css, array('type' => 'inline', 'preprocess' => FALSE)); + $css_print = 'body { padding: 15px; }'; + $items = drupal_add_css($css_print, array('type' => 'inline', 'media' => 'print', 'preprocess' => FALSE)); + + $css_preprocessed = '' . "\n" + .''; + $styles = drupal_get_css(); + $this->assertEqual($styles, $css_preprocessed . "\n", t('Rendering inline CSS with a specific media type adds it to the page.')); + } + + /** * Tests rendering inline stylesheets through a full page request. */ function testRenderInlineFullPage() { $css = 'body { font-size: 254px; }'; - $expected = 'font-size:254px;'; + $expected = 'font-size:254px'; // Create a node, using the PHP filter that tests drupal_add_css(). $settings = array( @@ -762,22 +786,40 @@ * is treated with adequate respect (not arbitrarily removing linefeeds). */ function testLoadCssBasic() { + // Override base URL path. + $GLOBALS['base_path'] = '/'; + // Array of files to test living in 'simpletest/files/css_test_files/'. // - Original: name.css - // - Unoptimized expected content: name.css.unoptimized.css - // - Optimized expected content: name.css.optimized.css + // - Unoptimized expected content: name.unoptimized.css + // - Optimized expected content: name.optimized.css $testfiles = array( - 'css_input_without_import.css', + 'basic', + 'import', + 'nested_import', + 'hacks', + 'selectors', + 'paths' ); $path = drupal_get_path('module', 'simpletest') . '/files/css_test_files'; foreach ($testfiles as $file) { - $expected = file_get_contents("$path/$file.unoptimized.css"); - $unoptimized_output = drupal_load_stylesheet("$path/$file.unoptimized.css", FALSE); - $this->assertEqual($unoptimized_output, $expected, t('Unoptimized CSS file has expected contents (@file)', array('@file' => $file))); - - $expected = file_get_contents("$path/$file.optimized.css"); - $optimized_output = drupal_load_stylesheet("$path/$file", TRUE); - $this->assertEqual($optimized_output, $expected, t('Optimized CSS file has expected contents (@file)', array('@file' => $file))); + if (file_exists("$path/$file.unoptimized.css")) { + $expected = file_get_contents("$path/$file.unoptimized.css"); + $unoptimized_output = drupal_load_stylesheet("$path/$file.css", FALSE); + $this->assertEqual($unoptimized_output, $expected, t('Unoptimized CSS file has expected contents (@file)', array('@file' => "$file.css"))); + + // For developers: uncomment next line to store actual output of drupal_load_stylesheet(). + //file_put_contents("sites/default/private/temp/$file.unoptimized.css", $unoptimized_output); + } + + if (file_exists("$path/$file.optimized.css")) { + $expected = file_get_contents("$path/$file.optimized.css"); + $optimized_output = drupal_load_stylesheet("$path/$file.css", TRUE); + $this->assertEqual($optimized_output, $expected, t('Optimized CSS file has expected contents (@file)', array('@file' => "$file.css"))); + + // For developers: uncomment next line to store actual output of drupal_load_stylesheet(). + //file_put_contents("sites/default/private/temp/$file.optimized.css", $optimized_output); + } } } } Index: modules/simpletest/files/css_test_files/paths.optimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/paths.optimized.css diff -N modules/simpletest/files/css_test_files/paths.optimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/paths.optimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,1 @@ +foo{background:url(/modules/simpletest/files/css_test_files/bar/foo.png);background:url(/modules/simpletest/files/css_test_files/bar/foo.png);background:url(/modules/simpletest/files/css_test_files/bar/foo.png);background:url(/modules/simpletest/files/css_test_files/bar/foo.png);background:url(/modules/simpletest/files/css_test_files/bar/foo.png);background:url(/modules/simpletest/files/bar/foo.png);background:url(/modules/simpletest/bar/foo.png);background:url(/modules/simpletest/files/foo.png);background:url(/modules/simpletest/files/css_test_files/bar/foo.png);background:url(/modules/simpletest/files/css_test_files/foo.png);background:url(/bar/foo.png);background:url(/../foo.png);background:url(http://foo.com/css/foo.css);background:url(http://foo.com/css/../foo.css);background:url(http://foo.com/css/../css/foo.css);background:url(//foo.com/css/foo.css);background:url(data:image/gif;base64,AAAA)} \ No newline at end of file Index: modules/simpletest/files/css_test_files/paths.css =================================================================== RCS file: modules/simpletest/files/css_test_files/paths.css diff -N modules/simpletest/files/css_test_files/paths.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/paths.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,39 @@ + +/** + * @file Test stylesheet containing URLs that should be normalized. + * + * @see http://drupal.org/node/511998 + * CSS aggregator change url path in imported files, + * @see http://drupal.org/node/265719 + * CSS aggregator produces invalid code and directory names for @import files + * @see http://drupal.org/node/258846 + * CSS aggregation fails to parse some url()'s + */ + +foo { + background: url('bar/foo.png'); + background: url('./bar/foo.png'); + background: url('././bar/foo.png'); + background: url('bar/./foo.png'); + background: url('bar/././foo.png'); + background: url('../bar/foo.png'); + background: url('../../bar/foo.png'); + background: url('bar/../../foo.png'); + background: url('bar/../bar/foo.png'); + background: url('bar/../bar/../foo.png'); + + /* absolute, should only remove unnecessary /../ and /./ */ + background: url('/bar/foo.png'); + background: url('/bar/../../foo.png'); + + /* external, should not alter */ + background: url('http://foo.com/css/foo.css'); + background: url("http://foo.com/css/../foo.css"); + background: url(http://foo.com/css/../css/foo.css); + + /* protocol relative, should not alter */ + background: url("//foo.com/css/foo.css"); + + /* data, should not alter */ + background: url(data:image/gif;base64,AAAA); +} Index: modules/simpletest/files/css_test_files/selectors.optimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/selectors.optimized.css diff -N modules/simpletest/files/css_test_files/selectors.optimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/selectors.optimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,37 @@ +* +E[foo] +E[foo="bar"] +E[foo~="bar"] +E[foo^="bar"] +E[foo$="bar"] +E[foo*="bar"] +E[hreflang|="en"] +E:root +E:nth-child(n) +E:nth-last-child(n) +E:nth-of-type(n) +E:nth-last-of-type(n) +E:first-child +E:last-child +E:first-of-type +E:last-of-type +E:only-child +E:only-of-type +E:empty +E:link +E:visited +E:active +E:hover +E:focus +E:target +E:lang(fr) +E:enabled +E:disabled +E:checked +E::first-line +E::first-letter +E::selection +E::before +E::after +E.warning#myid +E:not(s)>F+F~F{color:red} \ No newline at end of file Index: modules/simpletest/files/css_test_files/hacks.css =================================================================== RCS file: modules/simpletest/files/css_test_files/hacks.css diff -N modules/simpletest/files/css_test_files/hacks.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/hacks.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,113 @@ + +/** + * @file Test file containing all kinds of css hacks which should be kept in an + * aggregate stylesheet. + * + * @see http://centricle.com/ref/css/filters/ + * More information about css hacks. + * @see http://drupal.org/node/642974 + * CSS aggregation should keep multi-line ie-mac hacks. + */ + +/** + * IE5/Mac Band Pass Filter + * http://www.stopdesign.com/examples/ie5mac-bpf/ + */ +/* Feed to IE-mac \*//*/ +@import "ie5mac.css"; +/* End feed to IE-mac */ + +/** + * Commented Backslash MacIE5 CSS Hack + * http://www.sam-i-am.com/work/sandbox/css/mac_ie5_hack.html + */ +/* Hides from IE-mac \*/ +* html .clearfix { + height: 1%; +} +.clearfix { + display: block; +} +/* End hide from IE-mac */ + +/** + * Caio's Hack + * http://centricle.com/ref/css/filters/tests/caio/ + */ +/*/ Hide from nav4 */ +.clearfix { + display: inline-block; +} +/* End hide from nav4 */ + +/** + * Fabrice's Inversion + * http://archivist.incutio.com/viewlist/css-discuss/5967 + */ +/*/ Feed to nav *//*/ +.clearfix { + display: block; +} +/* End feed to nav4 */ + +/** + * http://code.google.com/p/minify/source/browse/trunk/min_unit_tests/_test_files/css/hacks.css + * Hide properties from various IE/win + */ +div { + width: 140px; + width/* */:/**/100px; + width: /**/100px; +} + +/** + * http://www.webdevout.net/css-hacks#in_css-selectors + */ +html>/**/body {} + +@media screen { + /* for IE 5.x-6, hidden from IE 5 Mac */ /*\*/ + * html div#page { + height: 1%; + } + /**/ /* end hidden from IE 5 Mac */ +} + +/** + * http://wellstyled.com/css-underscore-hack.html + * http://centricle.com/ref/css/filters/tests/asterisk/ + */ +foo { /* filters for IE */ + _height : 20px; + *height : 15px; +} + +/** + * Tantek's box model hack + * http://www.tantek.com/CSS/Examples/boxmodelhack.html + */ +div { + width:400px; + voice-family: "\"}\""; + voice-family:inherit; + width:300px; +} + +/** + * Tantek's midpass hack + * http://tantek.com/CSS/Examples/midpass.html + */ +@media tty { + i{content:"\";/*" "*/}} @import 'midpassafter.css'; /*";} +}/* */ + +/** + * Leave at least 1 space between these pseudo elements and "{" for IE6 + * http://www.crankygeek.com/ie6pebug/ + */ +p:first-letter {color:red;} +p:first-line {color:red;} +/** + * But don't add space when left intentionally. + */ +p:first-line{color:red;} Index: modules/simpletest/files/css_test_files/nested_import.optimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/nested_import.optimized.css diff -N modules/simpletest/files/css_test_files/nested_import.optimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/nested_import.optimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,6 @@ +@import url(http://example.com/example.css); +@import url(/absolute-non-existing-file.css); +body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949}.this +.is +.a +.test{font:1em/100% Verdana,sans-serif;color:#494949}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949}body{margin:0;background-image:url(/modules/simpletest/files/image-1.png);font:76%/170% Verdana,sans-serif;color:#494949}@import url('hacks.css');div#main{margin:0 auto;width:960px;background-image:url(/modules/simpletest/files/image-2.jpg)}@import url('dont-resolve-and-dont-move-to-top.css');p{margin:1em 0} \ No newline at end of file Index: modules/simpletest/files/css_test_files/nested_import.unoptimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/nested_import.unoptimized.css diff -N modules/simpletest/files/css_test_files/nested_import.unoptimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/nested_import.unoptimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,94 @@ +@import url(http://example.com/example.css); +@import url(/absolute-non-existing-file.css); + +/** + * @file Test stylesheet containing CSS that use nested import commands. + * + * When flattened, the import with the non-existing-file.css should be moved + * above the replaced contents of basic.css, except for non-resolved imports + * that occur in import.css. + * + * @see http://drupal.org/node/646862 + * CSS aggregate should restore @import rules when not properly resolved. + * @see http://drupal.org/node/646246 + * Only move non-resolved @import rules to top of aggregate stylesheet when + * also at top in own stylesheet + */ + + +/** + * @file Test stylesheet containing basic CSS that use import. + * + * When flattened, the import with the external stylesheet should be moved above + * the replaced contents of basic.css. + * + * @see http://drupal.org/node/413296 + * CSS optmization should work on css files that use @import + */ + + +/** + * @file Test stylesheet containing basic css that does not use import + */ + +body { + margin: 0; + padding: 0; + background: #edf5fa; + font: 76%/170% Verdana, sans-serif; + color: #494949; +} + +.this .is .a .test { + font: 1em/100% Verdana, sans-serif; + color: #494949; +} + +/** + * CSS spec says that all whitespace is valid whitespace, so this selector should be just as + * good as the one above. + */ + +.this +.is +.a +.test { +font: 1em/100% Verdana, sans-serif; +color: #494949; +} + +textarea, select { + font: 1em/160% Verdana, sans-serif; + color: #494949; +} + + + + +body { + margin: 0; + background-image: url(/modules/simpletest/files/image-1.png); + font: 76%/170% Verdana, sans-serif; + color: #494949; +} + +/** + * @see http://drupal.org/node/646244 + * Only @import rules at top of aggregated stylesheets should be resolved. + */ +@import url('hacks.css'); + + + + +div#main { + margin: 0 auto; + width: 960px; + background-image: url(/modules/simpletest/files/image-2.jpg); +} + +@import url('dont-resolve-and-dont-move-to-top.css'); + +p { + margin: 1em 0; +} Index: modules/simpletest/files/css_test_files/selectors.unoptimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/selectors.unoptimized.css diff -N modules/simpletest/files/css_test_files/selectors.unoptimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/selectors.unoptimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,47 @@ + +/** + * @file Test stylesheet containing CSS 3 selectors. + * + * @see http://www.w3.org/TR/css3-selectors/ + */ + +* +E[foo] +E[foo="bar"] +E[foo~="bar"] +E[foo^="bar"] +E[foo$="bar"] +E[foo*="bar"] +E[hreflang|="en"] +E:root +E:nth-child(n) +E:nth-last-child(n) +E:nth-of-type(n) +E:nth-last-of-type(n) +E:first-child +E:last-child +E:first-of-type +E:last-of-type +E:only-child +E:only-of-type +E:empty +E:link +E:visited +E:active +E:hover +E:focus +E:target +E:lang(fr) +E:enabled +E:disabled +E:checked +E::first-line +E::first-letter +E::selection +E::before +E::after +E.warning#myid +E:not(s) + > F + + F + ~ F {color: red;} Index: modules/simpletest/files/css_test_files/hacks.unoptimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/hacks.unoptimized.css diff -N modules/simpletest/files/css_test_files/hacks.unoptimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/hacks.unoptimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,113 @@ + +/** + * @file Test file containing all kinds of css hacks which should be kept in an + * aggregate stylesheet. + * + * @see http://centricle.com/ref/css/filters/ + * More information about css hacks. + * @see http://drupal.org/node/642974 + * CSS aggregation should keep multi-line ie-mac hacks. + */ + +/** + * IE5/Mac Band Pass Filter + * http://www.stopdesign.com/examples/ie5mac-bpf/ + */ +/* Feed to IE-mac \*//*/ +@import "ie5mac.css"; +/* End feed to IE-mac */ + +/** + * Commented Backslash MacIE5 CSS Hack + * http://www.sam-i-am.com/work/sandbox/css/mac_ie5_hack.html + */ +/* Hides from IE-mac \*/ +* html .clearfix { + height: 1%; +} +.clearfix { + display: block; +} +/* End hide from IE-mac */ + +/** + * Caio's Hack + * http://centricle.com/ref/css/filters/tests/caio/ + */ +/*/ Hide from nav4 */ +.clearfix { + display: inline-block; +} +/* End hide from nav4 */ + +/** + * Fabrice's Inversion + * http://archivist.incutio.com/viewlist/css-discuss/5967 + */ +/*/ Feed to nav *//*/ +.clearfix { + display: block; +} +/* End feed to nav4 */ + +/** + * http://code.google.com/p/minify/source/browse/trunk/min_unit_tests/_test_files/css/hacks.css + * Hide properties from various IE/win + */ +div { + width: 140px; + width/* */:/**/100px; + width: /**/100px; +} + +/** + * http://www.webdevout.net/css-hacks#in_css-selectors + */ +html>/**/body {} + +@media screen { + /* for IE 5.x-6, hidden from IE 5 Mac */ /*\*/ + * html div#page { + height: 1%; + } + /**/ /* end hidden from IE 5 Mac */ +} + +/** + * http://wellstyled.com/css-underscore-hack.html + * http://centricle.com/ref/css/filters/tests/asterisk/ + */ +foo { /* filters for IE */ + _height : 20px; + *height : 15px; +} + +/** + * Tantek's box model hack + * http://www.tantek.com/CSS/Examples/boxmodelhack.html + */ +div { + width:400px; + voice-family: "\"}\""; + voice-family:inherit; + width:300px; +} + +/** + * Tantek's midpass hack + * http://tantek.com/CSS/Examples/midpass.html + */ +@media tty { + i{content:"\";/*" "*/}} @import 'midpassafter.css'; /*";} +}/* */ + +/** + * Leave at least 1 space between these pseudo elements and "{" for IE6 + * http://www.crankygeek.com/ie6pebug/ + */ +p:first-letter {color:red;} +p:first-line {color:red;} +/** + * But don't add space when left intentionally. + */ +p:first-line{color:red;} Index: modules/simpletest/files/css_test_files/import.optimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/import.optimized.css diff -N modules/simpletest/files/css_test_files/import.optimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/import.optimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,5 @@ +@import url(http://example.com/example.css); +body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949}.this +.is +.a +.test{font:1em/100% Verdana,sans-serif;color:#494949}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949}body{margin:0;background-image:url(/modules/simpletest/files/image-1.png);font:76%/170% Verdana,sans-serif;color:#494949}@import url('hacks.css'); \ No newline at end of file Index: modules/simpletest/files/css_test_files/basic.unoptimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/basic.unoptimized.css diff -N modules/simpletest/files/css_test_files/basic.unoptimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/basic.unoptimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,36 @@ + +/** + * @file Test stylesheet containing basic css that does not use import + */ + +body { + margin: 0; + padding: 0; + background: #edf5fa; + font: 76%/170% Verdana, sans-serif; + color: #494949; +} + +.this .is .a .test { + font: 1em/100% Verdana, sans-serif; + color: #494949; +} + +/** + * CSS spec says that all whitespace is valid whitespace, so this selector should be just as + * good as the one above. + */ + +.this +.is +.a +.test { +font: 1em/100% Verdana, sans-serif; +color: #494949; +} + +textarea, select { + font: 1em/160% Verdana, sans-serif; + color: #494949; +} + Index: modules/simpletest/files/css_test_files/hacks.optimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/hacks.optimized.css diff -N modules/simpletest/files/css_test_files/hacks.optimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/hacks.optimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,3 @@ +/*\*//*/ +@import "ie5mac.css"; +/* End feed to IE-mac *//*\*/* html .clearfix{height:1%}.clearfix{display:block}/* End hide from IE-mac */.clearfix{display:inline-block}div{width:140px;width/**/:/**/100px;width:100px}html>/**/body{}@media screen{/*\*/* html div#page{height:1%}/**/}foo{_height:20px;*height:15px}div{width:400px;voice-family:"\"}\"";voice-family:inherit;width:300px}@media tty{i{content:"\";/*" "*/}} @import 'midpassafter.css'; /*"}}p:first-letter {color:red}p:first-line {color:red}p:first-line{color:red} \ No newline at end of file Index: modules/simpletest/files/css_test_files/basic.css =================================================================== RCS file: modules/simpletest/files/css_test_files/basic.css diff -N modules/simpletest/files/css_test_files/basic.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/basic.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,36 @@ + +/** + * @file Test stylesheet containing basic css that does not use import + */ + +body { + margin: 0; + padding: 0; + background: #edf5fa; + font: 76%/170% Verdana, sans-serif; + color: #494949; +} + +.this .is .a .test { + font: 1em/100% Verdana, sans-serif; + color: #494949; +} + +/** + * CSS spec says that all whitespace is valid whitespace, so this selector should be just as + * good as the one above. + */ + +.this +.is +.a +.test { +font: 1em/100% Verdana, sans-serif; +color: #494949; +} + +textarea, select { + font: 1em/160% Verdana, sans-serif; + color: #494949; +} + Index: modules/simpletest/files/css_test_files/basic.optimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/basic.optimized.css diff -N modules/simpletest/files/css_test_files/basic.optimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/basic.optimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,4 @@ +body{margin:0;padding:0;background:#edf5fa;font:76%/170% Verdana,sans-serif;color:#494949}.this .is .a .test{font:1em/100% Verdana,sans-serif;color:#494949}.this +.is +.a +.test{font:1em/100% Verdana,sans-serif;color:#494949}textarea,select{font:1em/160% Verdana,sans-serif;color:#494949} \ No newline at end of file Index: modules/simpletest/files/css_test_files/import.unoptimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/import.unoptimized.css diff -N modules/simpletest/files/css_test_files/import.unoptimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/import.unoptimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,63 @@ +@import url(http://example.com/example.css); + +/** + * @file Test stylesheet containing basic CSS that use import. + * + * When flattened, the import with the external stylesheet should be moved above + * the replaced contents of basic.css. + * + * @see http://drupal.org/node/413296 + * CSS optmization should work on css files that use @import + */ + + +/** + * @file Test stylesheet containing basic css that does not use import + */ + +body { + margin: 0; + padding: 0; + background: #edf5fa; + font: 76%/170% Verdana, sans-serif; + color: #494949; +} + +.this .is .a .test { + font: 1em/100% Verdana, sans-serif; + color: #494949; +} + +/** + * CSS spec says that all whitespace is valid whitespace, so this selector should be just as + * good as the one above. + */ + +.this +.is +.a +.test { +font: 1em/100% Verdana, sans-serif; +color: #494949; +} + +textarea, select { + font: 1em/160% Verdana, sans-serif; + color: #494949; +} + + + + +body { + margin: 0; + background-image: url(/modules/simpletest/files/image-1.png); + font: 76%/170% Verdana, sans-serif; + color: #494949; +} + +/** + * @see http://drupal.org/node/646244 + * Only @import rules at top of aggregated stylesheets should be resolved. + */ +@import url('hacks.css'); Index: modules/simpletest/files/css_test_files/selectors.css =================================================================== RCS file: modules/simpletest/files/css_test_files/selectors.css diff -N modules/simpletest/files/css_test_files/selectors.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/selectors.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,47 @@ + +/** + * @file Test stylesheet containing CSS 3 selectors. + * + * @see http://www.w3.org/TR/css3-selectors/ + */ + +* +E[foo] +E[foo="bar"] +E[foo~="bar"] +E[foo^="bar"] +E[foo$="bar"] +E[foo*="bar"] +E[hreflang|="en"] +E:root +E:nth-child(n) +E:nth-last-child(n) +E:nth-of-type(n) +E:nth-last-of-type(n) +E:first-child +E:last-child +E:first-of-type +E:last-of-type +E:only-child +E:only-of-type +E:empty +E:link +E:visited +E:active +E:hover +E:focus +E:target +E:lang(fr) +E:enabled +E:disabled +E:checked +E::first-line +E::first-letter +E::selection +E::before +E::after +E.warning#myid +E:not(s) + > F + + F + ~ F {color: red;} Index: modules/simpletest/files/css_test_files/nested_import.css =================================================================== RCS file: modules/simpletest/files/css_test_files/nested_import.css diff -N modules/simpletest/files/css_test_files/nested_import.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/nested_import.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,30 @@ + +/** + * @file Test stylesheet containing CSS that use nested import commands. + * + * When flattened, the import with the non-existing-file.css should be moved + * above the replaced contents of basic.css, except for non-resolved imports + * that occur in import.css. + * + * @see http://drupal.org/node/646862 + * CSS aggregate should restore @import rules when not properly resolved. + * @see http://drupal.org/node/646246 + * Only move non-resolved @import rules to top of aggregate stylesheet when + * also at top in own stylesheet + */ + +@import "import.css"; +@import url(/absolute-non-existing-file.css); + + +div#main { + margin: 0 auto; + width: 960px; + background-image: url(../../files/image-2.jpg); +} + +@import url('dont-resolve-and-dont-move-to-top.css'); + +p { + margin: 1em 0; +} Index: modules/simpletest/files/css_test_files/paths.unoptimized.css =================================================================== RCS file: modules/simpletest/files/css_test_files/paths.unoptimized.css diff -N modules/simpletest/files/css_test_files/paths.unoptimized.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/paths.unoptimized.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,39 @@ + +/** + * @file Test stylesheet containing URLs that should be normalized. + * + * @see http://drupal.org/node/511998 + * CSS aggregator change url path in imported files, + * @see http://drupal.org/node/265719 + * CSS aggregator produces invalid code and directory names for @import files + * @see http://drupal.org/node/258846 + * CSS aggregation fails to parse some url()'s + */ + +foo { + background: url(/modules/simpletest/files/css_test_files/bar/foo.png); + background: url(/modules/simpletest/files/css_test_files/bar/foo.png); + background: url(/modules/simpletest/files/css_test_files/bar/foo.png); + background: url(/modules/simpletest/files/css_test_files/bar/foo.png); + background: url(/modules/simpletest/files/css_test_files/bar/foo.png); + background: url(/modules/simpletest/files/bar/foo.png); + background: url(/modules/simpletest/bar/foo.png); + background: url(/modules/simpletest/files/foo.png); + background: url(/modules/simpletest/files/css_test_files/bar/foo.png); + background: url(/modules/simpletest/files/css_test_files/foo.png); + + /* absolute, should only remove unnecessary /../ and /./ */ + background: url(/bar/foo.png); + background: url(/../foo.png); + + /* external, should not alter */ + background: url(http://foo.com/css/foo.css); + background: url(http://foo.com/css/../foo.css); + background: url(http://foo.com/css/../css/foo.css); + + /* protocol relative, should not alter */ + background: url(//foo.com/css/foo.css); + + /* data, should not alter */ + background: url(data:image/gif;base64,AAAA); +} Index: modules/simpletest/files/css_test_files/import.css =================================================================== RCS file: modules/simpletest/files/css_test_files/import.css diff -N modules/simpletest/files/css_test_files/import.css --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/simpletest/files/css_test_files/import.css 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,26 @@ + +/** + * @file Test stylesheet containing basic CSS that use import. + * + * When flattened, the import with the external stylesheet should be moved above + * the replaced contents of basic.css. + * + * @see http://drupal.org/node/413296 + * CSS optmization should work on css files that use @import + */ + +@import "basic.css"; +@import url('http://example.com/example.css'); + +body { + margin: 0; + background-image: url(../image-1.png); + font: 76%/170% Verdana, sans-serif; + color: #494949; +} + +/** + * @see http://drupal.org/node/646244 + * Only @import rules at top of aggregated stylesheets should be resolved. + */ +@import url('hacks.css');