spec/watirspec/option_spec.rb in watir-webdriver-0.0.7 vs spec/watirspec/option_spec.rb in watir-webdriver-0.0.8
- old
+ new
@@ -18,10 +18,14 @@
browser.option(:class, "scandinavia").should exist
browser.option(:index, 1).should exist
browser.option(:xpath, "//option[@id='nor']").should exist
end
+ it "returns the first option if given no args" do
+ browser.option.should exist
+ end
+
it "returns true if the element exists (select_list context)" do
browser.select_list(:name, "new_user_country").option(:id, "nor").should exist
browser.select_list(:name, "new_user_country").option(:id, /nor/).should exist
browser.select_list(:name, "new_user_country").option(:value, "2").should exist
browser.select_list(:name, "new_user_country").option(:value, /2/).should exist
@@ -88,18 +92,26 @@
it "selects the option when found by text (select_list context)" do
browser.select_list(:name, 'new_user_country').option(:text, 'Sweden').select
browser.select_list(:name, 'new_user_country').option(:text, 'Sweden').should be_selected
end
- it "fires the onclick event (page context)" do
- browser.option(:text, "Username 3").select
- browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
+ # there's no onclick event for Option in IE
+ # http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx
+ not_compliant_on [:webdriver, :ie] do
+ it "fires the onclick event (page context)" do
+ browser.option(:text, "Username 3").select
+ browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
+ end
end
- it "fires onclick event (select_list context)" do
- browser.select_list(:id, 'delete_user_username').option(:text, "Username 3").select
- browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
+ # there's no onclick event for Option in IE
+ # http://msdn.microsoft.com/en-us/library/ms535877(VS.85).aspx
+ not_compliant_on [:webdriver, :ie] do
+ it "fires onclick event (select_list context)" do
+ browser.select_list(:id, 'delete_user_username').option(:text, "Username 3").select
+ browser.text_field(:id, 'delete_user_comment').value.should == 'Don\'t do it!'
+ end
end
it "raises UnknownObjectException if the option does not exist (page context)" do
lambda { browser.option(:text, "no_such_text").select }.should raise_error(UnknownObjectException)
lambda { browser.option(:text, /missing/).select }.should raise_error(UnknownObjectException)
@@ -123,10 +135,10 @@
it "is able to get attributes (page context)" do
browser.option(:text, 'Sweden').class_name.should == "scandinavia"
end
it "is able to get attributes (select_list context)" do
- browser.select_list(:name, "new_user_country").option(:text , 'Sweden').class_name.should == "scandinavia"
+ browser.select_list(:name, "new_user_country").option(:text, 'Sweden').class_name.should == "scandinavia"
end
end
describe "#respond_to?" do
it "returns true for all attribute methods" do