| 1 |
require "spec_helper" |
| 2 |
|
| 3 |
describe "hide-visually" do |
| 4 |
before(:all) do |
| 5 |
ParserSupport.parse_file("library/hide-visually") |
| 6 |
end |
| 7 |
|
| 8 |
context "called on element" do |
| 9 |
it "adds properties to hide the element" do |
| 10 |
ruleset = "border: 0; " + |
| 11 |
"clip: rect(1px, 1px, 1px, 1px); " + |
| 12 |
"clip-path: inset(100%); " + |
| 13 |
"height: 1px; " + |
| 14 |
"overflow: hidden; " + |
| 15 |
"padding: 0; " + |
| 16 |
"position: absolute; " + |
| 17 |
"white-space: nowrap; " + |
| 18 |
"width: 1px;" |
| 19 |
|
| 20 |
expect(".hide-visually").to have_ruleset(ruleset) |
| 21 |
end |
| 22 |
end |
| 23 |
|
| 24 |
context "called with unhide argument" do |
| 25 |
it "adds properties to reverse the hiding of the element" do |
| 26 |
ruleset = "clip: auto; " + |
| 27 |
"clip-path: none; " + |
| 28 |
"height: auto; " + |
| 29 |
"overflow: visible; " + |
| 30 |
"position: static; " + |
| 31 |
"white-space: inherit; " + |
| 32 |
"width: auto;" |
| 33 |
|
| 34 |
expect(".hide-visually--unhide").to have_ruleset(ruleset) |
| 35 |
end |
| 36 |
end |
| 37 |
end |