Sha256: a99bf08421f9d2be7ace936723fa27ce06944b19792087e3e6e0fe3d742b63d8
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
require 'spec_helper' describe Less::Parser do cwd = Pathname(__FILE__).dirname describe "simple usage" do it "parse less into a tree" do root = subject.parse(".class {width: 1+1}") root.to_css.gsub(/\n/,'').should eql ".class { width: 2;}" end it "accepts options when assembling the parse tree" do subject.parse(".class {width: 1+1}").to_css(:compress => true).strip.should eql ".class{width:2;}" end end it "throws a ParseError if the lesscss is bogus" do expect {subject.parse('{^)')}.should raise_error(Less::ParseError) end it "passes exceptions from the less compiler" do expect {subject.parse('body { color: @a; }').to_css}.should raise_error(Less::ParseError, /variable @a is undefined/) end describe "when configured with multiple load paths" do subject {Less::Parser.new :paths => [cwd.join('one'), cwd.join('two'), cwd.join('faulty')]} it "will load files from both paths" do subject.parse('@import "one.less";').to_css.gsub(/\n/,'').strip.should eql ".one { width: 1;}" subject.parse('@import "two.less";').to_css.gsub(/\n/,'').strip.should eql ".two { width: 1;}" end it "passes exceptions from less imported less files" do expect {subject.parse('@import "faulty.less";').to_css}.should raise_error(Less::ParseError, /variable @a is undefined/) end end describe "when load paths are specified in as default options" do before do Less.paths << cwd.join('one') Less.paths << cwd.join('two') @parser = Less::Parser.new end after do Less.paths.clear end it "will load files from default load paths" do @parser.parse('@import "one.less";').to_css.gsub(/\n/,'').strip.should eql ".one { width: 1;}" @parser.parse('@import "two.less";').to_css.gsub(/\n/,'').strip.should eql ".two { width: 1;}" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
less-2.1.0 | spec/less/parser_spec.rb |
less-2.0.12 | spec/less/parser_spec.rb |
less-2.0.11 | spec/less/parser_spec.rb |