Permalink
Browse files

more specs

  • Loading branch information...
1 parent c34082b commit 6ddc5cf3c98803a51d1e7302027f4567493b924b @wycats committed Oct 22, 2008
View
@@ -2,12 +2,12 @@
describe "*" do
it "should get a list of all nodes" do
- HTML.should have_nodes("*", 6)
+ HTML.should have_nodes("*", 8)
end
end
describe "E *" do
it "should get a list of descendant nodes of E" do
- HTML.should have_nodes("div *", 2)
+ HTML.should have_nodes("div *", 4)
end
end
@@ -0,0 +1,15 @@
+require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
+
+describe "Attributes" do
+ it "<[foo=bar]> should return a list of all nodes with the attribute" do
+ HTML.should have_nodes("[foo=bar]", 1)
+ end
+
+ it "<[foo='bar']> should return a list of all nodes with the attribute" do
+ HTML.should have_nodes("[foo='bar']", 1)
+ end
+
+ it "<[foo=\"bar\"]> should return a list of all nodes with the attribute" do
+ HTML.should have_nodes("[foo=\"bar\"]", 1)
+ end
+end
View
@@ -2,14 +2,14 @@
describe "Attributes" do
it "<[foo]> should return a list of all nodes with the attribute" do
- HTML.should have_nodes("[foo]", 2)
+ HTML.should have_nodes("[foo]", 4)
end
it "<*[foo]> should return a list of all nodes with the attribute" do
- HTML.should have_nodes("*[foo]", 2)
+ HTML.should have_nodes("*[foo]", 4)
end
it "<E[foo]> should return a list of all nodes with the attribute" do
- HTML.should have_nodes("span[foo]", 1)
+ HTML.should have_nodes("span[foo]", 3)
end
end
View
@@ -2,11 +2,11 @@
describe "Elements" do
it "<E> should return a list of all nodes with the element" do
- HTML.should have_nodes("span", 2)
+ HTML.should have_nodes("span", 4)
end
it "<E> should return a list of all nodes with the element" do
pending
- HTML.should have_nodes("SPAN", 2)
+ HTML.should have_nodes("SPAN", 4)
end
end
@@ -0,0 +1,15 @@
+require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper"))
+
+describe "~=" do
+ it "<[foo~=bar]> should return a list of all nodes with the element" do
+ HTML.should have_nodes("[foo~=bar]", 3)
+ end
+
+ it "<[foo~='bar']> should return a list of all nodes with the element" do
+ HTML.should have_nodes("[foo~='bar']", 3)
+ end
+
+ it "<[foo~=\"bar\"]> should return a list of all nodes with the element" do
+ HTML.should have_nodes("[foo~=\"bar\"]", 3)
+ end
+end
View
@@ -7,6 +7,8 @@
<div foo='bar'>Hello
<span foo='bard'>My name</span>
<span food='bar'>is wycats</span>
+ <span foo='bar baz'>Span</span>
+ <span foo='baz bar'>Span</span>
</div>
<p>Some text</p>
</body>

0 comments on commit 6ddc5cf

Please sign in to comment.