Evaluator specs for the attribute axis short form.
This commit is contained in:
parent
4d956c9ef0
commit
aef3e0f27e
|
@ -7,7 +7,7 @@ describe Oga::XPath::Evaluator do
|
||||||
@evaluator = described_class.new(document.children[0])
|
@evaluator = described_class.new(document.children[0])
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'element attributes' do
|
context 'matching existing attributes' do
|
||||||
before do
|
before do
|
||||||
@set = @evaluator.evaluate('attribute::foo')
|
@set = @evaluator.evaluate('attribute::foo')
|
||||||
end
|
end
|
||||||
|
@ -18,17 +18,29 @@ describe Oga::XPath::Evaluator do
|
||||||
@set[0].is_a?(Oga::XML::Attribute).should == true
|
@set[0].is_a?(Oga::XML::Attribute).should == true
|
||||||
end
|
end
|
||||||
|
|
||||||
example 'return the correct attribute' do
|
example 'return the "foo" attribute' do
|
||||||
@set[0].name.should == 'foo'
|
@set[0].name.should == 'foo'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'non existing attributes' do
|
context 'matching non existing attributes' do
|
||||||
before do
|
before do
|
||||||
@set = @evaluator.evaluate('attribute::bar')
|
@set = @evaluator.evaluate('attribute::bar')
|
||||||
end
|
end
|
||||||
|
|
||||||
it_behaves_like :empty_node_set
|
it_behaves_like :empty_node_set
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'matching attributes using the short form' do
|
||||||
|
before do
|
||||||
|
@set = @evaluator.evaluate('@foo')
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like :node_set, :length => 1
|
||||||
|
|
||||||
|
example 'return the "foo" attribute' do
|
||||||
|
@set[0].name.should == 'foo'
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue