Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
E F, E > F, E + F, E ~ F
- Loading branch information
Carl Lerche
committed
Oct 22, 2008
1 parent
d27e66f
commit 6554322
Showing
5 changed files
with
94 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') | ||
|
||
describe "The adjacent to combinator" do | ||
|
||
it "<div + p> should return the p tag" do | ||
HTML.should have_nodes("div + p", 1) | ||
end | ||
|
||
it "<span + span> should return the last 3 span tags" do | ||
HTML.should have_nodes("span[foo] + span", 3) | ||
end | ||
|
||
it "<span[foo] + span> should return the last 3 span tags" do | ||
HTML.should have_nodes("span[foo] + span", 2) | ||
end | ||
|
||
it "<body + div> should not return anything" do | ||
HTML.should have_nodes("body + div", 0) | ||
end | ||
|
||
it "<p + body> should not return anything" do | ||
HTML.should have_nodes("p + body", 0) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') | ||
|
||
describe "The child of combinator" do | ||
|
||
it "<body > *> should return all the child nodes of the body" do | ||
HTML.should have_nodes("body > *", 5) | ||
end | ||
|
||
it "<div > *> should return all the child nodes of the div" do | ||
HTML.should have_nodes("div > *", 5) | ||
end | ||
|
||
it "<body > p> should return the p" do | ||
HTML.should have_nodes("body > p", 3) | ||
end | ||
|
||
it "<body > span> should return nothing" do | ||
HTML.should have_nodes("body > span", 0) | ||
end | ||
|
||
it "<div > body> should return nothing" do | ||
HTML.should have_nodes("div > body", 0) | ||
end | ||
|
||
it "<body > div > span> should return the spans" do | ||
HTML.should have_nodes("body > div > span", 4) | ||
end | ||
|
||
it "<html > div > span> should return nothing" do | ||
HTML.should have_nodes("html > div > span", 0) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') | ||
|
||
describe "The descendant of combinator" do | ||
|
||
it "<body *> should return all the child nodes of the body" do | ||
HTML.should have_nodes("body *", 10) | ||
end | ||
|
||
it "<div *> should return all the child nodes of the div" do | ||
HTML.should have_nodes("div *", 5) | ||
end | ||
|
||
it "<body p> should return the p" do | ||
HTML.should have_nodes("body p", 3) | ||
end | ||
|
||
it "<div body> should return nothing" do | ||
HTML.should have_nodes("div body", 0) | ||
end | ||
|
||
it "<html div span> should return the spans" do | ||
HTML.should have_nodes("html div span", 4) | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/spec_helper') | ||
|
||
describe "The simbling of combinator" do | ||
|
||
it "should be awesome" do | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters