Remaining CSS evaluation specs.

This commit is contained in:
Yorick Peterse 2014-11-14 00:24:54 +01:00
parent 518bedc3a1
commit d47ca19ffa
3 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,17 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
context ':only-child pseudo class' do
before do
@document = parse('<root><a><c /></a><b><c /></b></root>')
@root = @document.children[0]
@c1 = @root.children[0].children[0]
@c2 = @root.children[1].children[0]
end
example 'return a node set containing <c> nodes' do
evaluate_css(@document, 'root :only-child').should == node_set(@c1, @c2)
end
end
end

View File

@ -0,0 +1,17 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
context ':only-of-type pseudo class' do
before do
@document = parse('<root><a><c /></a><b><c /></b></root>')
@root = @document.children[0]
@c1 = @root.children[0].children[0]
@c2 = @root.children[1].children[0]
end
example 'return a node set containing <c> nodes' do
evaluate_css(@document, 'root a :only-of-type').should == node_set(@c1)
end
end
end

View File

@ -0,0 +1,13 @@
require 'spec_helper'
describe 'CSS selector evaluation' do
context ':root pseudo class' do
before do
@document = parse('<root><a /></root>')
end
example 'return a node set containing the root node' do
evaluate_css(@document, ':root').should == @document.children
end
end
end