Debian Codegraph @

spec/bourbon/library/margin_spec.rb

raw
1 require "spec_helper"
2
3 describe "margin" do
4 before(:all) do
5 ParserSupport.parse_file("library/margin")
6 end
7
8 context "called with one size" do
9 it "applies same width to all sides" do
10 rule = "margin: 1px"
11
12 expect(".margin-all").to have_rule(rule)
13 end
14 end
15
16 context "called with two sizes" do
17 it "applies to alternating sides" do
18 rule = "margin: 2px 3px"
19
20 expect(".margin-alternate").to have_rule(rule)
21 end
22 end
23
24 context "called with three sizes" do
25 it "applies second width to left and right" do
26 rule = "margin: 4px 5px 6px"
27
28 expect(".margin-implied-left").to have_rule(rule)
29 end
30 end
31
32 context "called with four sizes" do
33 it "applies different widths to all sides" do
34 rule = "margin: 7px 8px 9px 10px"
35
36 expect(".margin-explicit").to have_rule(rule)
37 end
38 end
39
40 context "called with null values" do
41 it "writes rules for other three" do
42 ruleset = "margin-top: 11px; " +
43 "margin-right: 12px; " +
44 "margin-left: 13px;"
45 bad_rule = "margin-bottom: null;"
46
47 expect(".margin-false-third").to have_ruleset(ruleset)
48 expect(".margin-false-third").to_not have_rule(bad_rule)
49 end
50 end
51 end