sass 3.3.0.alpha.50 → 3.3.0.alpha.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/REVISION CHANGED
@@ -1 +1 @@
1
- c962fa1b7d90fdb2e9df72ae2527a48f1f770276
1
+ 6b1a36d5126d1d8e2b9550a69e3aab09db566fed
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.3.0.alpha.50
1
+ 3.3.0.alpha.59
@@ -1 +1 @@
1
- 29 November 2012 19:00:24 GMT
1
+ 22 December 2012 00:18:55 GMT
@@ -268,7 +268,9 @@ module Sass
268
268
 
269
269
  # Render the template to CSS and return the source map.
270
270
  #
271
- # @param sourcemap_uri [String] The sourcemap URI to use in the @sourceMappingURL comment
271
+ # @param sourcemap_uri [String] The sourcemap URI to use in the
272
+ # @sourceMappingURL comment. This should be relative to the location of
273
+ # the CSS file.
272
274
  # @return [(String, Sass::Source::Map)] The rendered CSS and the associated source map
273
275
  # @raise [Sass::SyntaxError] if there's an error in the document
274
276
  # @raise [Encoding::UndefinedConversionError] if the source encoding
@@ -91,8 +91,14 @@ module Sass
91
91
  sorted_exts = extensions.sort
92
92
  syntax = extensions[extname]
93
93
 
94
- return [["#{dirname}/{_,}#{basename}.#{extensions.invert[syntax]}", syntax]] if syntax
95
- sorted_exts.map {|ext, syn| ["#{dirname}/{_,}#{basename}.#{ext}", syn]}
94
+ if syntax
95
+ ret = [["#{dirname}/{_,}#{basename}.#{extensions.invert[syntax]}", syntax]]
96
+ else
97
+ ret = sorted_exts.map {|ext, syn| ["#{dirname}/{_,}#{basename}.#{ext}", syn]}
98
+ end
99
+
100
+ # JRuby chokes when trying to import files from JARs when the path starts with './'.
101
+ ret.map {|f, s| [f.sub(%r{^\./}, ''), s]}
96
102
  end
97
103
 
98
104
  def escape_glob_characters(name)
@@ -118,7 +124,7 @@ module Sass
118
124
  end
119
125
  found = Sass::Util.flatten(found, 1)
120
126
  return if found.empty?
121
-
127
+
122
128
  if found.size > 1 && !@same_name_warnings.include?(found.first.first)
123
129
  found.each {|(f, _)| @same_name_warnings << f}
124
130
  relative_to = Pathname.new(dir)
@@ -141,7 +147,6 @@ MESSAGE
141
147
  WARNING: In #{File.dirname(name)}:
142
148
  There are multiple files that match the name "#{File.basename(name)}":
143
149
  #{candidates}
144
- This will be an error in future versions of Sass.
145
150
  WARNING
146
151
  end
147
152
  end
@@ -69,31 +69,6 @@ module Sass::Plugin
69
69
  # The location of the sourcemap being generated, if any.
70
70
  define_callback :updated_stylesheet
71
71
 
72
- # Register a callback to be run before a single stylesheet is updated.
73
- # The callback is only run if the stylesheet is guaranteed to be updated;
74
- # if the CSS file is fresh, this won't be run.
75
- #
76
- # Even if the \{file:SASS_REFERENCE.md#full_exception-option `:full_exception` option}
77
- # is enabled, this callback won't be run
78
- # when an exception CSS file is being written.
79
- # To run an action for those files, use \{#on\_compilation\_error}.
80
- #
81
- # @yield [template, css]
82
- # @yieldparam template [String]
83
- # The location of the Sass/SCSS file being updated.
84
- # @yieldparam css [String]
85
- # The location of the CSS file being generated.
86
- # @yieldparam sourcemap [String]
87
- # The location of the sourcemap file being generated, if any.
88
- define_callback :updating_stylesheet
89
-
90
- def on_updating_stylesheet_with_deprecation_warning(&block)
91
- Sass::Util.sass_warn("Sass::Compiler#on_updating_stylesheet callback is deprecated and will be removed in a future release. Use Sass::Compiler#on_updated_stylesheet instead, which is run after stylesheet compilation.")
92
- on_updating_stylesheet_without_deprecation_warning(&block)
93
- end
94
- alias_method :on_updating_stylesheet_without_deprecation_warning, :on_updating_stylesheet
95
- alias_method :on_updating_stylesheet, :on_updating_stylesheet_with_deprecation_warning
96
-
97
72
  # Register a callback to be run when Sass decides not to update a stylesheet.
98
73
  # In particular, the callback is run when Sass finds that
99
74
  # the template file and none of its dependencies
@@ -201,8 +176,6 @@ module Sass::Plugin
201
176
  end
202
177
  end
203
178
 
204
- run_updating_stylesheets individual_files
205
-
206
179
  individual_files.each do |file, css, sourcemap|
207
180
  # TODO: Does staleness_checker need to check the sourcemap file as well?
208
181
  if options[:always_update] || staleness_checker.stylesheet_needs_update?(css, file)
@@ -355,8 +328,6 @@ module Sass::Plugin
355
328
  compilation_error_occured = true
356
329
  run_compilation_error e, filename, css, sourcemap
357
330
  rendered = Sass::SyntaxError.exception_to_css(e, options)
358
- else
359
- run_updating_stylesheet filename, css, sourcemap
360
331
  end
361
332
 
362
333
  write_file(css, rendered)
@@ -33,17 +33,6 @@ module Sass
33
33
  @options ||= default_options.dup
34
34
  end
35
35
 
36
- # Sets the options hash.
37
- # See {file:SASS_REFERENCE.md#sass_options the Sass options documentation}.
38
- # See {Sass::Plugin::Configuration#reset!}
39
- # @deprecated Instead, modify the options hash in-place.
40
- # @param value [{Symbol => Object}] The options hash
41
- def options=(value)
42
- Sass::Util.sass_warn("Setting Sass::Plugin.options is deprecated " +
43
- "and will be removed in a future release.")
44
- options.merge!(value)
45
- end
46
-
47
36
  # Adds a new template-location/css-location mapping.
48
37
  # This means that Sass/SCSS files in `template_location`
49
38
  # will be compiled to CSS files in `css_location`.
@@ -53,17 +53,6 @@ module Sass::Script
53
53
  @precision_factor ||= 10.0**precision
54
54
  end
55
55
 
56
- # Handles the deprecation warning for the PRECISION constant
57
- # This can be removed in 3.2.
58
- def self.const_missing(const)
59
- if const == :PRECISION
60
- Sass::Util.sass_warn("Sass::Script::Number::PRECISION is deprecated and will be removed in a future release. Use Sass::Script::Number.precision_factor instead.")
61
- const_set(:PRECISION, self.precision_factor)
62
- else
63
- super
64
- end
65
- end
66
-
67
56
  # Used so we don't allocate two new arrays for each new number.
68
57
  NO_UNITS = []
69
58
 
@@ -318,7 +318,9 @@ module Sass
318
318
 
319
319
  loop do
320
320
  values << expr!(:import_arg)
321
- break if use_css_import? || !tok(/,\s*/)
321
+ break if use_css_import?
322
+ break unless tok(/,/)
323
+ ss
322
324
  end
323
325
 
324
326
  return values
@@ -128,12 +128,7 @@ module Sass
128
128
  # We could use it for 1.9 only, but I don't want to introduce a cross-version
129
129
  # behavior difference.
130
130
  # In any case, almost all CSS idents will be matched by this.
131
- #
132
- # We explicitly avoid parsing newlines or values/selectors longer than
133
- # about 50 characters. This mitigates the problem of exponential parsing
134
- # time when a value has a long string of valid, parsable content followed
135
- # by something invalid.
136
- STATIC_VALUE = /(-?#{NMSTART}|#{STRING_NOINTERP}|[ \t](?!%)|#[a-f0-9]|[,%]|#{NUM}|\!important){1,50}([;}])/i
131
+ STATIC_VALUE = /(-?#{NMSTART}|#{STRING_NOINTERP}|#[a-f0-9]|[,%]|-?#{NUMBER}|\!important)+([;}])/i
137
132
  STATIC_SELECTOR = /(#{NMCHAR}|[ \t]|[,>+*]|[:#.]#{NMSTART}){0,50}([{])/i
138
133
  end
139
134
  end
@@ -105,7 +105,7 @@ module Sass
105
105
  group.each {|e, _| e.result = :failed_to_unify}
106
106
  next unless unified = seq.members.last.unify(self_without_sel, subject?)
107
107
  group.each {|e, _| e.result = :succeeded}
108
- next if group.map {|e, _| check_directives_match!(e, parent_directives)}.none?
108
+ group.each {|e, _| check_directives_match!(e, parent_directives)}
109
109
  new_seq = Sequence.new(seq.members[0...-1] + [unified])
110
110
  new_seq.add_sources!(sources + [seq])
111
111
  [sels, new_seq]
@@ -180,16 +180,15 @@ module Sass
180
180
  def check_directives_match!(extend, parent_directives)
181
181
  dirs1 = extend.directives.map {|d| d.resolved_value}
182
182
  dirs2 = parent_directives.map {|d| d.resolved_value}
183
- return true if Sass::Util.subsequence?(dirs1, dirs2)
184
-
185
- Sass::Util.sass_warn <<WARNING
186
- DEPRECATION WARNING on line #{extend.node.line}#{" of #{extend.node.filename}" if extend.node.filename}:
187
- @extending an outer selector from within #{extend.directives.last.name} is deprecated.
188
- You may only @extend selectors within the same directive.
189
- This will be an error in Sass 3.3.
190
- It can only work once @extend is supported natively in the browser.
191
- WARNING
192
- return false
183
+ return if Sass::Util.subsequence?(dirs1, dirs2)
184
+
185
+ # TODO(nweiz): this should use the Sass stack trace of the extend node,
186
+ # not the selector.
187
+ raise Sass::SyntaxError.new(<<MESSAGE)
188
+ You may not @extend an outer selector from within #{extend.directives.last.name}.
189
+ You may only @extend selectors within the same directive.
190
+ From "@extend #{extend.target.join(', ')}" on line #{extend.node.line}#{" of #{extend.node.filename}" if extend.node.filename}.
191
+ MESSAGE
193
192
  end
194
193
 
195
194
  def _hash
@@ -20,7 +20,6 @@ module Sass::Source
20
20
  # @param end_pos [Sass::Source::Position] See \{#end_pos}
21
21
  # @param file [String] See \{#file}
22
22
  def initialize(start_pos, end_pos, file)
23
- raise 'hell' if end_pos.is_a?(Fixnum)
24
23
  @start_pos = start_pos
25
24
  @end_pos = end_pos
26
25
  @file = file
@@ -49,7 +49,7 @@ class Sass::Tree::Visitors::Extend < Sass::Tree::Visitors::Base
49
49
  def self.check_extends_fired!(extends)
50
50
  extends.each_value do |ex|
51
51
  next if ex.result == :succeeded || ex.node.optional?
52
- warn = "\"#{ex.extender}\" failed to @extend \"#{ex.target.join}\"."
52
+ message = "\"#{ex.extender}\" failed to @extend \"#{ex.target.join}\"."
53
53
  reason =
54
54
  if ex.result == :not_found
55
55
  "The selector \"#{ex.target.join}\" was not found."
@@ -57,12 +57,12 @@ class Sass::Tree::Visitors::Extend < Sass::Tree::Visitors::Base
57
57
  "No selectors matching \"#{ex.target.join}\" could be unified with \"#{ex.extender}\"."
58
58
  end
59
59
 
60
- Sass::Util.sass_warn <<WARN
61
- WARNING on line #{ex.node.line}#{" of #{ex.node.filename}" if ex.node.filename}: #{warn}
62
- #{reason}
63
- This will be an error in future releases of Sass.
64
- Use "@extend #{ex.target.join} !optional" if the extend should be able to fail.
65
- WARN
60
+ # TODO(nweiz): this should use the Sass stack trace of the extend node.
61
+ raise Sass::SyntaxError.new(<<MESSAGE, :filename => ex.node.filename, :line => ex.node.line)
62
+ #{message}
63
+ #{reason}
64
+ Use "@extend #{ex.target.join} !optional" if the extend should be able to fail.
65
+ MESSAGE
66
66
  end
67
67
  end
68
68
  end
@@ -2903,12 +2903,6 @@ SCSS
2903
2903
  assert_equal original_filename, importer.engine("imported").options[:original_filename]
2904
2904
  end
2905
2905
 
2906
- def test_deprecated_PRECISION
2907
- assert_warning(<<END) {assert_equal 100_000.0, Sass::Script::Number::PRECISION}
2908
- Sass::Script::Number::PRECISION is deprecated and will be removed in a future release. Use Sass::Script::Number.precision_factor instead.
2909
- END
2910
- end
2911
-
2912
2906
  def test_changing_precision
2913
2907
  old_precision = Sass::Script::Number.precision
2914
2908
  begin
@@ -154,7 +154,7 @@ SCSS
154
154
  assert_unification '.foo#baz', '#baz {@extend .foo}', '#baz'
155
155
 
156
156
  assert_extend_doesnt_match('#bar', '.foo', :failed_to_unify, 2) do
157
- assert_unification '.foo#baz', '#bar {@extend .foo}', '.foo#baz'
157
+ render_unification '.foo#baz', '#bar {@extend .foo}'
158
158
  end
159
159
  end
160
160
 
@@ -180,7 +180,7 @@ SCSS
180
180
  assert_unification 'ns|*.foo', '*|* {@extend .foo}', 'ns|*'
181
181
 
182
182
  assert_extend_doesnt_match('ns2|*', '.foo', :failed_to_unify, 2) do
183
- assert_unification 'ns1|*.foo', 'ns2|* {@extend .foo}', 'ns1|*.foo'
183
+ render_unification 'ns1|*.foo', 'ns2|* {@extend .foo}'
184
184
  end
185
185
 
186
186
  assert_unification 'ns|*.foo', 'ns|* {@extend .foo}', 'ns|*'
@@ -200,7 +200,7 @@ SCSS
200
200
  assert_unification 'ns|a.foo', '*|* {@extend .foo}', 'ns|a'
201
201
 
202
202
  assert_extend_doesnt_match('ns2|*', '.foo', :failed_to_unify, 2) do
203
- assert_unification 'ns1|a.foo', 'ns2|* {@extend .foo}', 'ns1|a.foo'
203
+ render_unification 'ns1|a.foo', 'ns2|* {@extend .foo}'
204
204
  end
205
205
 
206
206
  assert_unification 'ns|a.foo', 'ns|* {@extend .foo}', 'ns|a'
@@ -227,7 +227,7 @@ SCSS
227
227
  assert_unification 'ns|*.foo', '*|a {@extend .foo}', 'ns|*.foo, ns|a'
228
228
 
229
229
  assert_extend_doesnt_match('ns2|a', '.foo', :failed_to_unify, 2) do
230
- assert_unification 'ns1|*.foo', 'ns2|a {@extend .foo}', 'ns1|*.foo'
230
+ render_unification 'ns1|*.foo', 'ns2|a {@extend .foo}'
231
231
  end
232
232
 
233
233
  assert_unification 'ns|*.foo', 'ns|a {@extend .foo}', 'ns|*.foo, ns|a'
@@ -242,7 +242,7 @@ SCSS
242
242
  assert_unification '*|a.foo', 'ns|a {@extend .foo}', '*|a.foo, ns|a'
243
243
 
244
244
  assert_extend_doesnt_match('h1', '.foo', :failed_to_unify, 2) do
245
- assert_unification 'a.foo', 'h1 {@extend .foo}', 'a.foo'
245
+ render_unification 'a.foo', 'h1 {@extend .foo}'
246
246
  end
247
247
  end
248
248
 
@@ -251,7 +251,7 @@ SCSS
251
251
  assert_unification 'ns|a.foo', '*|a {@extend .foo}', 'ns|a'
252
252
 
253
253
  assert_extend_doesnt_match('ns2|a', '.foo', :failed_to_unify, 2) do
254
- assert_unification 'ns1|a.foo', 'ns2|a {@extend .foo}', 'ns1|a.foo'
254
+ render_unification 'ns1|a.foo', 'ns2|a {@extend .foo}'
255
255
  end
256
256
 
257
257
  assert_unification 'ns|a.foo', 'ns|a {@extend .foo}', 'ns|a'
@@ -270,11 +270,11 @@ SCSS
270
270
  assert_unification ':foo.baz', '::foo {@extend .baz}', ':foo.baz, :foo::foo'
271
271
 
272
272
  assert_extend_doesnt_match('::bar', '.baz', :failed_to_unify, 2) do
273
- assert_unification '::foo.baz', '::bar {@extend .baz}', '::foo.baz'
273
+ render_unification '::foo.baz', '::bar {@extend .baz}'
274
274
  end
275
275
 
276
276
  assert_extend_doesnt_match('::foo(2n+1)', '.baz', :failed_to_unify, 2) do
277
- assert_unification '::foo.baz', '::foo(2n+1) {@extend .baz}', '::foo.baz'
277
+ render_unification '::foo.baz', '::foo(2n+1) {@extend .baz}'
278
278
  end
279
279
 
280
280
  assert_unification '::foo.baz', '::foo {@extend .baz}', '::foo'
@@ -348,7 +348,7 @@ SCSS
348
348
 
349
349
  def test_long_extendee_requires_all_selectors
350
350
  assert_extend_doesnt_match('.baz', '.foo.bar', :not_found, 2) do
351
- assert_extends '.foo', '.baz {@extend .foo.bar}', '.foo'
351
+ render_extends '.foo', '.baz {@extend .foo.bar}'
352
352
  end
353
353
  end
354
354
 
@@ -372,11 +372,11 @@ SCSS
372
372
 
373
373
  def test_long_extender_aborts_unification
374
374
  assert_extend_doesnt_match('h1.baz', '.foo', :failed_to_unify, 2) do
375
- assert_extends 'a.foo#bar', 'h1.baz {@extend .foo}', 'a.foo#bar'
375
+ render_extends 'a.foo#bar', 'h1.baz {@extend .foo}'
376
376
  end
377
377
 
378
378
  assert_extend_doesnt_match('.bang#baz', '.foo', :failed_to_unify, 2) do
379
- assert_extends 'a.foo#bar', '.bang#baz {@extend .foo}', 'a.foo#bar'
379
+ render_extends 'a.foo#bar', '.bang#baz {@extend .foo}'
380
380
  end
381
381
  end
382
382
 
@@ -392,7 +392,7 @@ SCSS
392
392
 
393
393
  def test_nested_extender_aborts_unification
394
394
  assert_extend_doesnt_match('foo bar', '.foo', :failed_to_unify, 2) do
395
- assert_extends 'baz.foo', 'foo bar {@extend .foo}', 'baz.foo'
395
+ render_extends 'baz.foo', 'foo bar {@extend .foo}'
396
396
  end
397
397
  end
398
398
 
@@ -810,10 +810,7 @@ SCSS
810
810
 
811
811
  def test_placeholder_selector_as_modifier
812
812
  assert_extend_doesnt_match('div', '%foo', :failed_to_unify, 3) do
813
- assert_equal <<CSS, render(<<SCSS)
814
- a.baz.bar {
815
- color: blue; }
816
- CSS
813
+ render(<<SCSS)
817
814
  a%foo.baz {color: blue}
818
815
  .bar {@extend %foo}
819
816
  div {@extend %foo}
@@ -844,16 +841,11 @@ SCSS
844
841
  end
845
842
 
846
843
  def test_extend_out_of_media
847
- assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
848
- DEPRECATION WARNING on line 3 of test_extend_out_of_media_inline.scss:
849
- @extending an outer selector from within @media is deprecated.
850
- You may only @extend selectors within the same directive.
851
- This will be an error in Sass 3.3.
852
- It can only work once @extend is supported natively in the browser.
853
- WARN
854
- .foo {
855
- a: b; }
856
- CSS
844
+ assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
845
+ You may not @extend an outer selector from within @media.
846
+ You may only @extend selectors within the same directive.
847
+ From "@extend .foo" on line 3 of test_extend_out_of_media_inline.scss.
848
+ ERR
857
849
  .foo {a: b}
858
850
  @media screen {
859
851
  .bar {@extend .foo}
@@ -862,18 +854,11 @@ SCSS
862
854
  end
863
855
 
864
856
  def test_extend_out_of_unknown_directive
865
- assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
866
- DEPRECATION WARNING on line 3 of test_extend_out_of_unknown_directive_inline.scss:
867
- @extending an outer selector from within @flooblehoof is deprecated.
868
- You may only @extend selectors within the same directive.
869
- This will be an error in Sass 3.3.
870
- It can only work once @extend is supported natively in the browser.
871
- WARN
872
- .foo {
873
- a: b; }
874
-
875
- @flooblehoof {}
876
- CSS
857
+ assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
858
+ You may not @extend an outer selector from within @flooblehoof.
859
+ You may only @extend selectors within the same directive.
860
+ From "@extend .foo" on line 3 of test_extend_out_of_unknown_directive_inline.scss.
861
+ ERR
877
862
  .foo {a: b}
878
863
  @flooblehoof {
879
864
  .bar {@extend .foo}
@@ -882,19 +867,11 @@ SCSS
882
867
  end
883
868
 
884
869
  def test_extend_out_of_nested_directives
885
- assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
886
- DEPRECATION WARNING on line 4 of test_extend_out_of_nested_directives_inline.scss:
887
- @extending an outer selector from within @flooblehoof is deprecated.
888
- You may only @extend selectors within the same directive.
889
- This will be an error in Sass 3.3.
890
- It can only work once @extend is supported natively in the browser.
891
- WARN
892
- @media screen {
893
- .foo {
894
- a: b; }
895
-
896
- @flooblehoof {} }
897
- CSS
870
+ assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
871
+ You may not @extend an outer selector from within @flooblehoof.
872
+ You may only @extend selectors within the same directive.
873
+ From "@extend .foo" on line 4 of test_extend_out_of_nested_directives_inline.scss.
874
+ ERR
898
875
  @media screen {
899
876
  .foo {a: b}
900
877
  @flooblehoof {
@@ -985,20 +962,11 @@ SCSS
985
962
  end
986
963
 
987
964
  def test_extend_within_and_without_media
988
- assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
989
- DEPRECATION WARNING on line 4 of test_extend_within_and_without_media_inline.scss:
990
- @extending an outer selector from within @media is deprecated.
991
- You may only @extend selectors within the same directive.
992
- This will be an error in Sass 3.3.
993
- It can only work once @extend is supported natively in the browser.
994
- WARN
995
- .foo {
996
- a: b; }
997
-
998
- @media screen {
999
- .foo, .bar {
1000
- c: d; } }
1001
- CSS
965
+ assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
966
+ You may not @extend an outer selector from within @media.
967
+ You may only @extend selectors within the same directive.
968
+ From "@extend .foo" on line 4 of test_extend_within_and_without_media_inline.scss.
969
+ ERR
1002
970
  .foo {a: b}
1003
971
  @media screen {
1004
972
  .foo {c: d}
@@ -1008,20 +976,11 @@ SCSS
1008
976
  end
1009
977
 
1010
978
  def test_extend_within_and_without_unknown_directive
1011
- assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
1012
- DEPRECATION WARNING on line 4 of test_extend_within_and_without_unknown_directive_inline.scss:
1013
- @extending an outer selector from within @flooblehoof is deprecated.
1014
- You may only @extend selectors within the same directive.
1015
- This will be an error in Sass 3.3.
1016
- It can only work once @extend is supported natively in the browser.
1017
- WARN
1018
- .foo {
1019
- a: b; }
1020
-
1021
- @flooblehoof {
1022
- .foo, .bar {
1023
- c: d; } }
1024
- CSS
979
+ assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
980
+ You may not @extend an outer selector from within @flooblehoof.
981
+ You may only @extend selectors within the same directive.
982
+ From "@extend .foo" on line 4 of test_extend_within_and_without_unknown_directive_inline.scss.
983
+ ERR
1025
984
  .foo {a: b}
1026
985
  @flooblehoof {
1027
986
  .foo {c: d}
@@ -1031,21 +990,11 @@ SCSS
1031
990
  end
1032
991
 
1033
992
  def test_extend_within_and_without_nested_directives
1034
- assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
1035
- DEPRECATION WARNING on line 5 of test_extend_within_and_without_nested_directives_inline.scss:
1036
- @extending an outer selector from within @flooblehoof is deprecated.
1037
- You may only @extend selectors within the same directive.
1038
- This will be an error in Sass 3.3.
1039
- It can only work once @extend is supported natively in the browser.
1040
- WARN
1041
- @media screen {
1042
- .foo {
1043
- a: b; }
1044
-
1045
- @flooblehoof {
1046
- .foo, .bar {
1047
- c: d; } } }
1048
- CSS
993
+ assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
994
+ You may not @extend an outer selector from within @flooblehoof.
995
+ You may only @extend selectors within the same directive.
996
+ From "@extend .foo" on line 5 of test_extend_within_and_without_nested_directives_inline.scss.
997
+ ERR
1049
998
  @media screen {
1050
999
  .foo {a: b}
1051
1000
  @flooblehoof {
@@ -1115,33 +1064,28 @@ SCSS
1115
1064
  end
1116
1065
 
1117
1066
  def test_extend_warns_when_extendee_doesnt_exist
1118
- assert_warning(<<WARN) {assert_equal("", render(<<SCSS))}
1119
- WARNING on line 1 of test_extend_warns_when_extendee_doesnt_exist_inline.scss: ".foo" failed to @extend ".bar".
1120
- The selector ".bar" was not found.
1121
- This will be an error in future releases of Sass.
1122
- Use "@extend .bar !optional" if the extend should be able to fail.
1123
- WARN
1067
+ assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
1068
+ ".foo" failed to @extend ".bar".
1069
+ The selector ".bar" was not found.
1070
+ Use "@extend .bar !optional" if the extend should be able to fail.
1071
+ ERR
1124
1072
  .foo {@extend .bar}
1125
1073
  SCSS
1126
1074
  end
1127
1075
 
1128
1076
  def test_extend_warns_when_extension_fails
1129
- assert_warning(<<WARN) {assert_equal(<<CSS, render(<<SCSS))}
1130
- WARNING on line 2 of test_extend_warns_when_extension_fails_inline.scss: "b.foo" failed to @extend ".bar".
1131
- No selectors matching ".bar" could be unified with "b.foo".
1132
- This will be an error in future releases of Sass.
1133
- Use "@extend .bar !optional" if the extend should be able to fail.
1134
- WARN
1135
- a.bar {
1136
- a: b; }
1137
- CSS
1077
+ assert_raise_message(Sass::SyntaxError, <<ERR) {render(<<SCSS)}
1078
+ "b.foo" failed to @extend ".bar".
1079
+ No selectors matching ".bar" could be unified with "b.foo".
1080
+ Use "@extend .bar !optional" if the extend should be able to fail.
1081
+ ERR
1138
1082
  a.bar {a: b}
1139
1083
  b.foo {@extend .bar}
1140
1084
  SCSS
1141
1085
  end
1142
1086
 
1143
- def test_extend_does_not_warn_when_one_extension_fails_but_others_dont
1144
- assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
1087
+ def test_extend_succeeds_when_one_extension_fails_but_others_dont
1088
+ assert_equal(<<CSS, render(<<SCSS))
1145
1089
  a.bar {
1146
1090
  a: b; }
1147
1091
 
@@ -1154,8 +1098,8 @@ b.foo {@extend .bar}
1154
1098
  SCSS
1155
1099
  end
1156
1100
 
1157
- def test_extend_does_not_warn_when_one_extension_fails_but_others_dont
1158
- assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
1101
+ def test_extend_succeeds_when_one_extension_fails_but_others_dont
1102
+ assert_equal(<<CSS, render(<<SCSS))
1159
1103
  a.bar {
1160
1104
  a: b; }
1161
1105
 
@@ -1168,14 +1112,14 @@ b.foo {@extend .bar}
1168
1112
  SCSS
1169
1113
  end
1170
1114
 
1171
- def test_optional_extend_does_not_warn_when_extendee_doesnt_exist
1172
- assert_no_warning {assert_equal("", render(<<SCSS))}
1115
+ def test_optional_extend_succeeds_when_extendee_doesnt_exist
1116
+ assert_equal("", render(<<SCSS))
1173
1117
  .foo {@extend .bar !optional}
1174
1118
  SCSS
1175
1119
  end
1176
1120
 
1177
- def test_optional_extend_does_not_warn_when_extension_fails
1178
- assert_no_warning {assert_equal(<<CSS, render(<<SCSS))}
1121
+ def test_optional_extend_succeeds_when_extension_fails
1122
+ assert_equal(<<CSS, render(<<SCSS))
1179
1123
  a.bar {
1180
1124
  a: b; }
1181
1125
  CSS
@@ -1295,7 +1239,7 @@ SCSS
1295
1239
  private
1296
1240
 
1297
1241
  def assert_extend_doesnt_match(extender, target, reason, line, syntax = :scss)
1298
- warn = "\"#{extender}\" failed to @extend \"#{target}\"."
1242
+ message = "\"#{extender}\" failed to @extend \"#{target}\"."
1299
1243
  reason =
1300
1244
  if reason == :not_found
1301
1245
  "The selector \"#{target}\" was not found."
@@ -1303,12 +1247,11 @@ SCSS
1303
1247
  "No selectors matching \"#{target}\" could be unified with \"#{extender}\"."
1304
1248
  end
1305
1249
 
1306
- assert_warning(<<WARNING) {yield}
1307
- WARNING on line #{line} of #{filename_for_test syntax}: #{warn}
1308
- #{reason}
1309
- This will be an error in future releases of Sass.
1310
- Use "@extend #{target} !optional" if the extend should be able to fail.
1311
- WARNING
1250
+ assert_raise_message(Sass::SyntaxError, <<ERR) {yield}
1251
+ #{message}
1252
+ #{reason}
1253
+ Use "@extend #{target} !optional" if the extend should be able to fail.
1254
+ ERR
1312
1255
  end
1313
1256
 
1314
1257
  def assert_unification(selector, extension, unified)
@@ -1319,11 +1262,21 @@ WARNING
1319
1262
  unified.split(', ').map {|s| "-a #{s}"}.join(', '))
1320
1263
  end
1321
1264
 
1265
+ def render_unification(selector, extension)
1266
+ render_extends(
1267
+ "%-a #{selector}",
1268
+ extension + " -a {@extend %-a}")
1269
+ end
1270
+
1322
1271
  def assert_extends(selector, extension, result)
1323
- assert_equal <<CSS, render(<<SCSS)
1272
+ assert_equal <<CSS, render_extends(selector, extension)
1324
1273
  #{result} {
1325
1274
  a: b; }
1326
1275
  CSS
1276
+ end
1277
+
1278
+ def render_extends(selector, extension)
1279
+ render(<<SCSS)
1327
1280
  #{selector} {a: b}
1328
1281
  #{extension}
1329
1282
  SCSS
@@ -222,7 +222,6 @@ WARNING: In #{template_loc}:
222
222
  There are multiple files that match the name "same_name_different_partiality.scss":
223
223
  _same_name_different_partiality.scss
224
224
  same_name_different_partiality.scss
225
- This will be an error in future versions of Sass.
226
225
  WARNING
227
226
  touch "_same_name_different_partiality"
228
227
  assert_needs_update "same_name_different_partiality"
@@ -231,17 +230,6 @@ WARNING
231
230
 
232
231
  # Callbacks
233
232
 
234
- def test_updating_stylesheets_callback
235
- # Should run even when there's nothing to update
236
- Sass::Plugin.options[:template_location] = nil
237
- assert_callback :updating_stylesheets, []
238
- end
239
-
240
- def test_updating_stylesheets_callback_with_never_update
241
- Sass::Plugin.options[:never_update] = true
242
- assert_no_callback :updating_stylesheets
243
- end
244
-
245
233
  def test_updated_stylesheet_callback_for_updated_template
246
234
  Sass::Plugin.options[:always_update] = false
247
235
  touch 'basic'
@@ -1711,6 +1711,41 @@ SCSS
1711
1711
 
1712
1712
  # Regression
1713
1713
 
1714
+ def test_parsing_decimals_followed_by_comments_doesnt_take_forever
1715
+ assert_equal(<<CSS, render(<<SCSS))
1716
+ .foo {
1717
+ padding: 4.21053% 4.21053% 5.63158%; }
1718
+ CSS
1719
+ .foo {
1720
+ padding: 4.21052631578947% 4.21052631578947% 5.631578947368421% /**/
1721
+ }
1722
+ SCSS
1723
+ end
1724
+
1725
+ def test_parsing_many_numbers_doesnt_take_forever
1726
+ values = ["80% 90%"] * 1000
1727
+ assert_equal(<<CSS, render(<<SCSS))
1728
+ .foo {
1729
+ padding: #{values.join(', ')}; }
1730
+ CSS
1731
+ .foo {
1732
+ padding: #{values.join(', ')};
1733
+ }
1734
+ SCSS
1735
+ end
1736
+
1737
+ def test_import_comments_in_imports
1738
+ assert_equal(<<CSS, render(<<SCSS))
1739
+ @import url(foo.css);
1740
+ @import url(bar.css);
1741
+ @import url(baz.css);
1742
+ CSS
1743
+ @import "foo.css", // this is a comment
1744
+ "bar.css", // this is another comment
1745
+ "baz.css"; // this is a third comment
1746
+ SCSS
1747
+ end
1748
+
1714
1749
  def test_reference_combinator_with_parent_ref
1715
1750
  assert_equal <<CSS, render(<<SCSS)
1716
1751
  a /foo/ b {
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: 592302953
4
+ hash: 592302971
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 3
9
9
  - 0
10
10
  - alpha
11
- - 50
12
- version: 3.3.0.alpha.50
11
+ - 59
12
+ version: 3.3.0.alpha.59
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-11-29 00:00:00 -05:00
22
+ date: 2012-12-21 00:00:00 -05:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -132,6 +132,7 @@ files:
132
132
  - lib/sass/selector/simple.rb
133
133
  - lib/sass/selector/simple_sequence.rb
134
134
  - lib/sass/shared.rb
135
+ - lib/sass/util.rb
135
136
  - lib/sass/supports.rb
136
137
  - lib/sass/tree/charset_node.rb
137
138
  - lib/sass/tree/comment_node.rb
@@ -167,13 +168,12 @@ files:
167
168
  - lib/sass/tree/visitors/to_css.rb
168
169
  - lib/sass/tree/warn_node.rb
169
170
  - lib/sass/tree/while_node.rb
170
- - lib/sass/util.rb
171
- - lib/sass/util/multibyte_string_scanner.rb
172
- - lib/sass/util/subset_map.rb
173
- - lib/sass/version.rb
174
171
  - lib/sass/source/map.rb
175
172
  - lib/sass/source/position.rb
176
173
  - lib/sass/source/range.rb
174
+ - lib/sass/util/multibyte_string_scanner.rb
175
+ - lib/sass/util/subset_map.rb
176
+ - lib/sass/version.rb
177
177
  - vendor/listen/CHANGELOG.md
178
178
  - vendor/listen/Gemfile
179
179
  - vendor/listen/Guardfile
@@ -268,6 +268,7 @@ files:
268
268
  - test/sass/scss/rx_test.rb
269
269
  - test/sass/scss/scss_test.rb
270
270
  - test/sass/scss/test_helper.rb
271
+ - test/sass/util_test.rb
271
272
  - test/sass/templates/_cached_import_option_partial.scss
272
273
  - test/sass/templates/_double_import_loop2.sass
273
274
  - test/sass/templates/_filename_fn_import.scss
@@ -326,7 +327,6 @@ files:
326
327
  - test/sass/test_helper.rb
327
328
  - test/sass/util/multibyte_string_scanner_test.rb
328
329
  - test/sass/util/subset_map_test.rb
329
- - test/sass/util_test.rb
330
330
  - test/sass/source_map_test.rb
331
331
  - test/test_helper.rb
332
332
  - extra/update_watch.rb
@@ -394,7 +394,7 @@ test_files:
394
394
  - test/sass/scss/css_test.rb
395
395
  - test/sass/scss/rx_test.rb
396
396
  - test/sass/scss/scss_test.rb
397
+ - test/sass/util_test.rb
397
398
  - test/sass/util/multibyte_string_scanner_test.rb
398
399
  - test/sass/util/subset_map_test.rb
399
- - test/sass/util_test.rb
400
400
  - test/sass/source_map_test.rb