diff --git a/spec/oga/css/parser/paths_spec.rb b/spec/oga/css/parser/paths_spec.rb new file mode 100644 index 0000000..39af30e --- /dev/null +++ b/spec/oga/css/parser/paths_spec.rb @@ -0,0 +1,17 @@ +require 'spec_helper' + +describe Oga::CSS::Parser do + context 'paths' do + example 'parse a single path' do + parse_css('foo').should == s(:test, nil, 'foo') + end + + example 'parse a path using two selectors' do + parse_css('foo bar').should == s( + :path, + s(:test, nil, 'foo'), + s(:test, nil, 'bar') + ) + end + end +end diff --git a/spec/support/parsing.rb b/spec/support/parsing.rb index 122cb63..dfc9b3d 100644 --- a/spec/support/parsing.rb +++ b/spec/support/parsing.rb @@ -42,6 +42,14 @@ module Oga return Oga::CSS::Lexer.new(input).lex end + ## + # @param [String] input + # @return [AST::Node] + # + def parse_css(input) + return Oga::CSS::Parser.new(input).parse + end + ## # Parses an XPath expression. #