[Sass] Fix a bug in css2sass exposed by css2sass_test.

This commit is contained in:
Nathan Weizenbaum 2009-02-19 20:05:11 -08:00
parent ef2095a7cb
commit 9571d9af29
5 changed files with 17 additions and 1 deletions

View File

@ -377,7 +377,7 @@ module Sass
def fold_commas(root)
prev_rule = nil
root.children.map! do |child|
next child unless Tree::RuleNode === child
next child unless child.is_a?(Tree::RuleNode)
if prev_rule && prev_rule.children == child.children
prev_rule.rule << ", #{child.rule}"

View File

@ -9,6 +9,10 @@ module Sass::Tree
super(value, style)
end
def ==(other)
self.class == other.class && name == other.name && super
end
def to_s(tabs, parent_name = nil)
if value[-1] == ?;
raise Sass::SyntaxError.new("Invalid attribute: #{declaration.dump} (This isn't CSS!).", @line)

View File

@ -17,6 +17,10 @@ module Sass
@children << child
end
def ==(other)
self.class == other.class && other.children == children
end
def to_s
result = String.new
children.each do |child|

View File

@ -9,6 +9,10 @@ module Sass::Tree
alias_method :rule, :value
alias_method :rule=, :value=
def ==(other)
self.class == other.class && rules == other.rules && super
end
def rules
Array(rule)
end

View File

@ -9,6 +9,10 @@ module Sass::Tree
super(style)
end
def ==(other)
self.class == other.class && value == other.value && super
end
def to_s(tabs = 0)
value
end