Use separate spec files for each pseudo class.

This commit is contained in:
Yorick Peterse 2014-11-01 20:20:33 +01:00
parent 03f897c2b7
commit 64f9c570fa
2 changed files with 18 additions and 13 deletions

View File

@ -1,19 +1,7 @@
require 'spec_helper'
describe Oga::CSS::Parser do
context 'pseudo classes' do
example 'parse the x:root pseudo class' do
parse_css('x:root').should == parse_xpath(
'descendant-or-self::x[not(parent::*)]'
)
end
example 'parse the :root pseudo class' do
parse_css(':root').should == parse_xpath(
'descendant-or-self::*[not(parent::*)]'
)
end
context ':nth-child pseudo class' do
example 'parse the x:nth-child(1) pseudo class' do
parse_css('x:nth-child(1)').should == parse_xpath(
'descendant-or-self::x[count(preceding-sibling::*) = 0]'

View File

@ -0,0 +1,17 @@
require 'spec_helper'
describe Oga::CSS::Parser do
context ':root pseudo class' do
example 'parse the x:root pseudo class' do
parse_css('x:root').should == parse_xpath(
'descendant-or-self::x[not(parent::*)]'
)
end
example 'parse the :root pseudo class' do
parse_css(':root').should == parse_xpath(
'descendant-or-self::*[not(parent::*)]'
)
end
end
end