| 1 |
require "spec_helper" |
| 2 |
|
| 3 |
describe "is-length" do |
| 4 |
before(:all) do |
| 5 |
ParserSupport.parse_file("validators/is-length") |
| 6 |
end |
| 7 |
|
| 8 |
context "checks if unitless integer can be represented as a length" do |
| 9 |
it "returns false" do |
| 10 |
expect(".integer").not_to have_rule("color: #fff") |
| 11 |
end |
| 12 |
end |
| 13 |
|
| 14 |
context "checks if px can be represented as a length" do |
| 15 |
it "returns true" do |
| 16 |
expect(".pixels").to have_rule("color: #fff") |
| 17 |
end |
| 18 |
end |
| 19 |
|
| 20 |
context "checks if em can be represented as a length" do |
| 21 |
it "returns true" do |
| 22 |
expect(".ems").to have_rule("color: #fff") |
| 23 |
end |
| 24 |
end |
| 25 |
|
| 26 |
context "checks if percent can be represented as a length" do |
| 27 |
it "returns true" do |
| 28 |
expect(".percent").to have_rule("color: #fff") |
| 29 |
end |
| 30 |
end |
| 31 |
|
| 32 |
context "parses calculated values" do |
| 33 |
it "returns true" do |
| 34 |
expect(".calc").to have_rule("color: #fff") |
| 35 |
end |
| 36 |
end |
| 37 |
|
| 38 |
context "parses custom properties" do |
| 39 |
it "returns true" do |
| 40 |
expect(".var").to have_rule("color: #fff") |
| 41 |
end |
| 42 |
end |
| 43 |
|
| 44 |
context "parses environment variables" do |
| 45 |
it "returns true" do |
| 46 |
expect(".env").to have_rule("color: #fff") |
| 47 |
end |
| 48 |
end |
| 49 |
|
| 50 |
context "checks if strings can be represented as a length" do |
| 51 |
it "returns false" do |
| 52 |
expect(".string").not_to have_rule("color: #fff") |
| 53 |
end |
| 54 |
end |
| 55 |
|
| 56 |
context "checks if null can be represented as a length" do |
| 57 |
it "returns false" do |
| 58 |
expect(".null").not_to have_rule("color: #fff") |
| 59 |
end |
| 60 |
end |
| 61 |
end |