diff --git a/spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb b/spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb new file mode 100644 index 0000000..d83f540 --- /dev/null +++ b/spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe 'CSS selector evaluation' do + context ':only-child pseudo class' do + before do + @document = parse('') + + @root = @document.children[0] + @c1 = @root.children[0].children[0] + @c2 = @root.children[1].children[0] + end + + example 'return a node set containing nodes' do + evaluate_css(@document, 'root :only-child').should == node_set(@c1, @c2) + end + end +end diff --git a/spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb b/spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb new file mode 100644 index 0000000..8a21230 --- /dev/null +++ b/spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe 'CSS selector evaluation' do + context ':only-of-type pseudo class' do + before do + @document = parse('') + + @root = @document.children[0] + @c1 = @root.children[0].children[0] + @c2 = @root.children[1].children[0] + end + + example 'return a node set containing nodes' do + evaluate_css(@document, 'root a :only-of-type').should == node_set(@c1) + end + end +end diff --git a/spec/oga/css/evaluator/pseudo_classes/root_spec.rb b/spec/oga/css/evaluator/pseudo_classes/root_spec.rb new file mode 100644 index 0000000..f045f6e --- /dev/null +++ b/spec/oga/css/evaluator/pseudo_classes/root_spec.rb @@ -0,0 +1,13 @@ +require 'spec_helper' + +describe 'CSS selector evaluation' do + context ':root pseudo class' do + before do + @document = parse('') + end + + example 'return a node set containing the root node' do + evaluate_css(@document, ':root').should == @document.children + end + end +end