Re-organized some of the CSS lexer tests.

This commit is contained in:
Yorick Peterse committed 2014-09-28 22:38:25 +02:00
1 parent 2ede705f1b
commit 059e797a42
3 files changed
+35 -25

No files matched your search

+21
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
-25
View File
@@ -38,30 +38,5 @@ describe Oga::CSS::Lexer do
example 'lex a wildcard path' do
lex_css('*').should == [[:T_IDENT, '*']]
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
+14
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