sass 3.3.0 → 3.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (151) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +1 -1
  3. data/README.md +58 -50
  4. data/Rakefile +1 -4
  5. data/VERSION +1 -1
  6. data/VERSION_DATE +1 -1
  7. data/VERSION_NAME +1 -1
  8. data/bin/sass +1 -1
  9. data/bin/scss +1 -1
  10. data/lib/sass/cache_stores/filesystem.rb +6 -2
  11. data/lib/sass/css.rb +1 -3
  12. data/lib/sass/engine.rb +37 -46
  13. data/lib/sass/environment.rb +13 -17
  14. data/lib/sass/error.rb +6 -9
  15. data/lib/sass/exec/base.rb +187 -0
  16. data/lib/sass/exec/sass_convert.rb +264 -0
  17. data/lib/sass/exec/sass_scss.rb +424 -0
  18. data/lib/sass/exec.rb +5 -771
  19. data/lib/sass/features.rb +7 -0
  20. data/lib/sass/importers/base.rb +7 -2
  21. data/lib/sass/importers/filesystem.rb +9 -25
  22. data/lib/sass/importers.rb +0 -1
  23. data/lib/sass/media.rb +1 -4
  24. data/lib/sass/plugin/compiler.rb +200 -83
  25. data/lib/sass/plugin/staleness_checker.rb +1 -1
  26. data/lib/sass/plugin.rb +3 -3
  27. data/lib/sass/script/css_lexer.rb +1 -1
  28. data/lib/sass/script/functions.rb +622 -268
  29. data/lib/sass/script/lexer.rb +99 -34
  30. data/lib/sass/script/parser.rb +24 -23
  31. data/lib/sass/script/tree/funcall.rb +1 -1
  32. data/lib/sass/script/tree/interpolation.rb +20 -2
  33. data/lib/sass/script/tree/selector.rb +26 -0
  34. data/lib/sass/script/tree/string_interpolation.rb +1 -1
  35. data/lib/sass/script/tree.rb +1 -0
  36. data/lib/sass/script/value/base.rb +7 -5
  37. data/lib/sass/script/value/bool.rb +0 -5
  38. data/lib/sass/script/value/color.rb +39 -21
  39. data/lib/sass/script/value/helpers.rb +107 -0
  40. data/lib/sass/script/value/list.rb +0 -15
  41. data/lib/sass/script/value/null.rb +0 -5
  42. data/lib/sass/script/value/number.rb +62 -14
  43. data/lib/sass/script/value/string.rb +59 -11
  44. data/lib/sass/script/value.rb +0 -1
  45. data/lib/sass/scss/css_parser.rb +8 -2
  46. data/lib/sass/scss/parser.rb +190 -328
  47. data/lib/sass/scss/rx.rb +15 -6
  48. data/lib/sass/scss/static_parser.rb +298 -1
  49. data/lib/sass/selector/abstract_sequence.rb +28 -13
  50. data/lib/sass/selector/comma_sequence.rb +92 -13
  51. data/lib/sass/selector/pseudo.rb +256 -0
  52. data/lib/sass/selector/sequence.rb +94 -24
  53. data/lib/sass/selector/simple.rb +14 -25
  54. data/lib/sass/selector/simple_sequence.rb +97 -33
  55. data/lib/sass/selector.rb +57 -194
  56. data/lib/sass/shared.rb +1 -1
  57. data/lib/sass/source/map.rb +26 -12
  58. data/lib/sass/stack.rb +0 -6
  59. data/lib/sass/supports.rb +2 -3
  60. data/lib/sass/tree/at_root_node.rb +1 -0
  61. data/lib/sass/tree/charset_node.rb +1 -1
  62. data/lib/sass/tree/directive_node.rb +8 -2
  63. data/lib/sass/tree/error_node.rb +18 -0
  64. data/lib/sass/tree/extend_node.rb +1 -1
  65. data/lib/sass/tree/function_node.rb +4 -0
  66. data/lib/sass/tree/keyframe_rule_node.rb +15 -0
  67. data/lib/sass/tree/prop_node.rb +1 -1
  68. data/lib/sass/tree/rule_node.rb +12 -7
  69. data/lib/sass/tree/visitors/check_nesting.rb +38 -10
  70. data/lib/sass/tree/visitors/convert.rb +16 -18
  71. data/lib/sass/tree/visitors/cssize.rb +29 -29
  72. data/lib/sass/tree/visitors/deep_copy.rb +5 -0
  73. data/lib/sass/tree/visitors/perform.rb +45 -33
  74. data/lib/sass/tree/visitors/set_options.rb +14 -0
  75. data/lib/sass/tree/visitors/to_css.rb +15 -14
  76. data/lib/sass/util/subset_map.rb +1 -1
  77. data/lib/sass/util.rb +222 -99
  78. data/lib/sass/version.rb +5 -5
  79. data/lib/sass.rb +0 -5
  80. data/test/sass/cache_test.rb +62 -20
  81. data/test/sass/callbacks_test.rb +1 -1
  82. data/test/sass/compiler_test.rb +19 -10
  83. data/test/sass/conversion_test.rb +58 -1
  84. data/test/sass/css2sass_test.rb +23 -4
  85. data/test/sass/encoding_test.rb +219 -0
  86. data/test/sass/engine_test.rb +136 -199
  87. data/test/sass/exec_test.rb +2 -2
  88. data/test/sass/extend_test.rb +236 -19
  89. data/test/sass/functions_test.rb +295 -253
  90. data/test/sass/importer_test.rb +31 -21
  91. data/test/sass/logger_test.rb +1 -1
  92. data/test/sass/more_results/more_import.css +1 -1
  93. data/test/sass/plugin_test.rb +14 -13
  94. data/test/sass/results/compact.css +1 -1
  95. data/test/sass/results/complex.css +4 -4
  96. data/test/sass/results/expanded.css +1 -1
  97. data/test/sass/results/import.css +1 -1
  98. data/test/sass/results/import_charset_ibm866.css +2 -2
  99. data/test/sass/results/mixins.css +17 -17
  100. data/test/sass/results/nested.css +1 -1
  101. data/test/sass/results/parent_ref.css +2 -2
  102. data/test/sass/results/script.css +3 -3
  103. data/test/sass/results/scss_import.css +1 -1
  104. data/test/sass/script_conversion_test.rb +10 -7
  105. data/test/sass/script_test.rb +288 -74
  106. data/test/sass/scss/css_test.rb +141 -24
  107. data/test/sass/scss/rx_test.rb +4 -4
  108. data/test/sass/scss/scss_test.rb +457 -18
  109. data/test/sass/source_map_test.rb +115 -25
  110. data/test/sass/superselector_test.rb +191 -0
  111. data/test/sass/templates/scss_import.scss +2 -1
  112. data/test/sass/test_helper.rb +1 -1
  113. data/test/sass/util/multibyte_string_scanner_test.rb +1 -1
  114. data/test/sass/util/normalized_map_test.rb +1 -1
  115. data/test/sass/util/subset_map_test.rb +2 -2
  116. data/test/sass/util_test.rb +31 -1
  117. data/test/sass/value_helpers_test.rb +5 -7
  118. data/test/test_helper.rb +2 -2
  119. data/vendor/listen/CHANGELOG.md +1 -228
  120. data/vendor/listen/Gemfile +5 -15
  121. data/vendor/listen/README.md +111 -77
  122. data/vendor/listen/Rakefile +0 -42
  123. data/vendor/listen/lib/listen/adapter.rb +195 -82
  124. data/vendor/listen/lib/listen/adapters/bsd.rb +27 -64
  125. data/vendor/listen/lib/listen/adapters/darwin.rb +21 -58
  126. data/vendor/listen/lib/listen/adapters/linux.rb +23 -55
  127. data/vendor/listen/lib/listen/adapters/polling.rb +25 -34
  128. data/vendor/listen/lib/listen/adapters/windows.rb +50 -46
  129. data/vendor/listen/lib/listen/directory_record.rb +96 -61
  130. data/vendor/listen/lib/listen/listener.rb +135 -37
  131. data/vendor/listen/lib/listen/turnstile.rb +9 -5
  132. data/vendor/listen/lib/listen/version.rb +1 -1
  133. data/vendor/listen/lib/listen.rb +33 -19
  134. data/vendor/listen/listen.gemspec +6 -0
  135. data/vendor/listen/spec/listen/adapter_spec.rb +43 -77
  136. data/vendor/listen/spec/listen/adapters/polling_spec.rb +8 -8
  137. data/vendor/listen/spec/listen/directory_record_spec.rb +81 -56
  138. data/vendor/listen/spec/listen/listener_spec.rb +128 -39
  139. data/vendor/listen/spec/listen_spec.rb +15 -21
  140. data/vendor/listen/spec/spec_helper.rb +4 -0
  141. data/vendor/listen/spec/support/adapter_helper.rb +52 -15
  142. data/vendor/listen/spec/support/directory_record_helper.rb +7 -5
  143. data/vendor/listen/spec/support/listeners_helper.rb +30 -7
  144. metadata +25 -22
  145. data/ext/mkrf_conf.rb +0 -27
  146. data/lib/sass/importers/deprecated_path.rb +0 -51
  147. data/lib/sass/script/value/deprecated_false.rb +0 -55
  148. data/vendor/listen/lib/listen/dependency_manager.rb +0 -126
  149. data/vendor/listen/lib/listen/multi_listener.rb +0 -143
  150. data/vendor/listen/spec/listen/dependency_manager_spec.rb +0 -107
  151. data/vendor/listen/spec/listen/multi_listener_spec.rb +0 -174
@@ -17,6 +17,11 @@ module Sass::Script::Functions::UserFunctions
17
17
  return Sass::Script::Value::Null.new
18
18
  end
19
19
 
20
+ def set_a_global_variable(name, value)
21
+ environment.set_global_var(name.value, value)
22
+ return Sass::Script::Value::Null.new
23
+ end
24
+
20
25
  def get_a_variable(name)
21
26
  environment.var(name.value) || Sass::Script::Value::String.new("undefined")
22
27
  end
@@ -26,7 +31,7 @@ module Sass::Script::Functions
26
31
  include Sass::Script::Functions::UserFunctions
27
32
  end
28
33
 
29
- class SassEngineTest < Test::Unit::TestCase
34
+ class SassEngineTest < MiniTest::Test
30
35
  FAKE_FILE_NAME = __FILE__.gsub(/rb$/,"sass")
31
36
  # A map of erroneous Sass documents to the error messages they should produce.
32
37
  # The error messages may be arrays;
@@ -68,8 +73,8 @@ MSG
68
73
  "$a: 1b >= 2c" => "Incompatible units: 'c' and 'b'.",
69
74
  "a\n b: 1b * 2c" => "2b*c isn't a valid CSS value.",
70
75
  "a\n b: 1b % 2c" => "Incompatible units: 'c' and 'b'.",
71
- "$a: 2px + #ccc" => "Cannot add a number with units (2px) to a color (#cccccc).",
72
- "$a: #ccc + 2px" => "Cannot add a number with units (2px) to a color (#cccccc).",
76
+ "$a: 2px + #ccc" => "Cannot add a number with units (2px) to a color (#ccc).",
77
+ "$a: #ccc + 2px" => "Cannot add a number with units (2px) to a color (#ccc).",
73
78
  "& a\n :b c" => ["Base-level rules cannot contain the parent-selector-referencing character '&'.", 1],
74
79
  "a\n :b\n c" => "Illegal nesting: Only properties may be nested beneath properties.",
75
80
  "$a: b\n :c d\n" => "Illegal nesting: Nothing may be nested beneath variable declarations.",
@@ -141,6 +146,8 @@ MSG
141
146
  '@while' => "Invalid while directive '@while': expected expression.",
142
147
  '@debug' => "Invalid debug directive '@debug': expected expression.",
143
148
  %Q{@debug "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath debug directives.",
149
+ '@error' => "Invalid error directive '@error': expected expression.",
150
+ %Q{@error "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath error directives.",
144
151
  '@warn' => "Invalid warn directive '@warn': expected expression.",
145
152
  %Q{@warn "a message"\n "nested message"} => "Illegal nesting: Nothing may be nested beneath warn directives.",
146
153
  "/* foo\n bar\n baz" => "Inconsistent indentation: previous line was indented by 4 spaces, but this line was indented by 2 spaces.",
@@ -526,9 +533,9 @@ ERR
526
533
  opts = {:full_exception => true, :line => 362}
527
534
  render(("a\n b: c\n" * 10) + "d\n e:\n" + ("f\n g: h\n" * 10), opts)
528
535
  rescue Sass::SyntaxError => e
529
- assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts).split("\n")[0..15].join("\n"))
536
+ assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts[:line]).split("\n")[0..15].join("\n"))
530
537
  /*
531
- Syntax error: Invalid property: "e:" (no value).
538
+ Error: Invalid property: "e:" (no value).
532
539
  on line 383 of test_exception_css_with_offset_inline.sass
533
540
 
534
541
  378: a
@@ -548,8 +555,7 @@ CSS
548
555
  end
549
556
 
550
557
  def test_exception_css_with_mixins
551
- opts = {:full_exception => true}
552
- render(<<SASS, opts)
558
+ render(<<SASS, :full_exception => true)
553
559
  =error-mixin($a)
554
560
  color: $a * 1em * 1px
555
561
 
@@ -560,9 +566,9 @@ CSS
560
566
  +outer-mixin(12)
561
567
  SASS
562
568
  rescue Sass::SyntaxError => e
563
- assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts).split("\n")[0..13].join("\n"))
569
+ assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e).split("\n")[0..13].join("\n"))
564
570
  /*
565
- Syntax error: 12em*px isn't a valid CSS value.
571
+ Error: 12em*px isn't a valid CSS value.
566
572
  on line 2 of test_exception_css_with_mixins_inline.sass, in `error-mixin'
567
573
  from line 5 of test_exception_css_with_mixins_inline.sass, in `outer-mixin'
568
574
  from line 8 of test_exception_css_with_mixins_inline.sass
@@ -580,8 +586,7 @@ CSS
580
586
  end
581
587
 
582
588
  def test_cssize_exception_css
583
- opts = {:full_exception => true}
584
- render(<<SASS, opts)
589
+ render(<<SASS, :full_exception => true)
585
590
  .filler
586
591
  stuff: "stuff!"
587
592
 
@@ -591,9 +596,9 @@ a: b
591
596
  a: b
592
597
  SASS
593
598
  rescue Sass::SyntaxError => e
594
- assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e, opts).split("\n")[0..11].join("\n"))
599
+ assert_equal(<<CSS, Sass::SyntaxError.exception_to_css(e).split("\n")[0..11].join("\n"))
595
600
  /*
596
- Syntax error: Properties are only allowed within rules, directives, mixin includes, or other properties.
601
+ Error: Properties are only allowed within rules, directives, mixin includes, or other properties.
597
602
  on line 4 of test_cssize_exception_css_inline.sass
598
603
 
599
604
  1: .filler
@@ -613,12 +618,12 @@ CSS
613
618
  end
614
619
 
615
620
  def test_http_import
616
- assert_equal("@import url(http://fonts.googleapis.com/css?family=Droid+Sans);\n",
621
+ assert_equal("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\";\n",
617
622
  render("@import \"http://fonts.googleapis.com/css?family=Droid+Sans\""))
618
623
  end
619
624
 
620
625
  def test_protocol_relative_import
621
- assert_equal("@import url(//fonts.googleapis.com/css?family=Droid+Sans);\n",
626
+ assert_equal("@import \"//fonts.googleapis.com/css?family=Droid+Sans\";\n",
622
627
  render("@import \"//fonts.googleapis.com/css?family=Droid+Sans\""))
623
628
  end
624
629
 
@@ -648,18 +653,18 @@ SASS
648
653
 
649
654
  def test_sass_import
650
655
  sassc_file = sassc_path("importee")
651
- assert !File.exists?(sassc_file)
656
+ assert !File.exist?(sassc_file)
652
657
  renders_correctly "import", { :style => :compact, :load_paths => [File.dirname(__FILE__) + "/templates"] }
653
- assert File.exists?(sassc_file)
658
+ assert File.exist?(sassc_file)
654
659
  end
655
660
 
656
661
  def test_sass_pathname_import
657
662
  sassc_file = sassc_path("importee")
658
- assert !File.exists?(sassc_file)
663
+ assert !File.exist?(sassc_file)
659
664
  renders_correctly("import",
660
665
  :style => :compact,
661
666
  :load_paths => [Pathname.new(File.dirname(__FILE__) + "/templates")])
662
- assert File.exists?(sassc_file)
667
+ assert File.exist?(sassc_file)
663
668
  end
664
669
 
665
670
  def test_import_from_global_load_paths
@@ -691,23 +696,23 @@ ERR
691
696
  end
692
697
 
693
698
  def test_no_cache
694
- assert !File.exists?(sassc_path("importee"))
699
+ assert !File.exist?(sassc_path("importee"))
695
700
  renders_correctly("import", {
696
701
  :style => :compact, :cache => false,
697
702
  :load_paths => [File.dirname(__FILE__) + "/templates"],
698
703
  })
699
- assert !File.exists?(sassc_path("importee"))
704
+ assert !File.exist?(sassc_path("importee"))
700
705
  end
701
706
 
702
707
  def test_import_in_rule
703
708
  assert_equal(<<CSS, render(<<SASS, :load_paths => [File.dirname(__FILE__) + '/templates/']))
704
709
  .foo #foo {
705
- background-color: #bbaaff; }
710
+ background-color: #baf; }
706
711
 
707
712
  .bar {
708
713
  a: b; }
709
714
  .bar #foo {
710
- background-color: #bbaaff; }
715
+ background-color: #baf; }
711
716
  CSS
712
717
  .foo
713
718
  @import partial
@@ -1026,7 +1031,6 @@ SASS
1026
1031
  @-webkit-keyframes warm {
1027
1032
  from {
1028
1033
  color: black; }
1029
-
1030
1034
  to {
1031
1035
  color: red; } }
1032
1036
  CSS
@@ -1130,7 +1134,13 @@ SASS
1130
1134
  end
1131
1135
 
1132
1136
  def test_default_values_for_mixin_arguments
1133
- assert_equal("white {\n color: white; }\n\nblack {\n color: black; }\n", render(<<SASS))
1137
+ assert_equal(<<CSS, render(<<SASS))
1138
+ white {
1139
+ color: #FFF; }
1140
+
1141
+ black {
1142
+ color: #000; }
1143
+ CSS
1134
1144
  =foo($a: #FFF)
1135
1145
  :color $a
1136
1146
  white
@@ -1140,17 +1150,17 @@ black
1140
1150
  SASS
1141
1151
  assert_equal(<<CSS, render(<<SASS))
1142
1152
  one {
1143
- color: white;
1153
+ color: #fff;
1144
1154
  padding: 1px;
1145
1155
  margin: 4px; }
1146
1156
 
1147
1157
  two {
1148
- color: white;
1158
+ color: #fff;
1149
1159
  padding: 2px;
1150
1160
  margin: 5px; }
1151
1161
 
1152
1162
  three {
1153
- color: white;
1163
+ color: #fff;
1154
1164
  padding: 2px;
1155
1165
  margin: 3px; }
1156
1166
  CSS
@@ -1168,17 +1178,17 @@ three
1168
1178
  SASS
1169
1179
  assert_equal(<<CSS, render(<<SASS))
1170
1180
  one {
1171
- color: white;
1181
+ color: #fff;
1172
1182
  padding: 1px;
1173
1183
  margin: 4px; }
1174
1184
 
1175
1185
  two {
1176
- color: white;
1186
+ color: #fff;
1177
1187
  padding: 2px;
1178
1188
  margin: 5px; }
1179
1189
 
1180
1190
  three {
1181
- color: white;
1191
+ color: #fff;
1182
1192
  padding: 2px;
1183
1193
  margin: 3px; }
1184
1194
  CSS
@@ -1383,7 +1393,7 @@ CSS
1383
1393
  $variable: 0
1384
1394
  bar
1385
1395
  $local: 10
1386
- -no-op: set-a-variable(variable, 5)
1396
+ -no-op: set-a-global-variable(variable, 5)
1387
1397
  a: $variable
1388
1398
  SASS
1389
1399
  end
@@ -1617,31 +1627,6 @@ a
1617
1627
  SASS
1618
1628
  end
1619
1629
 
1620
- def test_variable_scope
1621
- silence_warnings {assert_equal(<<CSS, render(<<SASS))}
1622
- a {
1623
- b-1: c;
1624
- b-2: c;
1625
- d: 12; }
1626
-
1627
- b {
1628
- d: 17; }
1629
- CSS
1630
- $i: 12
1631
- a
1632
- @for $i from 1 through 2
1633
- b-\#{$i}: c
1634
- d: $i
1635
-
1636
- =foo
1637
- $i: 17
1638
-
1639
- b
1640
- +foo
1641
- d: $i
1642
- SASS
1643
- end
1644
-
1645
1630
  def test_hyphen_underscore_insensitive_variables
1646
1631
  assert_equal(<<CSS, render(<<SASS))
1647
1632
  d {
@@ -1684,7 +1669,7 @@ SASS
1684
1669
  end
1685
1670
 
1686
1671
  def test_argument_error
1687
- assert_raise(Sass::SyntaxError) { render("a\n b: hsl(1)") }
1672
+ assert_raises(Sass::SyntaxError) { render("a\n b: hsl(1)") }
1688
1673
  end
1689
1674
 
1690
1675
  def test_comments_at_the_top_of_a_document
@@ -2029,10 +2014,10 @@ $var: "bar"
2029
2014
  SASS
2030
2015
  end
2031
2016
 
2032
- def test_interpolation_doesnt_deep_unquote_strings
2017
+ def test_interpolation_deep_unquotes_strings
2033
2018
  assert_equal(<<CSS, render(<<SASS))
2034
2019
  .foo {
2035
- a: "bar" "baz"; }
2020
+ a: bar baz; }
2036
2021
  CSS
2037
2022
  .foo
2038
2023
  a: \#{"bar" "baz"}
@@ -2898,145 +2883,6 @@ CSS
2898
2883
  SASS
2899
2884
  end
2900
2885
 
2901
- # Encodings
2902
-
2903
- unless Sass::Util.ruby1_8?
2904
- def test_encoding_error
2905
- render("foo\nbar\nb\xFEaz".force_encoding("utf-8"))
2906
- assert(false, "Expected exception")
2907
- rescue Sass::SyntaxError => e
2908
- assert_equal(3, e.sass_line)
2909
- assert_equal('Invalid UTF-8 character "\xFE"', e.message)
2910
- end
2911
-
2912
- def test_ascii_incompatible_encoding_error
2913
- template = "foo\nbar\nb_z".encode("utf-16le")
2914
- template[9] = "\xFE".force_encoding("utf-16le")
2915
- render(template)
2916
- assert(false, "Expected exception")
2917
- rescue Sass::SyntaxError => e
2918
- assert_equal(3, e.sass_line)
2919
- assert_equal('Invalid UTF-16LE character "\xFE"', e.message)
2920
- end
2921
-
2922
- def test_same_charset_as_encoding
2923
- assert_renders_encoded(<<CSS, <<SASS)
2924
- @charset "UTF-8";
2925
- fóó {
2926
- a: b; }
2927
- CSS
2928
- @charset "utf-8"
2929
- fóó
2930
- a: b
2931
- SASS
2932
- end
2933
-
2934
- def test_different_charset_than_encoding
2935
- assert_renders_encoded(<<CSS.force_encoding("IBM866"), <<SASS)
2936
- @charset "IBM866";
2937
- fóó {
2938
- a: b; }
2939
- CSS
2940
- @charset "ibm866"
2941
- fóó
2942
- a: b
2943
- SASS
2944
- end
2945
-
2946
- def test_different_encoding_than_system
2947
- assert_renders_encoded(<<CSS.encode("IBM866"), <<SASS.encode("IBM866"))
2948
- @charset "IBM866";
2949
- тАЬ {
2950
- a: b; }
2951
- CSS
2952
- тАЬ
2953
- a: b
2954
- SASS
2955
- end
2956
-
2957
- def test_multibyte_charset
2958
- assert_renders_encoded(<<CSS.encode("UTF-16LE"), <<SASS.encode("UTF-16LE").force_encoding("UTF-8"))
2959
- @charset "UTF-16LE";
2960
- fóó {
2961
- a: b; }
2962
- CSS
2963
- @charset "utf-16le"
2964
- fóó
2965
- a: b
2966
- SASS
2967
- end
2968
-
2969
- def test_multibyte_charset_without_endian_specifier
2970
- assert_renders_encoded(<<CSS.encode("UTF-32BE"), <<SASS.encode("UTF-32BE").force_encoding("UTF-8"))
2971
- @charset "UTF-32BE";
2972
- fóó {
2973
- a: b; }
2974
- CSS
2975
- @charset "utf-32"
2976
- fóó
2977
- a: b
2978
- SASS
2979
- end
2980
-
2981
- def test_utf8_bom
2982
- assert_renders_encoded(<<CSS, <<SASS.force_encoding("BINARY"))
2983
- @charset "UTF-8";
2984
- fóó {
2985
- a: b; }
2986
- CSS
2987
- \uFEFFfóó
2988
- a: b
2989
- SASS
2990
- end
2991
-
2992
- def test_utf16le_bom
2993
- assert_renders_encoded(<<CSS.encode("UTF-16LE"), <<SASS.encode("UTF-16LE").force_encoding("BINARY"))
2994
- @charset "UTF-16LE";
2995
- fóó {
2996
- a: b; }
2997
- CSS
2998
- \uFEFFfóó
2999
- a: b
3000
- SASS
3001
- end
3002
-
3003
- def test_utf32be_bom
3004
- assert_renders_encoded(<<CSS.encode("UTF-32BE"), <<SASS.encode("UTF-32BE").force_encoding("BINARY"))
3005
- @charset "UTF-32BE";
3006
- fóó {
3007
- a: b; }
3008
- CSS
3009
- \uFEFFfóó
3010
- a: b
3011
- SASS
3012
- end
3013
-
3014
- # Encoding Regression Test
3015
-
3016
- def test_multibyte_prop_name
3017
- assert_equal(<<CSS, render(<<SASS))
3018
- @charset "UTF-8";
3019
- #bar {
3020
- cölor: blue; }
3021
- CSS
3022
- #bar
3023
- cölor: blue
3024
- SASS
3025
- end
3026
-
3027
- def test_multibyte_and_interpolation
3028
- assert_equal(<<CSS, render(<<SCSS, :syntax => :scss))
3029
- #bar {
3030
- background: a 0%; }
3031
- CSS
3032
- #bar {
3033
- // 
3034
- background: \#{a} 0%;
3035
- }
3036
- SCSS
3037
- end
3038
- end
3039
-
3040
2886
  def test_original_filename_set
3041
2887
  importer = MockImporter.new
3042
2888
  importer.add_import("imported", "div{color:red}")
@@ -3287,6 +3133,13 @@ test_debug_inspects_sass_objects_inline.scss:1 DEBUG: (a: 1, b: 2)
3287
3133
  END
3288
3134
  end
3289
3135
 
3136
+ def test_error_throws_sass_objects
3137
+ assert_raise_message(Sass::SyntaxError, "(a: 1, b: 2)") {render("@error (a: 1, b: 2)")}
3138
+ assert_raise_message(Sass::SyntaxError, "(a: 1, b: 2)") do
3139
+ render("$map: (a: 1, b: 2); @error $map", :syntax => :scss)
3140
+ end
3141
+ end
3142
+
3290
3143
  def test_default_arg_before_splat
3291
3144
  assert_equal <<CSS, render(<<SASS, :syntax => :scss)
3292
3145
  .foo-positional {
@@ -3315,6 +3168,90 @@ CSS
3315
3168
  SASS
3316
3169
  end
3317
3170
 
3171
+ def test_keyframes
3172
+ assert_equal <<CSS, render(<<SASS)
3173
+ @keyframes identifier {
3174
+ 0% {
3175
+ top: 0;
3176
+ left: 0; }
3177
+ 30% {
3178
+ top: 50px; }
3179
+ 68%, 72% {
3180
+ left: 50px; }
3181
+ 100% {
3182
+ top: 100px;
3183
+ left: 100%; } }
3184
+ CSS
3185
+ @keyframes identifier
3186
+ 0%
3187
+ top: 0
3188
+ left: 0
3189
+ \#{"30%"}
3190
+ top: 50px
3191
+ 68%, 72%
3192
+ left: 50px
3193
+ 100%
3194
+ top: 100px
3195
+ left: 100%
3196
+ SASS
3197
+ end
3198
+
3199
+ def test_prefixed_keyframes
3200
+ assert_equal <<CSS, render(<<SASS)
3201
+ @-moz-keyframes identifier {
3202
+ 0% {
3203
+ top: 0;
3204
+ left: 0; }
3205
+ 30% {
3206
+ top: 50px; }
3207
+ 68%, 72% {
3208
+ left: 50px; }
3209
+ 100% {
3210
+ top: 100px;
3211
+ left: 100%; } }
3212
+ CSS
3213
+ @-moz-keyframes identifier
3214
+ 0%
3215
+ top: 0
3216
+ left: 0
3217
+ \#{"30%"}
3218
+ top: 50px
3219
+ 68%, 72%
3220
+ left: 50px
3221
+ 100%
3222
+ top: 100px
3223
+ left: 100%
3224
+ SASS
3225
+ end
3226
+
3227
+ def test_uppercase_keyframes
3228
+ assert_equal <<CSS, render(<<SASS)
3229
+ @KEYFRAMES identifier {
3230
+ 0% {
3231
+ top: 0;
3232
+ left: 0; }
3233
+ 30% {
3234
+ top: 50px; }
3235
+ 68%, 72% {
3236
+ left: 50px; }
3237
+ 100% {
3238
+ top: 100px;
3239
+ left: 100%; } }
3240
+ CSS
3241
+ @KEYFRAMES identifier
3242
+ 0%
3243
+ top: 0
3244
+ left: 0
3245
+ \#{"30%"}
3246
+ top: 50px
3247
+ 68%, 72%
3248
+ left: 50px
3249
+ 100%
3250
+ top: 100px
3251
+ left: 100%
3252
+ SASS
3253
+ end
3254
+
3318
3255
  private
3319
3256
 
3320
3257
  def assert_hash_has(hash, expected)
@@ -3,7 +3,7 @@ require File.dirname(__FILE__) + '/../test_helper'
3
3
  require 'sass/util/test'
4
4
  require 'tmpdir'
5
5
 
6
- class ExecTest < Test::Unit::TestCase
6
+ class ExecTest < MiniTest::Test
7
7
  include Sass::Util::Test
8
8
 
9
9
  def setup
@@ -19,7 +19,7 @@ class ExecTest < Test::Unit::TestCase
19
19
  src = get_path("src.scss")
20
20
  dest = get_path("dest.css")
21
21
  write(src, ".ruleset { margin: 0 }")
22
- assert(exec(*%w[scss -t expanded --unix-newlines].push(src, dest)))
22
+ assert(exec(*%w[scss --sourcemap=none -t expanded --unix-newlines].push(src, dest)))
23
23
  assert_equal(".ruleset {\n margin: 0;\n}\n", read(dest))
24
24
  end
25
25