Initial specs for parsing CSS IDs/classes.
This commit is contained in:
parent
09315ea478
commit
6e18287a1d
|
@ -0,0 +1,21 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Oga::CSS::Parser do
|
||||||
|
context 'classes' do
|
||||||
|
example 'parse a class selector' do
|
||||||
|
parse_css('.foo').should == s(:class, 'foo')
|
||||||
|
end
|
||||||
|
|
||||||
|
example 'parse a selector for an element with a class' do
|
||||||
|
parse_css('foo.bar').should == s(:class, 'bar', s(:test, nil, 'foo'))
|
||||||
|
end
|
||||||
|
|
||||||
|
example 'parse a selector using multiple classes' do
|
||||||
|
parse_css('.foo.bar').should == s(:class, 'bar', s(:class, 'foo'))
|
||||||
|
end
|
||||||
|
|
||||||
|
example 'parse a selector using a class and an ID' do
|
||||||
|
parse_css('#foo.bar').should == s(:class, 'bar', s(:id, 'foo'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,17 @@
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe Oga::CSS::Parser do
|
||||||
|
context 'IDs' do
|
||||||
|
example 'parse an ID selector' do
|
||||||
|
parse_css('#foo').should == s(:id, 'foo')
|
||||||
|
end
|
||||||
|
|
||||||
|
example 'parse a selector for an element with an ID' do
|
||||||
|
parse_css('foo#bar').should == s(:id, 'bar', s(:test, nil, 'foo'))
|
||||||
|
end
|
||||||
|
|
||||||
|
example 'parse a selector using an ID and a class' do
|
||||||
|
parse_css('.foo#bar').should == s(:id, 'bar', s(:class, 'foo'))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue