spec/watirspec/link_spec.rb in watir-webdriver-0.0.7 vs spec/watirspec/link_spec.rb in watir-webdriver-0.0.8

- old
+ new

@@ -14,29 +14,35 @@ 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(:url, 'non_control_elements.html').should exist - browser.link(:url, /non_control_elements.html/).should exist + browser.link(:href, 'non_control_elements.html').should exist + 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 - it "strips spaces from URL attributes when locating elements" do - browser.link(:url, /strip_space$/).should exist + it "returns the first link if given no args" do + browser.link.should exist end + bug "http://code.google.com/p/selenium/issues/detail?id=748", :webdriver do + it "strips spaces from href attribute when locating elements" do + browser.link(:href, /strip_space$/).should exist + end + end + it "returns false if the link doesn't exist" do browser.link(:id, 'no_such_id').should_not exist browser.link(:id, /no_such_id/).should_not exist browser.link(:title, "no_such_title").should_not exist browser.link(:title, /no_such_title/).should_not exist browser.link(:text, "no_such_text").should_not exist browser.link(:text, /no_such_text/i).should_not exist - browser.link(:url, 'no_such_href').should_not exist - browser.link(:url, /no_such_href/).should_not exist + browser.link(:href, 'no_such_href').should_not exist + browser.link(:href, /no_such_href/).should_not exist browser.link(:index, 1337).should_not exist browser.link(:xpath, "//a[@id='no_such_id']").should_not exist end it "raises TypeError when 'what' argument is invalid" do @@ -75,13 +81,13 @@ it "raises an UnknownObjectException if the link doesn't exist" do lambda { browser.link(:index, 1337).href }.should raise_error(UnknownObjectException) end end - describe "#url" do + describe "#href" do it "returns the href attribute" do - browser.link(:index, 1).url.should =~ /non_control_elements/ + browser.link(:index, 1).href.should =~ /non_control_elements/ end end describe "#id" do it "returns the id attribute if the link exists" do @@ -127,11 +133,10 @@ describe "#respond_to?" do it "returns true for all attribute methods" do browser.link(:index, 0).should respond_to(:class_name) browser.link(:index, 0).should respond_to(:href) - browser.link(:index, 0).should respond_to(:url) browser.link(:index, 0).should respond_to(:id) browser.link(:index, 0).should respond_to(:style) browser.link(:index, 0).should respond_to(:text) browser.link(:index, 0).should respond_to(:title) end @@ -143,10 +148,10 @@ 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 - browser.link(:url, /forms_with_input_elements/).click + 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 browser.link(:index, 2).click