Permalink
Browse files

Merged upstream

  • Loading branch information...
2 parents 98b4e90 + e7a93db commit 15ae9df4c988c293b2f29a6e2198fb4f6f392c0d @fidothe committed Nov 8, 2010
Showing with 17 additions and 0 deletions.
  1. +4 −0 lib/xpath/html.rb
  2. +7 −0 spec/fixtures/form.html
  3. +6 −0 spec/html_spec.rb
View
@@ -70,6 +70,10 @@ def file_field(locator, options={})
locate_field(descendant(:input)[attr(:type).equals('file')], locator)
end
+ def optgroup(name)
+ descendant(:optgroup)[attr(:label).is(name)]
+ end
+
def option(name)
descendant(:option)[text.n.is(name)]
end
View
@@ -70,3 +70,10 @@ <h1 contenteditable="true" data="id-contenteditable-h1">bleh</h1>
<fieldset data="fieldset-fuzzy"><legend>Long legend yo</legend></fieldset>
<fieldset data="fieldset-exact"><legend>Long legend</legend></fieldset>
</p>
+
+<p>
+ <select>
+ <optgroup label="Group A" data="optgroup-a"></optgroup>
+ <optgroup label="Group B" data="optgroup-b"></optgroup>
+ </select>
+</p>
View
@@ -166,4 +166,10 @@ def all(*args)
all('h1').last.should == 'id-contenteditable-h1'
end
end
+
+ describe "#optgroup" do
+ subject { :optgroup }
+
+ it("finds optgroups by label") { get('Group A').should == 'optgroup-a' }
+ end
end

0 comments on commit 15ae9df

Please sign in to comment.