Skip to content

Commit

Permalink
CSS selectors can be nested other way around now too
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Nov 8, 2010
1 parent 0df08c5 commit e7a93db
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion spec/fixtures/simple.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@

<div id="moar">
<p id="impchay">chimp</p>
<p id="amingoflay">flamingo</p>
<div id="elephantay">elephant</div>
<p id="amingoflay">flamingo</p>
</div>
10 changes: 8 additions & 2 deletions spec/xpath_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,17 @@ def xpath(predicate=nil, &block)
@results[1].text.should == 'flamingo'
end

it "should be composable" do
@results = xpath { |x| x.css('#moar').descendant(:p) }
@results[0].text.should == 'chimp'
@results[1].text.should == 'flamingo'
end

it "should allow comma separated selectors" do
@results = xpath { |x| x.descendant[x.attr(:id) == 'moar'].css('div, p') }
@results[0].text.should == 'chimp'
@results[1].text.should == 'flamingo'
@results[2].text.should == 'elephant'
@results[1].text.should == 'elephant'
@results[2].text.should == 'flamingo'
end
end

Expand Down

0 comments on commit e7a93db

Please sign in to comment.