Remaining CSS evaluation specs.
This commit is contained in:
parent
518bedc3a1
commit
d47ca19ffa
|
@ -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
|
|
@ -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
|
|
@ -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
|
Loading…
Reference in New Issue