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