Re-organized some of the CSS lexer tests.

This commit is contained in:
Yorick Peterse 2014-09-22 23:33:39 +02:00
parent 2ede705f1b
commit 059e797a42
3 changed files with 35 additions and 25 deletions

View File

@ -0,0 +1,21 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
context 'namespaces' do
example 'lex a path containing a namespace name' do
lex_css('foo|bar').should == [
[:T_IDENT, 'foo'],
[:T_PIPE, nil],
[:T_IDENT, 'bar']
]
end
example 'lex a path containing a namespace wildcard' do
lex_css('*|foo').should == [
[:T_IDENT, '*'],
[:T_PIPE, nil],
[:T_IDENT, 'foo']
]
end
end
end

View File

@ -38,30 +38,5 @@ describe Oga::CSS::Lexer do
example 'lex a wildcard path' do example 'lex a wildcard path' do
lex_css('*').should == [[:T_IDENT, '*']] lex_css('*').should == [[:T_IDENT, '*']]
end end
example 'lex a path containing a namespace name' do
lex_css('foo|bar').should == [
[:T_IDENT, 'foo'],
[:T_PIPE, nil],
[:T_IDENT, 'bar']
]
end
example 'lex a path containing a namespace wildcard' do
lex_css('*|foo').should == [
[:T_IDENT, '*'],
[:T_PIPE, nil],
[:T_IDENT, 'foo']
]
end
example 'lex a path containing a simple predicate' do
lex_css('foo[bar]').should == [
[:T_IDENT, 'foo'],
[:T_LBRACK, nil],
[:T_IDENT, 'bar'],
[:T_RBRACK, nil]
]
end
end end
end end

View File

@ -0,0 +1,14 @@
require 'spec_helper'
describe Oga::CSS::Lexer do
context 'predicates' do
example 'lex a path containing a simple predicate' do
lex_css('foo[bar]').should == [
[:T_IDENT, 'foo'],
[:T_LBRACK, nil],
[:T_IDENT, 'bar'],
[:T_RBRACK, nil]
]
end
end
end