Permalink
Browse files

Add spec for span-columns()

  • Loading branch information...
1 parent 3b3d02f commit f866be12bf9fcfee86be2cd905978bdce157b5b3 Reda Lemeden committed Jan 29, 2013
Showing with 78 additions and 7 deletions.
  1. +0 −7 README.md
  2. +61 −0 spec/neat/columns_spec.rb
  3. +17 −0 test/span_columns.scss
View
@@ -132,13 +132,6 @@ Likewise for inline-block:
@include span-columns(6 of 8, inline-block)
```
-The following syntaxes would also work:
-
-```scss
-@include span-columns(6 / 8,inline-block);
-@include span-columns(6 8,inline-block);
-```
-
### Rows
In order to clear floated or table-cell columns, use the `row` mixin:
View
@@ -0,0 +1,61 @@
+require 'spec_helper'
+
+describe "@include span-columns()" do
+ let (:identifier) {"span_columns"}
+
+ before(:all) do
+ ParserSupport.parse_file(identifier)
+ end
+
+ describe "when passed an int argument" do
+ it "sets width in percentage" do
+ expect('.span-columns-default').to have_rule('width: 48.82117%')
+ end
+
+ it "sets gutter in percentage" do
+ expect('.span-columns-default').to have_rule('margin-right: 2.35765%')
+ end
+
+ it "sets display to block" do
+ expect('.span-columns-default').to have_rule('display: block')
+ end
+
+ it "floats element left" do
+ expect('.span-columns-default').to have_rule('float: left')
+ end
+
+ it "removes gutter from last element" do
+ expect('.span-columns-default:last-child').to have_rule('margin-right: 0')
+ end
+ end
+
+ describe "when nested" do
+ it "sets relative width in percentage" do
+ expect('.span-columns-default .span-columns-nested').to have_rule('width: 30.11389%')
+ end
+
+ it "sets relative gutter in percentage" do
+ expect('.span-columns-default .span-columns-nested').to have_rule('margin-right: 4.82916%')
+ end
+ end
+
+ describe "when passed display argument (table)" do
+ it "sets display to table-cell" do
+ expect('.span-columns-table').to have_rule('display: table-cell')
+ end
+
+ it "uses padding as gutter" do
+ expect('.span-columns-table').to have_rule('padding-right: 2.35765%')
+ end
+
+ it "adjusts width of last element" do
+ expect('.span-columns-table:last-child').to have_rule('width: 48.82117%')
+ end
+ end
+
+ describe "when passed display argument (inline-block)" do
+ it "sets display to inline-block" do
+ expect('.span-columns-inline-block').to have_rule('display: inline-block')
+ end
+ end
+end
View
@@ -0,0 +1,17 @@
+@import 'setup';
+
+.span-columns-default {
+ @include span-columns(6);
+
+ .span-columns-nested {
+ @include span-columns(2 of 6);
+ }
+}
+
+.span-columns-table {
+ @include span-columns(6, table);
+}
+
+.span-columns-inline-block {
+ @include span-columns(6, inline-block);
+}

0 comments on commit f866be1

Please sign in to comment.