Preserve notion of equality for nodes. closes #542
This commit is contained in:
parent
ec56c52834
commit
d791d5d7fd
|
@ -416,6 +416,10 @@ module Capybara
|
|||
has_no_selector?(:table, locator, options)
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
native == other.native if other.respond_to?(:native)
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
##
|
||||
|
|
|
@ -13,6 +13,12 @@ shared_examples_for "find" do
|
|||
@session.find("//input[@id='test_field']")[:value].should == 'monkey'
|
||||
end
|
||||
|
||||
it "preserve object identity", :focus => true do
|
||||
(@session.find('//h1') == @session.find('//h1')).should be_true
|
||||
(@session.find('//h1') === @session.find('//h1')).should be_true
|
||||
(@session.find('//h1').eql? @session.find('//h1')).should be_false
|
||||
end
|
||||
|
||||
it "should find the first element using the given locator and options" do
|
||||
@session.find('//a', :text => 'Redirect')[:id].should == 'red'
|
||||
@session.find(:css, 'a', :text => 'A link came first')[:title].should == 'twas a fine link'
|
||||
|
|
Loading…
Reference in New Issue