From dec5c9cb3ba548f749be52547a0ea1f458d8752e Mon Sep 17 00:00:00 2001 From: Scott Davis Date: Mon, 2 Jan 2012 00:32:46 -0500 Subject: [PATCH] added test for alternating rows and columns --- .../tables/_alternating-rows-and-columns.scss | 12 ++++++----- .../stylesheets/compass/css/utilities.css | 20 +++++++++++++++++++ .../stylesheets/compass/sass/utilities.scss | 3 +++ 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss b/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss index 8dd3a714..4da78e24 100644 --- a/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss +++ b/frameworks/compass/stylesheets/compass/utilities/tables/_alternating-rows-and-columns.scss @@ -3,11 +3,13 @@ background-color: $header-color; &.even, &:nth-child(2n) { background-color: $header-color - $dark-intersection; } } - tr.odd { - td { - background-color: $odd-row-color; - &.even, &:nth-child(2n) { - background-color: $odd-row-color - $dark-intersection; } } } + tr { + &.odd, &:nth-child(2n+1) { + td { + background-color: $odd-row-color; + &.even, &:nth-child(2n) { + background-color: $odd-row-color - $dark-intersection; } } } + } tr.even { td { background-color: $even-row-color; diff --git a/test/fixtures/stylesheets/compass/css/utilities.css b/test/fixtures/stylesheets/compass/css/utilities.css index 8a6c64b1..188e1e61 100644 --- a/test/fixtures/stylesheets/compass/css/utilities.css +++ b/test/fixtures/stylesheets/compass/css/utilities.css @@ -34,3 +34,23 @@ p.light-with-args { p.dark-with-args { background-color: #5f1210; color: blue; } + +th { + background-color: white; } + th.even, th:nth-child(2n) { + background-color: yellow; } + +tr.odd td, tr:nth-child(2n+1) td { + background-color: white; } + tr.odd td.even, tr.odd td:nth-child(2n), tr:nth-child(2n+1) td.even, tr:nth-child(2n+1) td:nth-child(2n) { + background-color: yellow; } + +tr.even td { + background-color: red; } + tr.even td.even, tr.even td:nth-child(2n) { + background-color: red; } + +tfoot th, tfoot td { + background-color: white; } + tfoot th.even, tfoot th:nth-child(2n), tfoot td.even, tfoot td:nth-child(2n) { + background-color: yellow; } \ No newline at end of file diff --git a/test/fixtures/stylesheets/compass/sass/utilities.scss b/test/fixtures/stylesheets/compass/sass/utilities.scss index d579a6ca..14eadfa2 100644 --- a/test/fixtures/stylesheets/compass/sass/utilities.scss +++ b/test/fixtures/stylesheets/compass/sass/utilities.scss @@ -15,3 +15,6 @@ p.light { @include contrasted(#B0201E); } p.dark { @include contrasted(#5F1210); } p.light-with-args { @include contrasted(#B0201E, green, blue); } p.dark-with-args { @include contrasted(#5F1210, green, blue); } + + +@include alternating-rows-and-columns(red, white, blue);