spec/watirspec/link_spec.rb in watir-webdriver-0.1.3 vs spec/watirspec/link_spec.rb in watir-webdriver-0.1.4

- old
+ new

@@ -14,11 +14,13 @@ browser.link(:id, /link_2/).should exist browser.link(:title, "link_title_2").should exist browser.link(:title, /link_title_2/).should exist browser.link(:text, "Link 2").should exist browser.link(:text, /Link 2/i).should exist - browser.link(:href, 'non_control_elements.html').should exist + not_compliant_on [:webdriver, :ie] do + browser.link(:href, 'non_control_elements.html').should exist + end browser.link(:href, /non_control_elements.html/).should exist browser.link(:index, 1).should exist browser.link(:xpath, "//a[@id='link_2']").should exist end @@ -140,26 +142,32 @@ end end # Manipulation methods describe "#click" do - it "finds an existing link by (:text, String) and click it" do + it "finds an existing link by (:text, String) and clicks it" do browser.link(:text, "Link 3").click browser.text.include?("User administration").should be_true end - it "finds an existing link by (:text, Regexp) and click it" do + it "finds an existing link by (:text, Regexp) and clicks it" do browser.link(:href, /forms_with_input_elements/).click browser.text.include?("User administration").should be_true end - it "finds an existing link by (:index, Integer) and click it" do + it "finds an existing link by (:index, Integer) and clicks it" do browser.link(:index, 2).click browser.text.include?("User administration").should be_true end it "raises an UnknownObjectException if the link doesn't exist" do lambda { browser.link(:index, 1337).click }.should raise_error(UnknownObjectException) + end + + it "clicks a link with no text content but an img child" do + browser.goto "#{WatirSpec.files}/images.html" + browser.link(:href => /definition_lists.html/).click + browser.title.should == 'definition_lists' end end end