mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
:visible => false now works as expected
This commit is contained in:
parent
380f3d7a08
commit
2b78681d07
3 changed files with 13 additions and 1 deletions
|
@ -5,6 +5,7 @@ Release date:
|
|||
### Added
|
||||
|
||||
* New click_on alias for click_link_or_button, shorter yet unambiguous.
|
||||
* Finders now accept :visible => false which will find all elements regardless of Capybara.ignore_hidden_elements
|
||||
|
||||
# Version 0.4.0
|
||||
|
||||
|
|
|
@ -124,7 +124,13 @@ module Capybara
|
|||
results = results.select { |node| node.text.match(text) }
|
||||
end
|
||||
|
||||
if options[:visible] or Capybara.ignore_hidden_elements
|
||||
ignore_hidden = if options.has_key?(:visible)
|
||||
options[:visible]
|
||||
else
|
||||
Capybara.ignore_hidden_elements
|
||||
end
|
||||
|
||||
if ignore_hidden
|
||||
results = results.select { |node| node.visible? }
|
||||
end
|
||||
|
||||
|
|
|
@ -56,6 +56,11 @@ shared_examples_for "all" do
|
|||
Capybara.ignore_hidden_elements = true
|
||||
@session.all("//a[@title='awesome title']").should have(1).elements
|
||||
end
|
||||
|
||||
it "should only find invisible nodes" do
|
||||
Capybara.ignore_hidden_elements = true
|
||||
@session.all("//a[@title='awesome title']", :visible => false).should have(2).elements
|
||||
end
|
||||
end
|
||||
|
||||
context "within a scope" do
|
||||
|
|
Loading…
Add table
Reference in a new issue