diff --git a/test/compass_test.rb b/test/compass_test.rb index 404f9e19..1530b513 100644 --- a/test/compass_test.rb +++ b/test/compass_test.rb @@ -50,6 +50,14 @@ class CompassTest < Test::Unit::TestCase assert_renders_correctly :mixins end end + def test_compass + with_templates('compass') do + each_css_file(tempfile_loc('compass')) do |css_file| + assert_no_errors css_file, 'compass' + end + assert_renders_correctly :reset, :layout, :utilities + end + end private def assert_no_errors(css_file, folder) file = css_file[(tempfile_loc(folder).size+1)..-1] @@ -58,17 +66,18 @@ class CompassTest < Test::Unit::TestCase end def assert_renders_correctly(*arguments) options = arguments.last.is_a?(Hash) ? arguments.pop : {} - name = arguments.shift - actual_result_file = "#{tempfile_loc(@current_template_folder)}/#{name}.css" - expected_result_file = "#{result_loc(@current_template_folder)}/#{name}.css" - actual_lines = File.read(actual_result_file).split("\n") - expected_lines = File.read(expected_result_file).split("\n") - expected_lines.zip(actual_lines).each_with_index do |pair, line| - message = "template: #{name}\nline: #{line + 1}" - assert_equal(pair.first, pair.last, message) - end - if expected_lines.size < actual_lines.size - assert(false, "#{actual_lines.size - expected_lines.size} Trailing lines found in #{actual_result_file}.css: #{actual_lines[expected_lines.size..-1].join('\n')}") + for name in arguments + actual_result_file = "#{tempfile_loc(@current_template_folder)}/#{name}.css" + expected_result_file = "#{result_loc(@current_template_folder)}/#{name}.css" + actual_lines = File.read(actual_result_file).split("\n") + expected_lines = File.read(expected_result_file).split("\n") + expected_lines.zip(actual_lines).each_with_index do |pair, line| + message = "template: #{name}\nline: #{line + 1}" + assert_equal(pair.first, pair.last, message) + end + if expected_lines.size < actual_lines.size + assert(false, "#{actual_lines.size - expected_lines.size} Trailing lines found in #{actual_result_file}.css: #{actual_lines[expected_lines.size..-1].join('\n')}") + end end end def with_templates(folder) diff --git a/test/fixtures/stylesheets/compass/css/layout.css b/test/fixtures/stylesheets/compass/css/layout.css new file mode 100644 index 00000000..5c86bc0d --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/layout.css @@ -0,0 +1,14 @@ + +html, body { + height: 100%; } + +#layout { + min-height: 100%; + margin-bottom: -72px; } + #layout #layout_footer { + height: 72px; } + +#footer { + clear: both; + position: relative; + height: 72px; } diff --git a/test/fixtures/stylesheets/compass/css/print.css b/test/fixtures/stylesheets/compass/css/print.css new file mode 100644 index 00000000..8783e2a5 --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/print.css @@ -0,0 +1,19 @@ + +.noprint, +.no-print { + display: none; } + +address.print-only, blockquote.print-only, center.print-only, dir.print-only, div.print-only, dd.print-only, dl.print-only, dt.print-only, +fieldset.print-only, form.print-only, frameset.print-only, h1.print-only, h2.print-only, h3.print-only, h4.print-only, h5.print-only, h6.print-only, hr.print-only, +isindex.print-only, li.print-only, menu.print-only, noframes.print-only, noscript.print-only, ol.print-only, p.print-only, pre.print-only, +table.print-only, tbody.print-only, td.print-only, tfoot.print-only, th.print-only, thead.print-only, tr.print-only, ul.print-only { + display: block; } + +a.print-only, abbr.print-only, acronym.print-only, b.print-only, basefont.print-only, bdo.print-only, big.print-only, br.print-only, cite.print-only, +code.print-only, dfn.print-only, em.print-only, font.print-only, i.print-only, img.print-only, input.print-only, kbd.print-only, label.print-only, q.print-only, s.print-only, +samp.print-only, select.print-only, small.print-only, span.print-only, strike.print-only, strong.print-only, sub.print-only, sup.print-only, +textarea.print-only, tt.print-only, u.print-only, var.print-only { + display: inline; } + +.print-only { + display: none; } diff --git a/test/fixtures/stylesheets/compass/css/reset.css b/test/fixtures/stylesheets/compass/css/reset.css new file mode 100644 index 00000000..087c3ec1 --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/reset.css @@ -0,0 +1,69 @@ + +html, body { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; } + +div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, +pre, a, abbr, acronym, address, code, del, dfn, em, img, +dl, dt, dd, ol, ul, li, fieldset, form, label, legend, caption, tbody, tfoot, thead, tr { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; } + +body { + line-height: 1.5; } + +blockquote, q { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; + quotes: "" ""; } + blockquote:before, + blockquote:after, q:before, + q:after { + content: ""; } + +th, td, caption { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; + text-align: left; + font-weight: normal; + vertical-align: middle; } + +table { + margin: 0; + padding: 0; + border: 0; + font-weight: inherit; + font-style: inherit; + font-size: 100%; + font-family: inherit; + vertical-align: baseline; + border-collapse: separate; + border-spacing: 0; + vertical-align: middle; } + +a img { + border: none; } diff --git a/test/fixtures/stylesheets/compass/css/utilities.css b/test/fixtures/stylesheets/compass/css/utilities.css new file mode 100644 index 00000000..946cff6d --- /dev/null +++ b/test/fixtures/stylesheets/compass/css/utilities.css @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + +.clearfix { + overflow: auto; + overflow: -moz-scrollbars-none; + display: inline-block; } + .clearfix { + display: block; } diff --git a/test/fixtures/stylesheets/compass/sass/layout.sass b/test/fixtures/stylesheets/compass/sass/layout.sass new file mode 100644 index 00000000..8d241235 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/layout.sass @@ -0,0 +1,3 @@ +@import compass/layout.sass + ++sticky-footer(72px, "#layout", "#layout_footer", "#footer") diff --git a/test/fixtures/stylesheets/compass/sass/print.sass b/test/fixtures/stylesheets/compass/sass/print.sass new file mode 100644 index 00000000..34d4cb3b --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/print.sass @@ -0,0 +1,5 @@ +@import compass/utilities/print.sass + ++print-utilities + ++print-utilities("screen") \ No newline at end of file diff --git a/test/fixtures/stylesheets/compass/sass/reset.sass b/test/fixtures/stylesheets/compass/sass/reset.sass new file mode 100644 index 00000000..3ea3a5b2 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/reset.sass @@ -0,0 +1 @@ +@import compass/reset.sass diff --git a/test/fixtures/stylesheets/compass/sass/utilities.sass b/test/fixtures/stylesheets/compass/sass/utilities.sass new file mode 100644 index 00000000..4f968968 --- /dev/null +++ b/test/fixtures/stylesheets/compass/sass/utilities.sass @@ -0,0 +1,5 @@ +@import compass/utilities.sass + + +.clearfix + +clearfix \ No newline at end of file