Unit tests for compass stylesheets.

This commit is contained in:
Chris Eppstein 2008-12-17 10:07:54 -08:00
parent 40b5ad0a3b
commit 606aba9df2
9 changed files with 157 additions and 11 deletions

View File

@ -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,7 +66,7 @@ class CompassTest < Test::Unit::TestCase
end
def assert_renders_correctly(*arguments)
options = arguments.last.is_a?(Hash) ? arguments.pop : {}
name = arguments.shift
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")
@ -71,6 +79,7 @@ class CompassTest < Test::Unit::TestCase
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)
old_template_loc = Sass::Plugin.options[:template_location]
Sass::Plugin.options[:template_location] = old_template_loc.dup

View File

@ -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; }

View File

@ -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; }

View File

@ -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; }

View File

@ -0,0 +1,21 @@
.clearfix {
overflow: auto;
overflow: -moz-scrollbars-none;
display: inline-block; }
.clearfix {
display: block; }

View File

@ -0,0 +1,3 @@
@import compass/layout.sass
+sticky-footer(72px, "#layout", "#layout_footer", "#footer")

View File

@ -0,0 +1,5 @@
@import compass/utilities/print.sass
+print-utilities
+print-utilities("screen")

View File

@ -0,0 +1 @@
@import compass/reset.sass

View File

@ -0,0 +1,5 @@
@import compass/utilities.sass
.clearfix
+clearfix