Sha256: 3e1670dccdaa4d5748dfcfaac07558e01fc8a993f7def2bf15d4ce077719540e
Contents?: true
Size: 1.22 KB
Versions: 9
Compression:
Stored size: 1.22 KB
Contents
require 'spec_helper' describe Hexp::CssSelector::Parser do HC = Hexp::CssSelector # Is there really no way to include constant lookup in this namespace ?! subject(:parse_tree) { described_class.call(selector) } context 'with a single tag' do let(:selector) { 'body' } it { should eq HC::CommaSequence[ HC::Sequence[ HC::SimpleSequence[ HC::Element.new('body')]]] } end context 'with SASS specific syntax' do let(:selector) { '&.foo' } it 'should raise an exception' do expect{parse_tree}.to raise_exception end end context 'with an element, class and id specifier' do let(:selector) { '#main a.strong' } it { should eq HC::CommaSequence[ HC::Sequence[ HC::SimpleSequence[ HC::Id.new('main')], HC::SimpleSequence[ HC::Element.new('a'), HC::Class.new('strong')]]] } end context 'with an attribute selector' do let(:selector) { 'div[link=href]' } it { should eq HC::CommaSequence[ HC::Sequence[ HC::SimpleSequence[ HC::Element.new('div'), HC::Attribute.new('link', nil, '=', 'href', nil), ]]] } end end
Version data entries
9 entries across 9 versions & 1 rubygems