From 64f9c570fa720ad5c00b1287bd4e8870484a7a5f Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Sat, 1 Nov 2014 20:20:33 +0100 Subject: [PATCH] Use separate spec files for each pseudo class. --- .../nth_child_spec.rb} | 14 +------------- spec/oga/css/parser/pseudo_classes/root_spec.rb | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 13 deletions(-) rename spec/oga/css/parser/{pseudo_classes_spec.rb => pseudo_classes/nth_child_spec.rb} (90%) create mode 100644 spec/oga/css/parser/pseudo_classes/root_spec.rb diff --git a/spec/oga/css/parser/pseudo_classes_spec.rb b/spec/oga/css/parser/pseudo_classes/nth_child_spec.rb similarity index 90% rename from spec/oga/css/parser/pseudo_classes_spec.rb rename to spec/oga/css/parser/pseudo_classes/nth_child_spec.rb index 8d58280..fdffa1a 100644 --- a/spec/oga/css/parser/pseudo_classes_spec.rb +++ b/spec/oga/css/parser/pseudo_classes/nth_child_spec.rb @@ -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]' diff --git a/spec/oga/css/parser/pseudo_classes/root_spec.rb b/spec/oga/css/parser/pseudo_classes/root_spec.rb new file mode 100644 index 0000000..cfe5606 --- /dev/null +++ b/spec/oga/css/parser/pseudo_classes/root_spec.rb @@ -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