| 1 | require "spec_helper" |
| 2 | |
| 3 | describe "grid-push" do |
| 4 | before(:all) do |
| 5 | ParserSupport.parse_file("mixins/grid-push") |
| 6 | end |
| 7 | |
| 8 | context "called with default settings" do |
| 9 | it "adds margin for just the gutter with no specified column" do |
| 10 | rule = "margin-left: 20px" |
| 11 | |
| 12 | expect(".grid-push-default").to have_rule(rule) |
| 13 | end |
| 14 | |
| 15 | it "adds margin for one column" do |
| 16 | rule = "margin-left: calc(8.33333% - 21.66667px + 40px)" |
| 17 | |
| 18 | expect(".grid-push-1-default").to have_rule(rule) |
| 19 | end |
| 20 | |
| 21 | it "adds margin for six columns" do |
| 22 | rule = "margin-left: calc(50% - 30px + 40px)" |
| 23 | |
| 24 | expect(".grid-push-6-default").to have_rule(rule) |
| 25 | end |
| 26 | |
| 27 | it "adds margin for negative six columns" do |
| 28 | rule = "margin-left: calc(-50% - 10px + 40px)" |
| 29 | |
| 30 | expect(".grid-push-neg-6-default").to have_rule(rule) |
| 31 | end |
| 32 | end |
| 33 | |
| 34 | context "called with custom settings" do |
| 35 | it "adds margin for just the gutter with no specified column" do |
| 36 | rule = "margin-left: 2rem" |
| 37 | |
| 38 | expect(".grid-push-0-six").to have_rule(rule) |
| 39 | end |
| 40 | |
| 41 | it "adds margin for one column" do |
| 42 | rule = "margin-left: calc(16.66667% - 2.33333rem + 4rem)" |
| 43 | |
| 44 | expect(".grid-push-1-six").to have_rule(rule) |
| 45 | end |
| 46 | |
| 47 | it "adds margin for three columns" do |
| 48 | rule = "margin-left: calc(50% - 3rem + 4rem)" |
| 49 | |
| 50 | expect(".grid-push-3-six").to have_rule(rule) |
| 51 | end |
| 52 | |
| 53 | it "adds margin for negative three columns" do |
| 54 | rule = "margin-left: calc(-50% - 1rem + 4rem)" |
| 55 | |
| 56 | expect(".grid-push-neg-3-six").to have_rule(rule) |
| 57 | end |
| 58 | end |
| 59 | end |