mirror of
https://github.com/teamcapybara/capybara.git
synced 2022-11-09 12:08:07 -05:00
Fix basics nodes
This commit is contained in:
parent
0303ed84c5
commit
c6cd6acad3
2 changed files with 12 additions and 7 deletions
|
@ -130,9 +130,10 @@ module Capybara
|
|||
yield # simple nodes don't need to wait
|
||||
end
|
||||
|
||||
def all(*args)
|
||||
query = Capybara::Query.new(*args)
|
||||
elements = native.xpath(query.xpath).map do |node|
|
||||
private
|
||||
|
||||
def resolve_query(query, exact=nil)
|
||||
elements = native.xpath(query.xpath(exact)).map do |node|
|
||||
self.class.new(node)
|
||||
end
|
||||
Capybara::Result.new(elements, query)
|
||||
|
|
|
@ -10,7 +10,7 @@ describe Capybara do
|
|||
<p>Yes it is</p>
|
||||
</div>
|
||||
|
||||
<div id="footer" style="display: none">
|
||||
<div id="footer">
|
||||
<p>c2010</p>
|
||||
<p>Jonas Nicklas</p>
|
||||
<input type="text" name="foo" value="bar"/>
|
||||
|
@ -20,6 +20,10 @@ describe Capybara do
|
|||
</select>
|
||||
</div>
|
||||
|
||||
<div id="hidden" style="display: none">
|
||||
<p id="secret">Secret</p>
|
||||
</div>
|
||||
|
||||
<section>
|
||||
<div class="subsection"></div>
|
||||
</section>
|
||||
|
@ -56,8 +60,8 @@ describe Capybara do
|
|||
end
|
||||
|
||||
it "allows finding only visible nodes" do
|
||||
string.all('//p', :text => 'c2010', :visible => true).should be_empty
|
||||
string.all('//p', :text => 'c2010', :visible => false).should have(1).element
|
||||
string.all(:css, '#secret', :visible => true).should be_empty
|
||||
string.all(:css, '#secret', :visible => false).should have(1).element
|
||||
end
|
||||
|
||||
it "allows finding elements and extracting text from them" do
|
||||
|
@ -83,7 +87,7 @@ describe Capybara do
|
|||
|
||||
it "allows finding elements and checking if they are visible" do
|
||||
string.find('//h1').should be_visible
|
||||
string.find('//input').should_not be_visible
|
||||
string.find(:css, "#secret", :visible => false).should_not be_visible
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue