Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/stable' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed May 23, 2015
2 parents ac2dc4e + c5387f4 commit 4a4317c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion MIT-LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2006-2014 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein
Copyright (c) 2006-2015 Hampton Catlin, Natalie Weizenbaum, and Chris Eppstein

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
4 changes: 2 additions & 2 deletions lib/sass/script/value/color.rb
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def self.from_hex(hex_string, alpha = nil)
green = $2.ljust(2, $2).to_i(16)
blue = $3.ljust(2, $3).to_i(16)

hex_string = '##{hex_string}' unless hex_string[0] == ?#
hex_string = "##{hex_string}" unless hex_string[0] == ?#
attrs = {:red => red, :green => green, :blue => blue, :representation => hex_string}
attrs[:alpha] = alpha if alpha
new(attrs)
Expand Down Expand Up @@ -382,7 +382,7 @@ def hsl
# @return [Array<Fixnum>] A frozen four-element array of the hue,
# saturation, lightness, and alpha values (respectively) of the color
def hsla
[hue, saturation, lightness].freeze
[hue, saturation, lightness, alpha].freeze
end

# The SassScript `==` operation.
Expand Down
5 changes: 5 additions & 0 deletions test/sass/script_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def test_color_clamps_rgba_input
assert_equal 0, Sass::Script::Value::Color.new([1, 2, 3, -0.1]).alpha
end

def test_color_from_hex
assert_equal Sass::Script::Value::Color.new([0,0,0]), Sass::Script::Value::Color.from_hex('000000')
assert_equal Sass::Script::Value::Color.new([0,0,0]), Sass::Script::Value::Color.from_hex('#000000')
end

def test_string_escapes
assert_equal "'", resolve("\"'\"")
assert_equal '"', resolve("\"\\\"\"")
Expand Down

0 comments on commit 4a4317c

Please sign in to comment.