oreorenasass 3.4.4 → 3.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +50 -70
- data/Rakefile +5 -26
- data/VERSION +1 -1
- data/VERSION_NAME +1 -1
- data/bin/sass +1 -1
- data/bin/scss +1 -1
- data/lib/sass.rb +12 -19
- data/lib/sass/cache_stores/base.rb +2 -2
- data/lib/sass/cache_stores/chain.rb +1 -2
- data/lib/sass/cache_stores/filesystem.rb +5 -1
- data/lib/sass/cache_stores/memory.rb +1 -1
- data/lib/sass/cache_stores/null.rb +2 -2
- data/lib/sass/callbacks.rb +0 -1
- data/lib/sass/css.rb +13 -11
- data/lib/sass/engine.rb +173 -424
- data/lib/sass/environment.rb +58 -148
- data/lib/sass/error.rb +14 -11
- data/lib/sass/exec.rb +703 -5
- data/lib/sass/importers/base.rb +6 -49
- data/lib/sass/importers/filesystem.rb +19 -44
- data/lib/sass/logger.rb +4 -1
- data/lib/sass/logger/base.rb +4 -2
- data/lib/sass/logger/log_level.rb +7 -3
- data/lib/sass/media.rb +23 -20
- data/lib/sass/plugin.rb +7 -7
- data/lib/sass/plugin/compiler.rb +145 -304
- data/lib/sass/plugin/configuration.rb +23 -18
- data/lib/sass/plugin/merb.rb +1 -1
- data/lib/sass/plugin/staleness_checker.rb +3 -3
- data/lib/sass/repl.rb +3 -3
- data/lib/sass/script.rb +8 -35
- data/lib/sass/script/{value/arg_list.rb → arg_list.rb} +25 -9
- data/lib/sass/script/bool.rb +18 -0
- data/lib/sass/script/color.rb +606 -0
- data/lib/sass/script/css_lexer.rb +4 -8
- data/lib/sass/script/css_parser.rb +2 -5
- data/lib/sass/script/funcall.rb +245 -0
- data/lib/sass/script/functions.rb +408 -1491
- data/lib/sass/script/interpolation.rb +79 -0
- data/lib/sass/script/lexer.rb +68 -172
- data/lib/sass/script/list.rb +85 -0
- data/lib/sass/script/literal.rb +221 -0
- data/lib/sass/script/{tree/node.rb → node.rb} +12 -22
- data/lib/sass/script/{value/null.rb → null.rb} +7 -14
- data/lib/sass/script/{value/number.rb → number.rb} +75 -152
- data/lib/sass/script/{tree/operation.rb → operation.rb} +24 -17
- data/lib/sass/script/parser.rb +110 -245
- data/lib/sass/script/string.rb +51 -0
- data/lib/sass/script/{tree/string_interpolation.rb → string_interpolation.rb} +4 -5
- data/lib/sass/script/{tree/unary_operation.rb → unary_operation.rb} +6 -6
- data/lib/sass/script/variable.rb +58 -0
- data/lib/sass/scss/css_parser.rb +3 -9
- data/lib/sass/scss/parser.rb +421 -450
- data/lib/sass/scss/rx.rb +11 -19
- data/lib/sass/scss/static_parser.rb +7 -321
- data/lib/sass/selector.rb +194 -68
- data/lib/sass/selector/abstract_sequence.rb +14 -29
- data/lib/sass/selector/comma_sequence.rb +25 -108
- data/lib/sass/selector/sequence.rb +66 -159
- data/lib/sass/selector/simple.rb +25 -23
- data/lib/sass/selector/simple_sequence.rb +63 -173
- data/lib/sass/shared.rb +1 -1
- data/lib/sass/supports.rb +15 -13
- data/lib/sass/tree/charset_node.rb +1 -1
- data/lib/sass/tree/comment_node.rb +3 -3
- data/lib/sass/tree/css_import_node.rb +11 -11
- data/lib/sass/tree/debug_node.rb +2 -2
- data/lib/sass/tree/directive_node.rb +4 -21
- data/lib/sass/tree/each_node.rb +8 -8
- data/lib/sass/tree/extend_node.rb +7 -14
- data/lib/sass/tree/for_node.rb +4 -4
- data/lib/sass/tree/function_node.rb +4 -9
- data/lib/sass/tree/if_node.rb +1 -1
- data/lib/sass/tree/import_node.rb +5 -4
- data/lib/sass/tree/media_node.rb +14 -4
- data/lib/sass/tree/mixin_def_node.rb +4 -4
- data/lib/sass/tree/mixin_node.rb +8 -21
- data/lib/sass/tree/node.rb +12 -54
- data/lib/sass/tree/prop_node.rb +20 -39
- data/lib/sass/tree/return_node.rb +2 -3
- data/lib/sass/tree/root_node.rb +3 -19
- data/lib/sass/tree/rule_node.rb +22 -35
- data/lib/sass/tree/supports_node.rb +13 -0
- data/lib/sass/tree/trace_node.rb +1 -2
- data/lib/sass/tree/variable_node.rb +3 -9
- data/lib/sass/tree/visitors/base.rb +8 -5
- data/lib/sass/tree/visitors/check_nesting.rb +19 -49
- data/lib/sass/tree/visitors/convert.rb +56 -74
- data/lib/sass/tree/visitors/cssize.rb +74 -202
- data/lib/sass/tree/visitors/deep_copy.rb +5 -10
- data/lib/sass/tree/visitors/extend.rb +7 -7
- data/lib/sass/tree/visitors/perform.rb +185 -278
- data/lib/sass/tree/visitors/set_options.rb +6 -20
- data/lib/sass/tree/visitors/to_css.rb +81 -234
- data/lib/sass/tree/warn_node.rb +2 -2
- data/lib/sass/tree/while_node.rb +2 -2
- data/lib/sass/util.rb +152 -522
- data/lib/sass/util/multibyte_string_scanner.rb +0 -2
- data/lib/sass/util/subset_map.rb +3 -4
- data/lib/sass/util/test.rb +1 -0
- data/lib/sass/version.rb +22 -20
- data/test/Gemfile +3 -0
- data/test/Gemfile.lock +10 -0
- data/test/sass/cache_test.rb +20 -62
- data/test/sass/callbacks_test.rb +1 -1
- data/test/sass/conversion_test.rb +2 -296
- data/test/sass/css2sass_test.rb +4 -23
- data/test/sass/engine_test.rb +354 -411
- data/test/sass/exec_test.rb +2 -2
- data/test/sass/extend_test.rb +145 -324
- data/test/sass/functions_test.rb +86 -873
- data/test/sass/importer_test.rb +21 -241
- data/test/sass/logger_test.rb +1 -1
- data/test/sass/more_results/more_import.css +1 -1
- data/test/sass/plugin_test.rb +26 -16
- data/test/sass/results/compact.css +1 -1
- data/test/sass/results/complex.css +4 -4
- data/test/sass/results/expanded.css +1 -1
- data/test/sass/results/import.css +1 -1
- data/test/sass/results/import_charset_ibm866.css +2 -2
- data/test/sass/results/mixins.css +17 -17
- data/test/sass/results/nested.css +1 -1
- data/test/sass/results/parent_ref.css +2 -2
- data/test/sass/results/script.css +3 -3
- data/test/sass/results/scss_import.css +1 -1
- data/test/sass/script_conversion_test.rb +7 -36
- data/test/sass/script_test.rb +53 -485
- data/test/sass/scss/css_test.rb +28 -143
- data/test/sass/scss/rx_test.rb +4 -4
- data/test/sass/scss/scss_test.rb +325 -2119
- data/test/sass/templates/scss_import.scss +1 -2
- data/test/sass/test_helper.rb +1 -1
- data/test/sass/util/multibyte_string_scanner_test.rb +1 -1
- data/test/sass/util/subset_map_test.rb +2 -2
- data/test/sass/util_test.rb +1 -86
- data/test/test_helper.rb +8 -37
- metadata +19 -66
- data/lib/sass/exec/base.rb +0 -187
- data/lib/sass/exec/sass_convert.rb +0 -264
- data/lib/sass/exec/sass_scss.rb +0 -424
- data/lib/sass/features.rb +0 -47
- data/lib/sass/script/tree.rb +0 -16
- data/lib/sass/script/tree/funcall.rb +0 -306
- data/lib/sass/script/tree/interpolation.rb +0 -118
- data/lib/sass/script/tree/list_literal.rb +0 -77
- data/lib/sass/script/tree/literal.rb +0 -45
- data/lib/sass/script/tree/map_literal.rb +0 -64
- data/lib/sass/script/tree/selector.rb +0 -26
- data/lib/sass/script/tree/variable.rb +0 -57
- data/lib/sass/script/value.rb +0 -11
- data/lib/sass/script/value/base.rb +0 -240
- data/lib/sass/script/value/bool.rb +0 -35
- data/lib/sass/script/value/color.rb +0 -680
- data/lib/sass/script/value/helpers.rb +0 -262
- data/lib/sass/script/value/list.rb +0 -113
- data/lib/sass/script/value/map.rb +0 -70
- data/lib/sass/script/value/string.rb +0 -97
- data/lib/sass/selector/pseudo.rb +0 -256
- data/lib/sass/source/map.rb +0 -210
- data/lib/sass/source/position.rb +0 -39
- data/lib/sass/source/range.rb +0 -41
- data/lib/sass/stack.rb +0 -120
- data/lib/sass/tree/at_root_node.rb +0 -83
- data/lib/sass/tree/error_node.rb +0 -18
- data/lib/sass/tree/keyframe_rule_node.rb +0 -15
- data/lib/sass/util/cross_platform_random.rb +0 -19
- data/lib/sass/util/normalized_map.rb +0 -130
- data/lib/sass/util/ordered_hash.rb +0 -192
- data/test/sass/compiler_test.rb +0 -232
- data/test/sass/encoding_test.rb +0 -219
- data/test/sass/source_map_test.rb +0 -977
- data/test/sass/superselector_test.rb +0 -191
- data/test/sass/util/normalized_map_test.rb +0 -51
- data/test/sass/value_helpers_test.rb +0 -179
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'strscan'
|
2
2
|
|
3
3
|
if Sass::Util.ruby1_8?
|
4
|
-
# rubocop:disable ConstantName
|
5
4
|
Sass::Util::MultibyteStringScanner = StringScanner
|
6
|
-
# rubocop:enable ConstantName
|
7
5
|
else
|
8
6
|
if Sass::Util.rbx?
|
9
7
|
# Rubinius's StringScanner class implements some of its methods in terms of
|
data/lib/sass/util/subset_map.rb
CHANGED
@@ -59,7 +59,7 @@ module Sass
|
|
59
59
|
#
|
60
60
|
# In the worst case, this runs in `O(m*max(n, log m))` time,
|
61
61
|
# where `n` is the size of `set`
|
62
|
-
# and `m` is the number of
|
62
|
+
# and `m` is the number of assocations in the map.
|
63
63
|
# However, unless many keys in the map overlap with `set`,
|
64
64
|
# `m` will typically be much smaller.
|
65
65
|
#
|
@@ -72,8 +72,7 @@ module Sass
|
|
72
72
|
# @see #[]
|
73
73
|
def get(set)
|
74
74
|
res = set.map do |k|
|
75
|
-
subsets = @hash[k]
|
76
|
-
next unless subsets
|
75
|
+
next unless subsets = @hash[k]
|
77
76
|
subsets.map do |subenum, subset, index|
|
78
77
|
next unless subset.subset?(set)
|
79
78
|
[index, subenum]
|
@@ -84,7 +83,7 @@ module Sass
|
|
84
83
|
res.uniq!
|
85
84
|
res.sort!
|
86
85
|
res.map! {|i, s| [@vals[i], s]}
|
87
|
-
res
|
86
|
+
return res
|
88
87
|
end
|
89
88
|
|
90
89
|
# Same as \{#get}, but doesn't return the subsets of the argument
|
data/lib/sass/util/test.rb
CHANGED
data/lib/sass/version.rb
CHANGED
@@ -1,4 +1,8 @@
|
|
1
1
|
require 'date'
|
2
|
+
|
3
|
+
# This is necessary for loading Sass when Haml is required in Rails 3.
|
4
|
+
# Once the split is complete, we can remove it.
|
5
|
+
require File.dirname(__FILE__) + '/../sass'
|
2
6
|
require 'sass/util'
|
3
7
|
|
4
8
|
module Sass
|
@@ -7,13 +11,14 @@ module Sass
|
|
7
11
|
# but its Git revision hash as well,
|
8
12
|
# if it was installed from Git.
|
9
13
|
module Version
|
14
|
+
include Sass::Util
|
15
|
+
|
10
16
|
# Returns a hash representing the version of Sass.
|
11
17
|
# The `:major`, `:minor`, and `:teeny` keys have their respective numbers as Fixnums.
|
12
18
|
# The `:name` key has the name of the version.
|
13
19
|
# The `:string` key contains a human-readable string representation of the version.
|
14
20
|
# The `:number` key is the major, minor, and teeny keys separated by periods.
|
15
|
-
# The `:date` key, which is not guaranteed to be defined, is the
|
16
|
-
# at which this release was cut.
|
21
|
+
# The `:date` key, which is not guaranteed to be defined, is the [DateTime] at which this release was cut.
|
17
22
|
# If Sass is checked out from Git, the `:rev` key will have the revision hash.
|
18
23
|
# For example:
|
19
24
|
#
|
@@ -42,14 +47,12 @@ module Sass
|
|
42
47
|
# }
|
43
48
|
#
|
44
49
|
# @return [{Symbol => String/Fixnum}] The version hash
|
45
|
-
# @comment
|
46
|
-
# rubocop:disable ClassVars
|
47
50
|
def version
|
48
51
|
return @@version if defined?(@@version)
|
49
52
|
|
50
|
-
numbers = File.read(
|
53
|
+
numbers = File.read(scope('VERSION')).strip.split('.').
|
51
54
|
map {|n| n =~ /^[0-9]+$/ ? n.to_i : n}
|
52
|
-
name = File.read(
|
55
|
+
name = File.read(scope('VERSION_NAME')).strip
|
53
56
|
@@version = {
|
54
57
|
:major => numbers[0],
|
55
58
|
:minor => numbers[1],
|
@@ -57,7 +60,7 @@ module Sass
|
|
57
60
|
:name => name
|
58
61
|
}
|
59
62
|
|
60
|
-
if
|
63
|
+
if date = version_date
|
61
64
|
@@version[:date] = date
|
62
65
|
end
|
63
66
|
|
@@ -70,7 +73,7 @@ module Sass
|
|
70
73
|
@@version[:number] = numbers.join('.')
|
71
74
|
@@version[:string] = @@version[:number].dup
|
72
75
|
|
73
|
-
if
|
76
|
+
if rev = revision_number
|
74
77
|
@@version[:rev] = rev
|
75
78
|
unless rev[0] == ?(
|
76
79
|
@@version[:string] << "." << rev[0...7]
|
@@ -80,25 +83,24 @@ module Sass
|
|
80
83
|
@@version[:string] << " (#{name})"
|
81
84
|
@@version
|
82
85
|
end
|
83
|
-
# rubocop:enable ClassVars
|
84
86
|
|
85
87
|
private
|
86
88
|
|
87
89
|
def revision_number
|
88
|
-
if File.
|
89
|
-
rev = File.read(
|
90
|
+
if File.exists?(scope('REVISION'))
|
91
|
+
rev = File.read(scope('REVISION')).strip
|
90
92
|
return rev unless rev =~ /^([a-f0-9]+|\(.*\))$/ || rev == '(unknown)'
|
91
93
|
end
|
92
94
|
|
93
|
-
return unless File.
|
94
|
-
rev = File.read(
|
95
|
+
return unless File.exists?(scope('.git/HEAD'))
|
96
|
+
rev = File.read(scope('.git/HEAD')).strip
|
95
97
|
return rev unless rev =~ /^ref: (.*)$/
|
96
98
|
|
97
99
|
ref_name = $1
|
98
|
-
ref_file =
|
99
|
-
info_file =
|
100
|
-
return File.read(ref_file).strip if File.
|
101
|
-
return unless File.
|
100
|
+
ref_file = scope(".git/#{ref_name}")
|
101
|
+
info_file = scope(".git/info/refs")
|
102
|
+
return File.read(ref_file).strip if File.exists?(ref_file)
|
103
|
+
return unless File.exists?(info_file)
|
102
104
|
File.open(info_file) do |f|
|
103
105
|
f.each do |l|
|
104
106
|
sha, ref = l.strip.split("\t", 2)
|
@@ -106,12 +108,12 @@ module Sass
|
|
106
108
|
return sha
|
107
109
|
end
|
108
110
|
end
|
109
|
-
nil
|
111
|
+
return nil
|
110
112
|
end
|
111
113
|
|
112
114
|
def version_date
|
113
|
-
return unless File.
|
114
|
-
DateTime.parse(File.read(
|
115
|
+
return unless File.exists?(scope('VERSION_DATE'))
|
116
|
+
return DateTime.parse(File.read(scope('VERSION_DATE')).strip)
|
115
117
|
end
|
116
118
|
end
|
117
119
|
|
data/test/Gemfile
ADDED
data/test/Gemfile.lock
ADDED
data/test/sass/cache_test.rb
CHANGED
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
|
|
3
3
|
require File.dirname(__FILE__) + '/test_helper'
|
4
4
|
require 'sass/engine'
|
5
5
|
|
6
|
-
class CacheTest <
|
6
|
+
class CacheTest < Test::Unit::TestCase
|
7
7
|
@@cache_dir = "tmp/file_cache"
|
8
8
|
|
9
9
|
def setup
|
@@ -18,42 +18,42 @@ class CacheTest < MiniTest::Test
|
|
18
18
|
def test_file_cache_writes_a_file
|
19
19
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
20
20
|
file_store.store("asdf/foo.scssc", "fakesha1", root_node)
|
21
|
-
assert File.
|
21
|
+
assert File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
22
22
|
end
|
23
23
|
|
24
24
|
def test_file_cache_reads_a_file
|
25
25
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
26
|
-
assert !File.
|
26
|
+
assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
27
27
|
file_store.store("asdf/foo.scssc", "fakesha1", root_node)
|
28
|
-
assert File.
|
28
|
+
assert File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
29
29
|
assert_kind_of Sass::Tree::RootNode, file_store.retrieve("asdf/foo.scssc", "fakesha1")
|
30
30
|
end
|
31
31
|
|
32
32
|
def test_file_cache_miss_returns_nil
|
33
33
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
34
|
-
assert !File.
|
34
|
+
assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
35
35
|
assert_nil file_store.retrieve("asdf/foo.scssc", "fakesha1")
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_sha_change_invalidates_cache_and_cleans_up
|
39
39
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
40
|
-
assert !File.
|
40
|
+
assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
41
41
|
file_store.store("asdf/foo.scssc", "fakesha1", root_node)
|
42
|
-
assert File.
|
42
|
+
assert File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
43
43
|
assert_nil file_store.retrieve("asdf/foo.scssc", "differentsha1")
|
44
|
-
assert !File.
|
44
|
+
assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
45
45
|
end
|
46
46
|
|
47
47
|
def test_version_change_invalidates_cache_and_cleans_up
|
48
48
|
file_store = Sass::CacheStores::Filesystem.new(@@cache_dir)
|
49
|
-
assert !File.
|
49
|
+
assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
50
50
|
file_store.store("asdf/foo.scssc", "fakesha1", root_node)
|
51
|
-
assert File.
|
51
|
+
assert File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
52
52
|
real_version = Sass::VERSION
|
53
53
|
begin
|
54
54
|
Sass::VERSION.replace("a different version")
|
55
55
|
assert_nil file_store.retrieve("asdf/foo.scssc", "fakesha1")
|
56
|
-
assert !File.
|
56
|
+
assert !File.exists?("#{@@cache_dir}/asdf/foo.scssc")
|
57
57
|
ensure
|
58
58
|
Sass::VERSION.replace(real_version)
|
59
59
|
end
|
@@ -66,52 +66,17 @@ class CacheTest < MiniTest::Test
|
|
66
66
|
assert_equal an_object, cache.retrieve("an_object", "")
|
67
67
|
end
|
68
68
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
# Regression tests
|
74
|
-
|
75
|
-
def test_cache_mixin_def_splat_sass_node_with_unmarshalable_option
|
76
|
-
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
77
|
-
=color($args...)
|
78
|
-
color: red
|
79
|
-
SASS
|
80
|
-
end
|
81
|
-
|
82
|
-
def test_cache_mixin_def_splat_scss_node_with_unmarshalable_option
|
83
|
-
engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
|
84
|
-
@mixin color($args...) {
|
85
|
-
color: red;
|
86
|
-
}
|
87
|
-
SCSS
|
88
|
-
end
|
89
|
-
|
90
|
-
def test_cache_function_splat_sass_node_with_unmarshalable_option
|
91
|
-
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
92
|
-
@function color($args...)
|
93
|
-
@return red
|
94
|
-
SASS
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_cache_function_splat_scss_node_with_unmarshalable_option
|
98
|
-
engine_with_unmarshalable_options(<<SCSS, :syntax => :scss).to_tree
|
99
|
-
@function color($args...) {
|
100
|
-
@return red;
|
101
|
-
}
|
102
|
-
SCSS
|
103
|
-
end
|
104
|
-
|
105
|
-
def test_cache_include_splat_sass_node_with_unmarshalable_option
|
106
|
-
engine_with_unmarshalable_options(<<SASS, :syntax => :sass).to_tree
|
107
|
-
@include color($args..., $kwargs...)
|
108
|
-
SASS
|
69
|
+
class Unmarshalable
|
70
|
+
def _dump(_)
|
71
|
+
raise 'Unmarshalable'
|
72
|
+
end
|
109
73
|
end
|
110
74
|
|
111
|
-
def
|
112
|
-
|
113
|
-
|
114
|
-
|
75
|
+
def test_cache_node_with_unmarshalable_option
|
76
|
+
engine = Sass::Engine.new("foo {a: b + c}",
|
77
|
+
:syntax => :scss, :object => Unmarshalable.new, :filename => 'file.scss',
|
78
|
+
:importer => Sass::Importers::Filesystem.new(absolutize('templates')))
|
79
|
+
engine.to_tree
|
115
80
|
end
|
116
81
|
|
117
82
|
private
|
@@ -121,11 +86,4 @@ SCSS
|
|
121
86
|
div { @include color(red); }
|
122
87
|
SCSS
|
123
88
|
end
|
124
|
-
|
125
|
-
def engine_with_unmarshalable_options(src, options={})
|
126
|
-
Sass::Engine.new(src, {
|
127
|
-
:syntax => :scss, :object => Class.new.new, :filename => 'file.scss',
|
128
|
-
:importer => Sass::Importers::Filesystem.new(absolutize('templates'))
|
129
|
-
}.merge(options))
|
130
|
-
end
|
131
89
|
end
|
data/test/sass/callbacks_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
require File.dirname(__FILE__) + '/../test_helper'
|
3
3
|
|
4
|
-
class ConversionTest <
|
4
|
+
class ConversionTest < Test::Unit::TestCase
|
5
5
|
def test_basic
|
6
6
|
assert_renders <<SASS, <<SCSS
|
7
7
|
foo bar
|
@@ -499,29 +499,6 @@ foo
|
|
499
499
|
SASS
|
500
500
|
end
|
501
501
|
|
502
|
-
def test_loud_comment_containing_silent_comment
|
503
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
504
|
-
/*
|
505
|
-
*// foo bar
|
506
|
-
SASS
|
507
|
-
/*
|
508
|
-
// foo bar
|
509
|
-
*/
|
510
|
-
SCSS
|
511
|
-
end
|
512
|
-
|
513
|
-
def test_silent_comment_containing_loud_comment
|
514
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
515
|
-
// /*
|
516
|
-
// * foo bar
|
517
|
-
// */
|
518
|
-
SASS
|
519
|
-
// /*
|
520
|
-
// * foo bar
|
521
|
-
// */
|
522
|
-
SCSS
|
523
|
-
end
|
524
|
-
|
525
502
|
def test_immediately_preceding_comments
|
526
503
|
assert_renders <<SASS, <<SCSS
|
527
504
|
/* Foo
|
@@ -554,28 +531,6 @@ SASS
|
|
554
531
|
SCSS
|
555
532
|
end
|
556
533
|
|
557
|
-
def test_immediately_following_comments
|
558
|
-
assert_sass_to_scss <<SCSS, <<SASS
|
559
|
-
.foobar {
|
560
|
-
// trailing comment
|
561
|
-
a: 1px;
|
562
|
-
}
|
563
|
-
SCSS
|
564
|
-
.foobar // trailing comment
|
565
|
-
a: 1px
|
566
|
-
SASS
|
567
|
-
|
568
|
-
assert_sass_to_scss <<SCSS, <<SASS
|
569
|
-
.foobar {
|
570
|
-
// trailing comment
|
571
|
-
a: 1px;
|
572
|
-
}
|
573
|
-
SCSS
|
574
|
-
.foobar /* trailing comment */
|
575
|
-
a: 1px
|
576
|
-
SASS
|
577
|
-
end
|
578
|
-
|
579
534
|
def test_debug
|
580
535
|
assert_renders <<SASS, <<SCSS
|
581
536
|
foo
|
@@ -589,19 +544,6 @@ foo {
|
|
589
544
|
SCSS
|
590
545
|
end
|
591
546
|
|
592
|
-
def test_error
|
593
|
-
assert_renders <<SASS, <<SCSS
|
594
|
-
foo
|
595
|
-
@error "oh no!"
|
596
|
-
bar: baz
|
597
|
-
SASS
|
598
|
-
foo {
|
599
|
-
@error "oh no!";
|
600
|
-
bar: baz;
|
601
|
-
}
|
602
|
-
SCSS
|
603
|
-
end
|
604
|
-
|
605
547
|
def test_directive_without_children
|
606
548
|
assert_renders <<SASS, <<SCSS
|
607
549
|
foo
|
@@ -783,10 +725,6 @@ a
|
|
783
725
|
c
|
784
726
|
@each $str in foo, bar, baz, bang
|
785
727
|
d: $str
|
786
|
-
|
787
|
-
c
|
788
|
-
@each $key, $value in (foo: 1, bar: 2, baz: 3)
|
789
|
-
\#{$key}: $value
|
790
728
|
SASS
|
791
729
|
a {
|
792
730
|
@each $number in 1px 2px 3px 4px {
|
@@ -799,12 +737,6 @@ c {
|
|
799
737
|
d: $str;
|
800
738
|
}
|
801
739
|
}
|
802
|
-
|
803
|
-
c {
|
804
|
-
@each $key, $value in (foo: 1, bar: 2, baz: 3) {
|
805
|
-
\#{$key}: $value;
|
806
|
-
}
|
807
|
-
}
|
808
740
|
SCSS
|
809
741
|
end
|
810
742
|
|
@@ -1045,19 +977,6 @@ foo {
|
|
1045
977
|
SCSS
|
1046
978
|
end
|
1047
979
|
|
1048
|
-
def test_mixin_include_with_hyphen_conversion_keyword_arg
|
1049
|
-
assert_renders <<SASS, <<SCSS
|
1050
|
-
foo
|
1051
|
-
+foo-bar($a-b_c: val)
|
1052
|
-
a: blip
|
1053
|
-
SASS
|
1054
|
-
foo {
|
1055
|
-
@include foo-bar($a-b_c: val);
|
1056
|
-
a: blip;
|
1057
|
-
}
|
1058
|
-
SCSS
|
1059
|
-
end
|
1060
|
-
|
1061
980
|
def test_argless_function_definition
|
1062
981
|
assert_renders <<SASS, <<SCSS
|
1063
982
|
@function foo()
|
@@ -1280,17 +1199,6 @@ $val: 20;
|
|
1280
1199
|
SCSS
|
1281
1200
|
end
|
1282
1201
|
|
1283
|
-
def test_media_with_feature
|
1284
|
-
assert_sass_to_scss <<SCSS, <<SASS
|
1285
|
-
@media screen and (-webkit-transform-3d) {
|
1286
|
-
a: b;
|
1287
|
-
}
|
1288
|
-
SCSS
|
1289
|
-
@media screen and (-webkit-transform-3d)
|
1290
|
-
a: b
|
1291
|
-
SASS
|
1292
|
-
end
|
1293
|
-
|
1294
1202
|
def test_supports_with_expressions
|
1295
1203
|
assert_renders <<SASS, <<SCSS
|
1296
1204
|
$query: "(feature1: val)"
|
@@ -1439,7 +1347,7 @@ div
|
|
1439
1347
|
SASS
|
1440
1348
|
end
|
1441
1349
|
|
1442
|
-
|
1350
|
+
def test_loud_comment_conversion
|
1443
1351
|
assert_renders(<<SASS, <<SCSS)
|
1444
1352
|
/*! \#{"interpolated"}
|
1445
1353
|
SASS
|
@@ -1681,28 +1589,6 @@ SASS
|
|
1681
1589
|
SCSS
|
1682
1590
|
end
|
1683
1591
|
|
1684
|
-
def test_mixin_var_kwargs
|
1685
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
1686
|
-
=foo($a: b, $c: d)
|
1687
|
-
a: $a
|
1688
|
-
c: $c
|
1689
|
-
|
1690
|
-
.foo
|
1691
|
-
+foo($list..., $map...)
|
1692
|
-
+foo(pos, $list..., $kwd: val, $map...)
|
1693
|
-
SASS
|
1694
|
-
@mixin foo($a: b, $c: d) {
|
1695
|
-
a: $a;
|
1696
|
-
c: $c;
|
1697
|
-
}
|
1698
|
-
|
1699
|
-
.foo {
|
1700
|
-
@include foo($list..., $map...);
|
1701
|
-
@include foo(pos, $list..., $kwd: val, $map...);
|
1702
|
-
}
|
1703
|
-
SCSS
|
1704
|
-
end
|
1705
|
-
|
1706
1592
|
def test_function_var_args
|
1707
1593
|
assert_scss_to_sass <<SASS, <<SCSS
|
1708
1594
|
@function foo($args...)
|
@@ -1730,141 +1616,6 @@ SASS
|
|
1730
1616
|
SCSS
|
1731
1617
|
end
|
1732
1618
|
|
1733
|
-
def test_function_var_kwargs
|
1734
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
1735
|
-
@function foo($a: b, $c: d)
|
1736
|
-
@return foo
|
1737
|
-
|
1738
|
-
.foo
|
1739
|
-
a: foo($list..., $map...)
|
1740
|
-
b: foo(pos, $list..., $kwd: val, $map...)
|
1741
|
-
SASS
|
1742
|
-
@function foo($a: b, $c: d) {
|
1743
|
-
@return foo;
|
1744
|
-
}
|
1745
|
-
|
1746
|
-
.foo {
|
1747
|
-
a: foo($list..., $map...);
|
1748
|
-
b: foo(pos, $list..., $kwd: val, $map...);
|
1749
|
-
}
|
1750
|
-
SCSS
|
1751
|
-
end
|
1752
|
-
|
1753
|
-
def test_at_root
|
1754
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
1755
|
-
.foo
|
1756
|
-
@at-root
|
1757
|
-
.bar
|
1758
|
-
a: b
|
1759
|
-
.baz
|
1760
|
-
c: d
|
1761
|
-
SASS
|
1762
|
-
.foo {
|
1763
|
-
@at-root {
|
1764
|
-
.bar {
|
1765
|
-
a: b;
|
1766
|
-
}
|
1767
|
-
.baz {
|
1768
|
-
c: d;
|
1769
|
-
}
|
1770
|
-
}
|
1771
|
-
}
|
1772
|
-
SCSS
|
1773
|
-
end
|
1774
|
-
|
1775
|
-
def test_at_root_with_selector
|
1776
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
1777
|
-
.foo
|
1778
|
-
@at-root .bar
|
1779
|
-
a: b
|
1780
|
-
SASS
|
1781
|
-
.foo {
|
1782
|
-
@at-root .bar {
|
1783
|
-
a: b;
|
1784
|
-
}
|
1785
|
-
}
|
1786
|
-
SCSS
|
1787
|
-
end
|
1788
|
-
|
1789
|
-
def test_at_root_without
|
1790
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
1791
|
-
.foo
|
1792
|
-
@at-root (without: media rule)
|
1793
|
-
a: b
|
1794
|
-
SASS
|
1795
|
-
.foo {
|
1796
|
-
@at-root (without: media rule) {
|
1797
|
-
a: b;
|
1798
|
-
}
|
1799
|
-
}
|
1800
|
-
SCSS
|
1801
|
-
end
|
1802
|
-
|
1803
|
-
def test_at_root_with
|
1804
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
1805
|
-
.foo
|
1806
|
-
@at-root (with: media rule)
|
1807
|
-
a: b
|
1808
|
-
SASS
|
1809
|
-
.foo {
|
1810
|
-
@at-root (with: media rule) {
|
1811
|
-
a: b;
|
1812
|
-
}
|
1813
|
-
}
|
1814
|
-
SCSS
|
1815
|
-
end
|
1816
|
-
|
1817
|
-
def test_function_var_kwargs_with_list
|
1818
|
-
assert_scss_to_sass <<SASS, <<SCSS
|
1819
|
-
@function foo($a: b, $c: d)
|
1820
|
-
@return $a, $c
|
1821
|
-
|
1822
|
-
.foo
|
1823
|
-
a: foo($list..., $map...)
|
1824
|
-
SASS
|
1825
|
-
@function foo($a: b, $c: d) {
|
1826
|
-
@return $a, $c;
|
1827
|
-
}
|
1828
|
-
|
1829
|
-
.foo {
|
1830
|
-
a: foo($list..., $map...);
|
1831
|
-
}
|
1832
|
-
SCSS
|
1833
|
-
end
|
1834
|
-
|
1835
|
-
def test_keyframes
|
1836
|
-
assert_renders(<<SASS, <<SCSS)
|
1837
|
-
@keyframes identifier
|
1838
|
-
0%
|
1839
|
-
top: 0
|
1840
|
-
left: 0
|
1841
|
-
30%
|
1842
|
-
top: 50px
|
1843
|
-
68%, 72%
|
1844
|
-
left: 50px
|
1845
|
-
100%
|
1846
|
-
top: 100px
|
1847
|
-
left: 100%
|
1848
|
-
SASS
|
1849
|
-
@keyframes identifier {
|
1850
|
-
0% {
|
1851
|
-
top: 0;
|
1852
|
-
left: 0;
|
1853
|
-
}
|
1854
|
-
30% {
|
1855
|
-
top: 50px;
|
1856
|
-
}
|
1857
|
-
68%, 72% {
|
1858
|
-
left: 50px;
|
1859
|
-
}
|
1860
|
-
100% {
|
1861
|
-
top: 100px;
|
1862
|
-
left: 100%;
|
1863
|
-
}
|
1864
|
-
}
|
1865
|
-
SCSS
|
1866
|
-
end
|
1867
|
-
|
1868
1619
|
## Regression Tests
|
1869
1620
|
|
1870
1621
|
def test_list_in_args
|
@@ -1941,34 +1692,6 @@ foo {
|
|
1941
1692
|
SCSS
|
1942
1693
|
end
|
1943
1694
|
|
1944
|
-
def test_keyword_arguments
|
1945
|
-
assert_renders(<<SASS, <<SCSS, :dasherize => true)
|
1946
|
-
$foo: foo($dash-ed: 2px)
|
1947
|
-
SASS
|
1948
|
-
$foo: foo($dash-ed: 2px);
|
1949
|
-
SCSS
|
1950
|
-
assert_scss_to_sass(<<SASS, <<SCSS, :dasherize => true)
|
1951
|
-
$foo: foo($dash-ed: 2px)
|
1952
|
-
SASS
|
1953
|
-
$foo: foo($dash_ed: 2px);
|
1954
|
-
SCSS
|
1955
|
-
assert_sass_to_scss(<<SCSS, <<SASS, :dasherize => true)
|
1956
|
-
$foo: foo($dash-ed: 2px);
|
1957
|
-
SCSS
|
1958
|
-
$foo: foo($dash_ed: 2px)
|
1959
|
-
SASS
|
1960
|
-
assert_renders(<<SASS, <<SCSS)
|
1961
|
-
$foo: foo($under_scored: 1px)
|
1962
|
-
SASS
|
1963
|
-
$foo: foo($under_scored: 1px);
|
1964
|
-
SCSS
|
1965
|
-
assert_renders(<<SASS, <<SCSS)
|
1966
|
-
$foo: foo($dash-ed: 2px, $under_scored: 1px)
|
1967
|
-
SASS
|
1968
|
-
$foo: foo($dash-ed: 2px, $under_scored: 1px);
|
1969
|
-
SCSS
|
1970
|
-
end
|
1971
|
-
|
1972
1695
|
def test_ambiguous_negation
|
1973
1696
|
assert_renders(<<SASS, <<SCSS, :indent => ' ')
|
1974
1697
|
foo
|
@@ -1986,23 +1709,6 @@ foo {
|
|
1986
1709
|
SCSS
|
1987
1710
|
end
|
1988
1711
|
|
1989
|
-
def test_variable_with_global
|
1990
|
-
assert_renders(<<SASS, <<SCSS)
|
1991
|
-
$var: 1
|
1992
|
-
|
1993
|
-
foo
|
1994
|
-
$var: 2 !global
|
1995
|
-
$var: 3 !global !default
|
1996
|
-
SASS
|
1997
|
-
$var: 1;
|
1998
|
-
|
1999
|
-
foo {
|
2000
|
-
$var: 2 !global;
|
2001
|
-
$var: 3 !global !default;
|
2002
|
-
}
|
2003
|
-
SCSS
|
2004
|
-
end
|
2005
|
-
|
2006
1712
|
private
|
2007
1713
|
|
2008
1714
|
def assert_sass_to_sass(sass, options = {})
|