lib/capybara/spec/session/has_selector_spec.rb in capybara-2.0.3 vs lib/capybara/spec/session/has_selector_spec.rb in capybara-2.1.0.beta1

- old
+ new

@@ -51,9 +51,18 @@ it "should discard all matches where the given string is not contained" do @session.should have_selector("//p//a", :text => "Redirect", :count => 1) @session.should_not have_selector("//p", :text => "Doesnotexist") end + it "should respect visibility setting" do + @session.should have_selector(:id, "hidden-text", :text => "Some of this text is hidden!", :visible => false) + @session.should_not have_selector(:id, "hidden-text", :text => "Some of this text is hidden!", :visible => true) + Capybara.ignore_hidden_elements = false + @session.should have_selector(:id, "hidden-text", :text => "Some of this text is hidden!", :visible => false) + Capybara.visible_text_only = true + @session.should_not have_selector(:id, "hidden-text", :text => "Some of this text is hidden!", :visible => true) + end + it "should discard all matches where the given regexp is not matched" do @session.should have_selector("//p//a", :text => /re[dab]i/i, :count => 1) @session.should_not have_selector("//p//a", :text => /Red$/) end end