Sha256: 9ee7c8f0a7cc92478ca90e8cfc8d49d2dc94a246e933e0c1b5dfdcf2a9a74190
Contents?: true
Size: 1.15 KB
Versions: 3
Compression:
Stored size: 1.15 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::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::Universal.new, 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::SimpleSequence[ HC::Element.new('div'), HC::Attribute.new('link', :equal, 'href'), ]] } end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
hexp-0.4.6 | spec/unit/hexp/css_selector/parser_spec.rb |
hexp-0.4.5 | spec/unit/hexp/css_selector/parser_spec.rb |
hexp-0.4.4 | spec/unit/hexp/css_selector/parser_spec.rb |