Added various failing following/preceding specs.

This commit is contained in:
Yorick Peterse 2014-11-13 01:11:13 +01:00
parent b0f6409d1e
commit 27ffa4d3d5
4 changed files with 21 additions and 0 deletions

View File

@ -16,6 +16,7 @@ describe Oga::XPath::Evaluator do
</root>
EOF
@bar1 = @document.children[0].children[0].children[0]
@baz1 = @document.children[0].children[0].children[1]
@baz2 = @baz1.children[0]
@baz3 = @document.children[0].children[1]
@ -36,5 +37,9 @@ describe Oga::XPath::Evaluator do
evaluate_xpath(@document, 'root/foo/bar/following-sibling::baz')
.should == node_set(@baz1)
end
example 'return a node set containing the siblings relative to root/foo/bar' do
evaluate_xpath(@bar1, 'following-sibling::baz').should == node_set(@baz1)
end
end
end

View File

@ -16,6 +16,7 @@ describe Oga::XPath::Evaluator do
</root>
EOF
@bar1 = @document.children[0].children[0].children[0]
@baz1 = @document.children[0].children[0].children[1]
@baz2 = @baz1.children[0]
@baz3 = @document.children[0].children[1]
@ -36,5 +37,10 @@ describe Oga::XPath::Evaluator do
evaluate_xpath(@document, 'root/foo/bar/following::baz')
.should == node_set(@baz1, @baz2, @baz3)
end
example 'return a node set containing the siblings relative to root/foo/bar' do
evaluate_xpath(@bar1, 'following::baz')
.should == node_set(@baz1, @baz2, @baz3)
end
end
end

View File

@ -16,6 +16,7 @@ describe Oga::XPath::Evaluator do
@foo1 = @document.children[0].children[0]
@foo2 = @document.children[0].children[1].children[0]
@bar1 = @document.children[0].children[1]
end
example 'return a node set containing preceding siblings of root/bar' do
@ -27,5 +28,9 @@ describe Oga::XPath::Evaluator do
evaluate_xpath(@document, 'root/bar/baz/preceding-sibling::foo')
.should == node_set(@foo2)
end
example 'return a node set containing preceding siblings relative to root/bar' do
evaluate_xpath(@bar1, 'preceding-sibling::foo').should == node_set(@foo1)
end
end
end

View File

@ -19,6 +19,7 @@ describe Oga::XPath::Evaluator do
@bar1 = @foo1.children[0]
@baz1 = @foo1.children[1]
@baz2 = @baz1.children[0]
@baz3 = @document.children[0].children[1]
end
example 'return a node set containing preceding nodes of root/foo/baz' do
@ -30,5 +31,9 @@ describe Oga::XPath::Evaluator do
evaluate_xpath(@document, 'root/baz/preceding::baz')
.should == node_set(@baz1, @baz2)
end
example 'return a node set containing preceding nodes relative to root/baz' do
evaluate_xpath(@baz3, 'preceding::baz').should == node_set(@baz1, @baz2)
end
end
end