Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 4237692085
Fetching contributors…

Cannot retrieve contributors at this time

file 33 lines (24 sloc) 0.81 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')

describe "The sibling of combinator" do
  
  it "<div ~ p> should return the p tag" do
    HTML.should have_nodes("div ~ p", 3)
  end
  
  it "<div ~ p[class]> should only have 2 p tags" do
    HTML.should have_nodes("div ~ p[class]", 2)
  end
  
  it "<p[class] ~ p[class] should only match one" do
    HTML.should have_nodes("p[class] ~ p[class]", 1)
  end
  
  it "<p[class] ~ p should have two" do
    HTML.should have_nodes("p[class] ~ p", 2)
  end
  
  it "<div ~ div> should only have one" do
    HTML.should have_nodes("div ~ div", 1)
  end
  
  it "<div ~ span> should have none" do
    HTML.should have_nodes("div ~ span", 0)
  end
  
  it "<html ~ body> should have none" do
    HTML.should have_nodes("html ~ body", 0)
  end
  
end
Something went wrong with that request. Please try again.