Lexing of CSS axes with surrounding whitespace.
This commit is contained in:
parent
619c0bbc14
commit
625b9eeffd
|
@ -183,9 +183,9 @@ module Oga
|
|||
op_ends_with = '$=';
|
||||
op_in = '*=';
|
||||
op_hyphen_in = '|=';
|
||||
op_child = '>';
|
||||
op_fol_direct = '+';
|
||||
op_fol = '~';
|
||||
op_child = whitespace* '>' whitespace*;
|
||||
op_fol_direct = whitespace* '+' whitespace*;
|
||||
op_fol = whitespace* '~' whitespace*;
|
||||
|
||||
# Numbers
|
||||
#
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe Oga::CSS::Lexer do
|
||||
context 'axes' do
|
||||
example 'lex the > axis' do
|
||||
lex_css('>').should == [[:T_CHILD, nil]]
|
||||
end
|
||||
|
||||
example 'lex the > axis with surrounding whitespace' do
|
||||
lex_css('>').should == [[:T_CHILD, nil]]
|
||||
end
|
||||
|
||||
example 'lex the + axis' do
|
||||
lex_css('+').should == [[:T_FOLLOWING_DIRECT, nil]]
|
||||
end
|
||||
|
||||
example 'lex the + axis with surrounding whitespace' do
|
||||
lex_css(' + ').should == [[:T_FOLLOWING_DIRECT, nil]]
|
||||
end
|
||||
|
||||
example 'lex the ~ axis' do
|
||||
lex_css('~').should == [[:T_FOLLOWING, nil]]
|
||||
end
|
||||
|
||||
example 'lex the ~ axis with surrounding whitespace' do
|
||||
lex_css(' ~ ').should == [[:T_FOLLOWING, nil]]
|
||||
end
|
||||
end
|
||||
end
|
|
@ -33,17 +33,5 @@ describe Oga::CSS::Lexer do
|
|||
example 'lex the |= operator' do
|
||||
lex_css('|=').should == [[:T_HYPHEN_IN, nil]]
|
||||
end
|
||||
|
||||
example 'lex the > operator' do
|
||||
lex_css('>').should == [[:T_CHILD, nil]]
|
||||
end
|
||||
|
||||
example 'lex the + operator' do
|
||||
lex_css('+').should == [[:T_FOLLOWING_DIRECT, nil]]
|
||||
end
|
||||
|
||||
example 'lex the ~ operator' do
|
||||
lex_css('~').should == [[:T_FOLLOWING, nil]]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue