Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merged upstream

  • Loading branch information...
commit 15ae9df4c988c293b2f29a6e2198fb4f6f392c0d 2 parents 98b4e90 + e7a93db
@fidothe authored
View
4 lib/xpath/html.rb
@@ -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
7 spec/fixtures/form.html
@@ -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
6 spec/html_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.