| 1 |
require "spec_helper" |
| 2 |
|
| 3 |
describe "assign-inputs" do |
| 4 |
before(:all) do |
| 5 |
ParserSupport.parse_file("utilities/assign-inputs") |
| 6 |
@text_inputs_list = [ |
| 7 |
"[type='password']", |
| 8 |
"[type='text']", |
| 9 |
"textarea" |
| 10 |
] |
| 11 |
end |
| 12 |
|
| 13 |
context "expands plain text inputs" do |
| 14 |
it "finds selectors" do |
| 15 |
@text_inputs_list.each do |input| |
| 16 |
expect(input).to have_rule("color: #f00") |
| 17 |
end |
| 18 |
end |
| 19 |
end |
| 20 |
|
| 21 |
context "expands text inputs with pseudo classes" do |
| 22 |
it "finds selectors" do |
| 23 |
list = @text_inputs_list.dup |
| 24 |
list.map! { |input| input + ":active" } |
| 25 |
list.each do |input| |
| 26 |
expect(input).to have_rule("color: #0f0") |
| 27 |
end |
| 28 |
end |
| 29 |
end |
| 30 |
|
| 31 |
context "expands text inputs when first in list" do |
| 32 |
it "finds selectors" do |
| 33 |
list = @text_inputs_list.dup |
| 34 |
list.push "select" |
| 35 |
list.each do |input| |
| 36 |
expect(input).to have_rule("color: #00f") |
| 37 |
end |
| 38 |
end |
| 39 |
end |
| 40 |
|
| 41 |
context "expands text inputs when middle of list" do |
| 42 |
it "finds selectors" do |
| 43 |
list = @text_inputs_list.dup |
| 44 |
list.unshift "[type=\"file\"]" |
| 45 |
list.each do |input| |
| 46 |
expect(input).to have_rule("color: #f0f") |
| 47 |
end |
| 48 |
end |
| 49 |
end |
| 50 |
end |