Basic tests for the CSS transformer.

This commit is contained in:
Yorick Peterse 2014-10-16 10:25:30 +02:00
parent 073e8fbe5b
commit 5fde2f9092
1 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,35 @@
require 'spec_helper'
describe Oga::CSS::Transformer do
context 'classes' do
before do
@transformer = described_class.new
end
example 'convert a class node without a node test' do
@transformer.process(parse_css('.foo')).should == s(
:axis,
'child',
s(
:test,
nil,
'*',
s(:eq, s(:axis, 'attribute', s(:test, nil, 'class')), s(:string, 'foo'))
)
)
end
example 'convert a class node with a node test' do
@transformer.process(parse_css('x.foo')).should == s(
:axis,
'child',
s(
:test,
nil,
'x',
s(:eq, s(:axis, 'attribute', s(:test, nil, 'class')), s(:string, 'foo'))
)
)
end
end
end