sass 3.2.0.alpha.86 → 3.2.0.alpha.88
Sign up to get free protection for your applications and to get access to all the features.
- data/REVISION +1 -1
- data/VERSION +1 -1
- data/lib/sass/css.rb +1 -1
- data/lib/sass/script/functions.rb +37 -0
- data/test/sass/css2sass_test.rb +16 -0
- data/test/sass/functions_test.rb +20 -0
- metadata +8 -8
data/REVISION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
40099dad35612c37c3197699a46a469af180c046
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.2.0.alpha.
|
1
|
+
3.2.0.alpha.88
|
data/lib/sass/css.rb
CHANGED
@@ -278,7 +278,7 @@ module Sass
|
|
278
278
|
if first_simple_sel(child).is_a?(Sass::Selector::Parent)
|
279
279
|
rule.parsed_rules = child.parsed_rules.resolve_parent_refs(rule.parsed_rules)
|
280
280
|
else
|
281
|
-
rule.parsed_rules = make_seq(
|
281
|
+
rule.parsed_rules = make_seq(*(first_seq(rule).members + first_seq(child).members))
|
282
282
|
end
|
283
283
|
|
284
284
|
rule.children = child.children
|
@@ -127,6 +127,12 @@ module Sass::Script
|
|
127
127
|
# \{#abs abs($value)}
|
128
128
|
# : Returns the absolute value of a number.
|
129
129
|
#
|
130
|
+
# \{#min min($x1, $x2, ...)\}
|
131
|
+
# : Finds the minimum of several values.
|
132
|
+
#
|
133
|
+
# \{#max max($x1, $x2, ...)\}
|
134
|
+
# : Finds the maximum of several values.
|
135
|
+
#
|
130
136
|
# ## List Functions {#list-functions}
|
131
137
|
#
|
132
138
|
# \{#length length($list)}
|
@@ -1216,6 +1222,37 @@ module Sass::Script
|
|
1216
1222
|
end
|
1217
1223
|
declare :abs, [:value]
|
1218
1224
|
|
1225
|
+
# Finds the minimum of several values. This function takes any number of
|
1226
|
+
# arguments.
|
1227
|
+
#
|
1228
|
+
# @example
|
1229
|
+
# min(1px, 4px) => 1px
|
1230
|
+
# min(5em, 3em, 4em) => 3em
|
1231
|
+
# @param values [[Number]] The numbers
|
1232
|
+
# @return [Number] The minimum value
|
1233
|
+
# @raise [ArgumentError] if any argument isn't a number, or if not all of
|
1234
|
+
# the arguments have comparable units
|
1235
|
+
def min(*values)
|
1236
|
+
values.each {|v| assert_type v, :Number}
|
1237
|
+
values.inject {|min, val| min.lt(val).to_bool ? min : val}
|
1238
|
+
end
|
1239
|
+
declare :min, [], :var_args => :true
|
1240
|
+
|
1241
|
+
# Finds the maximum of several values. This function takes any number of
|
1242
|
+
# arguments.
|
1243
|
+
#
|
1244
|
+
# @example
|
1245
|
+
# max(1px, 4px) => 1px
|
1246
|
+
# max(5em, 3em, 4em) => 3em
|
1247
|
+
# @return [Number] The maximum value
|
1248
|
+
# @raise [ArgumentError] if any argument isn't a number, or if not all of
|
1249
|
+
# the arguments have comparable units
|
1250
|
+
def max(*values)
|
1251
|
+
values.each {|v| assert_type v, :Number}
|
1252
|
+
values.inject {|max, val| max.gt(val).to_bool ? max : val}
|
1253
|
+
end
|
1254
|
+
declare :max, [], :var_args => :true
|
1255
|
+
|
1219
1256
|
# Return the length of a list.
|
1220
1257
|
#
|
1221
1258
|
# @example
|
data/test/sass/css2sass_test.rb
CHANGED
@@ -301,6 +301,22 @@ SASS
|
|
301
301
|
CSS
|
302
302
|
end
|
303
303
|
|
304
|
+
def test_triple_nesting
|
305
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
306
|
+
.foo .bar .baz
|
307
|
+
a: b
|
308
|
+
SASS
|
309
|
+
.foo .bar .baz {a: b}
|
310
|
+
CSS
|
311
|
+
|
312
|
+
assert_equal(<<SASS, css2sass(<<CSS))
|
313
|
+
.bar > .baz
|
314
|
+
c: d
|
315
|
+
SASS
|
316
|
+
.bar > .baz {c: d}
|
317
|
+
CSS
|
318
|
+
end
|
319
|
+
|
304
320
|
# Error reporting
|
305
321
|
|
306
322
|
def test_error_reporting
|
data/test/sass/functions_test.rb
CHANGED
@@ -154,6 +154,26 @@ class SassFunctionTest < Test::Unit::TestCase
|
|
154
154
|
assert_error_message("#aaaaaa is not a number for `abs'", "abs(#aaa)")
|
155
155
|
end
|
156
156
|
|
157
|
+
def test_min
|
158
|
+
#assert_equal("1", evaluate("min(1, 2, 3)"))
|
159
|
+
assert_equal("1", evaluate("min(3px, 2px, 1)"))
|
160
|
+
assert_equal("4em", evaluate("min(4em)"))
|
161
|
+
assert_equal("10cm", evaluate("min(10cm, 6in)"))
|
162
|
+
|
163
|
+
assert_error_message("#aaaaaa is not a number for `min'", "min(#aaa)")
|
164
|
+
assert_error_message("Incompatible units: 'px' and 'em'.", "min(3em, 4em, 1px)")
|
165
|
+
end
|
166
|
+
|
167
|
+
def test_max
|
168
|
+
assert_equal("3", evaluate("max(1, 2, 3)"))
|
169
|
+
assert_equal("3", evaluate("max(3, 2px, 1px)"))
|
170
|
+
assert_equal("4em", evaluate("max(4em)"))
|
171
|
+
assert_equal("6in", evaluate("max(10cm, 6in)"))
|
172
|
+
|
173
|
+
assert_error_message("#aaaaaa is not a number for `max'", "max(#aaa)")
|
174
|
+
assert_error_message("Incompatible units: 'px' and 'em'.", "max(3em, 4em, 1px)")
|
175
|
+
end
|
176
|
+
|
157
177
|
def test_rgb
|
158
178
|
assert_equal("#123456", evaluate("rgb(18, 52, 86)"))
|
159
179
|
assert_equal("#beaded", evaluate("rgb(190, 173, 237)"))
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sass
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 592303021
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
9
|
- 0
|
10
10
|
- alpha
|
11
|
-
-
|
12
|
-
version: 3.2.0.alpha.
|
11
|
+
- 88
|
12
|
+
version: 3.2.0.alpha.88
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Nathan Weizenbaum
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2012-
|
22
|
+
date: 2012-03-01 00:00:00 -05:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
@@ -133,24 +133,23 @@ files:
|
|
133
133
|
- lib/sass/shared.rb
|
134
134
|
- lib/sass/tree/charset_node.rb
|
135
135
|
- lib/sass/tree/comment_node.rb
|
136
|
+
- lib/sass/tree/directive_node.rb
|
136
137
|
- lib/sass/tree/media_node.rb
|
137
138
|
- lib/sass/tree/debug_node.rb
|
138
|
-
- lib/sass/tree/
|
139
|
+
- lib/sass/tree/mixin_def_node.rb
|
139
140
|
- lib/sass/tree/each_node.rb
|
140
141
|
- lib/sass/tree/extend_node.rb
|
141
142
|
- lib/sass/tree/for_node.rb
|
142
143
|
- lib/sass/tree/function_node.rb
|
143
144
|
- lib/sass/tree/if_node.rb
|
144
145
|
- lib/sass/tree/import_node.rb
|
145
|
-
- lib/sass/tree/mixin_def_node.rb
|
146
146
|
- lib/sass/tree/node.rb
|
147
|
+
- lib/sass/tree/rule_node.rb
|
147
148
|
- lib/sass/tree/mixin_node.rb
|
148
149
|
- lib/sass/tree/prop_node.rb
|
149
150
|
- lib/sass/tree/return_node.rb
|
150
151
|
- lib/sass/tree/root_node.rb
|
151
|
-
- lib/sass/tree/rule_node.rb
|
152
152
|
- lib/sass/tree/content_node.rb
|
153
|
-
- lib/sass/tree/trace_node.rb
|
154
153
|
- lib/sass/tree/variable_node.rb
|
155
154
|
- lib/sass/tree/visitors/base.rb
|
156
155
|
- lib/sass/tree/visitors/check_nesting.rb
|
@@ -163,6 +162,7 @@ files:
|
|
163
162
|
- lib/sass/tree/warn_node.rb
|
164
163
|
- lib/sass/tree/while_node.rb
|
165
164
|
- lib/sass/tree/css_import_node.rb
|
165
|
+
- lib/sass/tree/trace_node.rb
|
166
166
|
- lib/sass/media.rb
|
167
167
|
- lib/sass/util/multibyte_string_scanner.rb
|
168
168
|
- lib/sass/util/subset_map.rb
|