diff --git a/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb b/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb index e9bcdde..970e4c3 100644 --- a/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb +++ b/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb @@ -4,24 +4,22 @@ describe 'CSS selector evaluation' do context ':first-of-type pseudo class' do before do @document = parse(<<-EOF) -
-
foo
-
-
-
bar
-
baz
-
-
-
+ + + + + + + EOF - @dt1 = @document.at_xpath('dl/dt') - @dt2 = @document.at_xpath('dl/dd/dl/dt') + @a1 = @document.at_xpath('root/a[1]') + @a3 = @document.at_xpath('root/a[2]/a[2]') end - example 'return a node set containing all
nodes' do - evaluate_css(@document, 'dl dt:first-of-type') - .should == node_set(@dt1, @dt2) + example 'return a node set containing all first nodes' do + evaluate_css(@document, 'root a:first-of-type') + .should == node_set(@a1, @a3) end end end diff --git a/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb b/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb index 8aa0034..8ed2102 100644 --- a/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb +++ b/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb @@ -3,22 +3,23 @@ require 'spec_helper' describe 'CSS selector evaluation' do context ':last-of-type pseudo class' do before do - @document = parse('') + @document = parse(<<-EOF) + + + + + + + + EOF - @b1 = @document.children[0].children[1] - @a2 = @document.children[0].children[2] + @a2 = @document.at_xpath('root/a[2]') + @a4 = @document.at_xpath('root/a[2]/a[2]') end - example 'return a node set containing the last node' do - evaluate_css(@document, 'root :last-of-type').should == node_set(@a2) - end - - example 'return a node set containing the last node with a node test' do - evaluate_css(@document, 'root b:last-of-type').should == node_set(@b1) - end - - example 'return a node set containing the last node' do - evaluate_css(@document, 'root a:last-of-type').should == node_set(@a2) + example 'return a node set containing all last nodes' do + evaluate_css(@document, 'root a:last-of-type') + .should == node_set(@a2, @a4) end end end