sass 3.2.0.alpha.244 → 3.2.0.alpha.247

Sign up to get free protection for your applications and to get access to all the features.
data/REVISION CHANGED
@@ -1 +1 @@
1
- b255878dc6283a5cb4c03879de4eb25f7621f82d
1
+ 5cc7590756da94e5c6df3da3be9ca8ff946d7279
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.2.0.alpha.244
1
+ 3.2.0.alpha.247
@@ -705,7 +705,7 @@ WARNING
705
705
  Tree::CharsetNode.new(name)
706
706
  when 'media'
707
707
  parser = Sass::SCSS::Parser.new(value, @options[:filename], @line)
708
- Tree::MediaNode.new(parser.parse_media_query_list)
708
+ Tree::MediaNode.new(parser.parse_media_query_list.to_a)
709
709
  else
710
710
  Tree::DirectiveNode.new(
711
711
  value.nil? ? ["@#{directive}"] : ["@#{directive} "] + parse_interp(value, offset))
@@ -800,7 +800,7 @@ WARNING
800
800
  str = script_parser.parse_string
801
801
  media_parser = Sass::SCSS::Parser.new(scanner, @options[:filename], @line)
802
802
  media = media_parser.parse_media_query_list
803
- return Tree::CssImportNode.new(str, media)
803
+ return Tree::CssImportNode.new(str, media.to_a)
804
804
  end
805
805
 
806
806
  unless str = scanner.scan(Sass::SCSS::RX::STRING)
@@ -812,7 +812,7 @@ WARNING
812
812
  if !scanner.match?(/[,;]|$/)
813
813
  media_parser = Sass::SCSS::Parser.new(scanner, @options[:filename], @line)
814
814
  media = media_parser.parse_media_query_list
815
- Tree::CssImportNode.new(str || uri, media)
815
+ Tree::CssImportNode.new(str || uri, media.to_a)
816
816
  elsif val =~ /^http:\/\//
817
817
  Tree::CssImportNode.new("url(#{val})")
818
818
  else
@@ -14,16 +14,6 @@ module Sass::Media
14
14
  @queries = queries
15
15
  end
16
16
 
17
- # Runs the SassScript in the media query list.
18
- #
19
- # @yield [interp] A block that should perform interpolation.
20
- # @yieldparam interp [Array<String, Sass::Script::Node>]
21
- # An interpolation array to perform.
22
- # @yieldreturn [String] The interpolated value.
23
- def perform(&run_interp)
24
- @queries.each {|q| q.perform(&run_interp)}
25
- end
26
-
27
17
  # Merges this query list with another. The returned query list
28
18
  # queries for the intersection between the two inputs.
29
19
  #
@@ -52,19 +42,22 @@ module Sass::Media
52
42
  queries.map {|q| q.to_src(options)}.join(', ')
53
43
  end
54
44
 
45
+ # Returns a representation of the query as an array of strings and
46
+ # potentially {Sass::Script::Node}s (if there's interpolation in it). When
47
+ # the interpolation is resolved and the strings are joined together, this
48
+ # will be the string representation of this query.
49
+ #
50
+ # @return [Array<String, Sass::Script::Node>]
51
+ def to_a
52
+ Sass::Util.intersperse(queries.map {|q| q.to_a}, ', ').flatten
53
+ end
54
+
55
55
  # Returns a deep copy of this query list and all its children.
56
56
  #
57
57
  # @return [QueryList]
58
58
  def deep_copy
59
59
  QueryList.new(queries.map {|q| q.deep_copy})
60
60
  end
61
-
62
- # Sets the options hash for the script nodes in the media query.
63
- #
64
- # @param options [{Symbol => Object}] The options has to set.
65
- def options=(options)
66
- queries.each {|q| q.options = options}
67
- end
68
61
  end
69
62
 
70
63
  # A single media query.
@@ -73,50 +66,51 @@ module Sass::Media
73
66
  class Query
74
67
  # The modifier for the query.
75
68
  #
69
+ # When parsed as Sass code, this contains strings and SassScript nodes. When
70
+ # parsed as CSS, it contains a single string (accessible via
71
+ # \{#resolved_modifier}).
72
+ #
76
73
  # @return [Array<String, Sass::Script::Node>]
77
74
  attr_accessor :modifier
78
75
 
79
- # The modifier for the query after any SassScript has been resolved.
80
- # Only set once \{Tree::Visitors::Perform} has been run.
81
- #
82
- # @return [String]
83
- attr_accessor :resolved_modifier
84
-
85
76
  # The type of the query (e.g. `"screen"` or `"print"`).
86
77
  #
78
+ # When parsed as Sass code, this contains strings and SassScript nodes. When
79
+ # parsed as CSS, it contains a single string (accessible via
80
+ # \{#resolved_type}).
81
+ #
87
82
  # @return [Array<String, Sass::Script::Node>]
88
83
  attr_accessor :type
89
84
 
90
- # The type of the query after any SassScript has been resolved.
91
- # Only set once \{Tree::Visitors::Perform} has been run.
92
- #
93
- # @return [String]
94
- attr_accessor :resolved_type
95
-
96
85
  # The trailing expressions in the query.
97
86
  #
98
- # @return [Array<Expression>]
87
+ # When parsed as Sass code, each expression contains strings and SassScript
88
+ # nodes. When parsed as CSS, each one contains a single string.
89
+ #
90
+ # @return [Array<Array<String, Sass::Script::Node>>]
99
91
  attr_accessor :expressions
100
92
 
101
93
  # @param modifier [Array<String, Sass::Script::Node>] See \{#modifier}
102
94
  # @param type [Array<String, Sass::Script::Node>] See \{#type}
103
- # @param expressions [Array<Expression>] See \{#expressions}
95
+ # @param expressions [Array<Array<String, Sass::Script::Node>>] See \{#expressions}
104
96
  def initialize(modifier, type, expressions)
105
97
  @modifier = modifier
106
98
  @type = type
107
99
  @expressions = expressions
108
100
  end
109
101
 
110
- # Runs the SassScript in the media query.
111
- #
112
- # @yield [interp] A block that should perform interpolation.
113
- # @yieldparam interp [Array<String, Sass::Script::Node>]
114
- # An interpolation array to perform.
115
- # @yieldreturn [String] The interpolated value.
116
- def perform(&run_interp)
117
- @resolved_modifier = yield modifier
118
- @resolved_type = yield type
119
- expressions.each {|e| e.perform(&run_interp)}
102
+ # See \{#modifier}.
103
+ # @return [String]
104
+ def resolved_modifier
105
+ # modifier should contain only a single string
106
+ modifier.first || ''
107
+ end
108
+
109
+ # See \{#type}.
110
+ # @return [String]
111
+ def resolved_type
112
+ # type should contain only a single string
113
+ type.first || ''
120
114
  end
121
115
 
122
116
  # Merges this query with another. The returned query queries for
@@ -147,8 +141,8 @@ module Sass::Media
147
141
  mod = m1.empty? ? m2 : m1
148
142
  end
149
143
  q = Query.new([], [], other.expressions + expressions)
150
- q.resolved_type = type
151
- q.resolved_modifier = mod
144
+ q.type = [type]
145
+ q.modifier = [mod]
152
146
  return q
153
147
  end
154
148
 
@@ -161,7 +155,12 @@ module Sass::Media
161
155
  css << ' ' unless resolved_modifier.empty?
162
156
  css << resolved_type
163
157
  css << ' and ' unless resolved_type.empty? || expressions.empty?
164
- css << expressions.map {|e| e.to_css}.join(' and ')
158
+ css << expressions.map do |e|
159
+ # It's possible for there to be script nodes in Expressions even when
160
+ # we're converting to CSS in the case where we parsed the document as
161
+ # CSS originally (as in css_test.rb).
162
+ e.map {|c| c.is_a?(Sass::Script::Node) ? c.to_sass : c.to_s}.join
163
+ end.join(' and ')
165
164
  css
166
165
  end
167
166
 
@@ -175,10 +174,23 @@ module Sass::Media
175
174
  src << ' ' unless modifier.empty?
176
175
  src << Sass::Media._interp_to_src(type, options)
177
176
  src << ' and ' unless type.empty? || expressions.empty?
178
- src << expressions.map {|e| e.to_src(options)}.join(' and ')
177
+ src << expressions.map do |e|
178
+ Sass::Media._interp_to_src(e, options)
179
+ end.join(' and ')
179
180
  src
180
181
  end
181
182
 
183
+ # @see \{MediaQuery#to\_a}
184
+ def to_a
185
+ res = []
186
+ res += modifier
187
+ res << ' ' unless modifier.empty?
188
+ res += type
189
+ res << ' and ' unless type.empty? || expressions.empty?
190
+ res += Sass::Util.intersperse(expressions, ' and ').flatten
191
+ res
192
+ end
193
+
182
194
  # Returns a deep copy of this query and all its children.
183
195
  #
184
196
  # @return [Query]
@@ -186,99 +198,7 @@ module Sass::Media
186
198
  Query.new(
187
199
  modifier.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c},
188
200
  type.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c},
189
- expressions.map {|q| q.deep_copy})
190
- end
191
-
192
- # Sets the options hash for the script nodes in the media query.
193
- #
194
- # @param options [{Symbol => Object}] The options has to set.
195
- def options=(options)
196
- modifier.each {|m| m.options = options if m.is_a?(Sass::Script::Node)}
197
- type.each {|t| t.options = options if t.is_a?(Sass::Script::Node)}
198
- expressions.each {|e| e.options = options}
199
- end
200
- end
201
-
202
- # A media query expression.
203
- #
204
- # '(' S* media_feature S* [ ':' S* expr ]? ')'
205
- class Expression
206
- # The name of the feature being queried for.
207
- #
208
- # @return [Sass::Script::Node]
209
- attr_accessor :name
210
-
211
- # The name of the feature after any SassScript has been resolved.
212
- # Only set once \{Tree::Visitors::Perform} has been run.
213
- #
214
- # @return [String]
215
- attr_accessor :resolved_name
216
-
217
- # The value of the feature.
218
- #
219
- # @return [Sass::Script::Node]
220
- attr_accessor :value
221
-
222
- # The value of the feature after any SassScript has been resolved.
223
- # Only set once \{Tree::Visitors::Perform} has been run.
224
- #
225
- # @return [String]
226
- attr_accessor :resolved_value
227
-
228
- # @param name [Sass::Script::Node] See \{#name}
229
- # @param value [Sass::Script::Node] See \{#value}
230
- def initialize(name, value)
231
- @name = name
232
- @value = value
233
- end
234
-
235
- # Runs the SassScript in the expression.
236
- #
237
- # @yield [interp] A block that should perform interpolation.
238
- # @yieldparam interp [Array<String, Sass::Script::Node>]
239
- # An interpolation array to perform.
240
- # @yieldreturn [String] The interpolated value.
241
- def perform
242
- @resolved_name = yield name ? [name] : []
243
- @resolved_value = yield value ? [value] : []
244
- end
245
-
246
- # Returns the CSS for the expression.
247
- #
248
- # @return [String]
249
- def to_css
250
- css = '('
251
- css << resolved_name
252
- css << ': ' << resolved_value unless resolved_value.empty?
253
- css << ')'
254
- css
255
- end
256
-
257
- # Returns the Sass/SCSS code for the expression.
258
- #
259
- # @param options [{Symbol => Object}] An options hash (see {Sass::CSS#initialize}).
260
- # @return [String]
261
- def to_src(options)
262
- src = '('
263
- src << name.to_sass(options)
264
- src << ': ' << value.to_sass(options) if value
265
- src << ')'
266
- src
267
- end
268
-
269
- # Returns a deep copy of this expression.
270
- #
271
- # @return [Expression]
272
- def deep_copy
273
- Expression.new(name.deep_copy, value && value.deep_copy)
274
- end
275
-
276
- # Sets the options hash for the script nodes in the expression.
277
- #
278
- # @param options [{Symbol => Object}] The options has to set.
279
- def options=(options)
280
- name.options = options
281
- value.options = options if value
201
+ expressions.map {|e| e.map {|c| c.is_a?(Sass::Script::Node) ? c.deep_copy : c}})
282
202
  end
283
203
  end
284
204
 
@@ -309,7 +309,7 @@ module Sass
309
309
  str = sass_script(:parse_string)
310
310
  media = media_query_list
311
311
  ss
312
- return node(Tree::CssImportNode.new(str, media))
312
+ return node(Tree::CssImportNode.new(str, media.to_a))
313
313
  end
314
314
 
315
315
  path = @scanner[1] || @scanner[2]
@@ -317,7 +317,7 @@ module Sass
317
317
 
318
318
  media = media_query_list
319
319
  if path =~ /^http:\/\// || media || use_css_import?
320
- return node(Sass::Tree::CssImportNode.new(str, media))
320
+ return node(Sass::Tree::CssImportNode.new(str, media.to_a))
321
321
  end
322
322
 
323
323
  node(Sass::Tree::ImportNode.new(path.strip))
@@ -326,7 +326,7 @@ module Sass
326
326
  def use_css_import?; false; end
327
327
 
328
328
  def media_directive
329
- block(node(Sass::Tree::MediaNode.new(media_query_list)), :directive)
329
+ block(node(Sass::Tree::MediaNode.new(media_query_list.to_a)), :directive)
330
330
  end
331
331
 
332
332
  # http://www.w3.org/TR/css3-mediaqueries/#syntax
@@ -378,17 +378,20 @@ module Sass
378
378
  end
379
379
 
380
380
  def media_expr
381
+ interp = interpolation and return interp
381
382
  return unless tok(/\(/)
383
+ res = ['(']
382
384
  ss
383
- name = sass_script(:parse)
385
+ res << sass_script(:parse)
384
386
 
385
387
  if tok(/:/)
386
- ss; value = sass_script(:parse)
388
+ res << ': '
389
+ ss
390
+ res << sass_script(:parse)
387
391
  end
388
- tok!(/\)/)
392
+ res << tok!(/\)/)
389
393
  ss
390
-
391
- Sass::Media::Expression.new(name, value)
394
+ res
392
395
  end
393
396
 
394
397
  def charset_directive
@@ -724,7 +727,7 @@ module Sass
724
727
  val = interp_ident || expr!(:interp_string)
725
728
  ss
726
729
  end
727
- tok(/\]/)
730
+ tok!(/\]/)
728
731
 
729
732
  Selector::Attribute.new(merge(name), merge(ns), op, merge(val))
730
733
  end
@@ -15,13 +15,21 @@ module Sass::Tree
15
15
  # @return [String]
16
16
  attr_accessor :resolved_uri
17
17
 
18
- # The media query, or nil.
18
+ # The media query for this rule, interspersed with {Sass::Script::Node}s
19
+ # representing `#{}`-interpolation. Any adjacent strings will be merged
20
+ # together.
19
21
  #
20
- # @return [Sass::Media::Query?]
22
+ # @return [Array<String, Sass::Script::Node>]
21
23
  attr_accessor :query
22
24
 
25
+ # The media query for this rule, without any unresolved interpolation. It's
26
+ # only set once {Tree::Node#perform} has been called.
27
+ #
28
+ # @return [Sass::Media::QueryList]
29
+ attr_accessor :resolved_query
30
+
23
31
  # @param uri [String, Sass::Script::Node] See \{#uri}
24
- # @param query [Sass::Media::Query] See \{#query}
32
+ # @param query [Array<String, Sass::Script::Node>] See \{#query}
25
33
  def initialize(uri, query = nil)
26
34
  @uri = uri
27
35
  @query = query
@@ -44,7 +52,7 @@ module Sass::Tree
44
52
  @resolved_value ||=
45
53
  begin
46
54
  str = "@import #{resolved_uri}"
47
- str << " #{query.to_css}" if query
55
+ str << " #{resolved_query.to_css}" if resolved_query
48
56
  str
49
57
  end
50
58
  end
@@ -6,18 +6,28 @@ module Sass::Tree
6
6
  #
7
7
  # @see Sass::Tree
8
8
  class MediaNode < DirectiveNode
9
- # The media query.
9
+ # TODO: parse and cache the query immediately if it has no dynamic elements
10
+
11
+ # The media query for this rule, interspersed with {Sass::Script::Node}s
12
+ # representing `#{}`-interpolation. Any adjacent strings will be merged
13
+ # together.
10
14
  #
11
- # @return [Sass::Media::Query]
15
+ # @return [Array<String, Sass::Script::Node>]
12
16
  attr_accessor :query
13
17
 
18
+ # The media query for this rule, without any unresolved interpolation. It's
19
+ # only set once {Tree::Node#perform} has been called.
20
+ #
21
+ # @return [Sass::Media::QueryList]
22
+ attr_accessor :resolved_query
23
+
14
24
  # @see RuleNode#tabs
15
25
  attr_accessor :tabs
16
26
 
17
27
  # @see RuleNode#group_end
18
28
  attr_accessor :group_end
19
29
 
20
- # @param query [Sass::Media::Query] See \{#query}
30
+ # @param query [Array<String, Sass::Script::Node>] See \{#query}
21
31
  def initialize(query)
22
32
  @query = query
23
33
  @tabs = 0
@@ -32,7 +42,7 @@ module Sass::Tree
32
42
 
33
43
  # @see DirectiveNode#resolved_value
34
44
  def resolved_value
35
- @resolved_value ||= "@media #{query.to_css}"
45
+ @resolved_value ||= "@media #{resolved_query.to_css}"
36
46
  end
37
47
 
38
48
  # True when the directive has no visible children.
@@ -148,7 +148,7 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
148
148
  end
149
149
 
150
150
  def visit_media(node)
151
- "#{tab_str}@media #{node.query.to_src(@options)}#{yield}"
151
+ "#{tab_str}@media #{interp_to_src(node.query)}#{yield}"
152
152
  end
153
153
 
154
154
  def visit_supports(node)
@@ -161,7 +161,7 @@ class Sass::Tree::Visitors::Convert < Sass::Tree::Visitors::Base
161
161
  else
162
162
  str = "#{tab_str}@import #{node.uri}"
163
163
  end
164
- str << " #{node.query.to_src(@options)}" if node.query
164
+ str << " #{interp_to_src(node.query)}" unless node.query.empty?
165
165
  "#{str}#{semi}\n"
166
166
  end
167
167
 
@@ -139,7 +139,7 @@ class Sass::Tree::Visitors::Cssize < Sass::Tree::Visitors::Base
139
139
  yield unless bubble(node)
140
140
  media = node.children.select {|c| c.is_a?(Sass::Tree::MediaNode)}
141
141
  node.children.reject! {|c| c.is_a?(Sass::Tree::MediaNode)}
142
- media = media.select {|n| n.query = n.query.merge(node.query)}
142
+ media = media.select {|n| n.resolved_query = n.resolved_query.merge(node.resolved_query)}
143
143
  (node.children.empty? ? [] : [node]) + media
144
144
  end
145
145
 
@@ -298,8 +298,8 @@ END
298
298
  end
299
299
 
300
300
  def visit_media(node)
301
- node.query = node.query.deep_copy
302
- node.query.perform {|interp| run_interp(interp)}
301
+ parser = Sass::SCSS::StaticParser.new(run_interp(node.query), node.filename, node.line)
302
+ node.resolved_query ||= parser.parse_media_query_list
303
303
  yield
304
304
  end
305
305
 
@@ -312,8 +312,8 @@ END
312
312
  def visit_cssimport(node)
313
313
  node.resolved_uri = run_interp([node.uri])
314
314
  if node.query
315
- node.query = node.query.deep_copy
316
- node.query.perform {|interp| run_interp(interp)}
315
+ parser = Sass::SCSS::StaticParser.new(run_interp(node.query), node.filename, node.line)
316
+ node.resolved_query ||= parser.parse_media_query_list
317
317
  end
318
318
  yield
319
319
  end
@@ -101,7 +101,12 @@ class Sass::Tree::Visitors::SetOptions < Sass::Tree::Visitors::Base
101
101
  end
102
102
 
103
103
  def visit_media(node)
104
- node.query.options = @options
104
+ node.query.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)}
105
+ yield
106
+ end
107
+
108
+ def visit_cssimport(node)
109
+ node.query.each {|c| c.options = @options if c.is_a?(Sass::Script::Node)} if node.query
105
110
  yield
106
111
  end
107
112
 
@@ -591,7 +591,7 @@ MSG
591
591
  Regexp.new(/\A(?:#{_enc("\uFEFF", e)})?#{
592
592
  _enc('@charset "', e)}(.*?)#{_enc('"', e)}|\A(#{
593
593
  _enc("\uFEFF", e)})/)
594
- rescue Encoding::ConverterNotFound => _
594
+ rescue Encoding::ConverterNotFoundError => _
595
595
  nil # JRuby on Java 5 doesn't support UTF-32
596
596
  rescue
597
597
  # /\A@charset "(.*?)"/
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
3
- require 'sass/test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
+ require File.dirname(__FILE__) + '/test_helper'
4
4
  require 'sass/engine'
5
5
 
6
6
  class CacheTest < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
3
  require 'sass/callbacks'
4
4
 
5
5
  class CallerBack
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
3
 
4
4
  class ConversionTest < Test::Unit::TestCase
5
5
  def test_basic
@@ -1153,7 +1153,17 @@ SCSS
1153
1153
  end
1154
1154
 
1155
1155
  def test_media_with_expressions
1156
- assert_renders <<SASS, <<SCSS
1156
+ # TODO: get rid of the #{} in the expression output
1157
+ assert_sass_to_scss <<SCSS, <<SASS
1158
+ $media1: screen;
1159
+ $media2: print;
1160
+ $var: -webkit-min-device-pixel-ratio;
1161
+ $val: 20;
1162
+
1163
+ @media \#{$media1} and (\#{$var + "-foo"}: \#{$val + 5}), only \#{$media2} {
1164
+ a: b;
1165
+ }
1166
+ SCSS
1157
1167
  $media1: screen
1158
1168
  $media2: print
1159
1169
  $var: -webkit-min-device-pixel-ratio
@@ -1162,6 +1172,16 @@ $val: 20
1162
1172
  @media \#{$media1} and ($var + "-foo": $val + 5), only \#{$media2}
1163
1173
  a: b
1164
1174
  SASS
1175
+
1176
+ assert_scss_to_sass <<SASS, <<SCSS
1177
+ $media1: screen
1178
+ $media2: print
1179
+ $var: -webkit-min-device-pixel-ratio
1180
+ $val: 20
1181
+
1182
+ @media \#{$media1} and (\#{$var + "-foo"}: \#{$val + 5}), only \#{$media2}
1183
+ a: b
1184
+ SASS
1165
1185
  $media1: screen;
1166
1186
  $media2: print;
1167
1187
  $var: -webkit-min-device-pixel-ratio;
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'test/unit'
3
- require 'test_helper'
3
+ require File.dirname(__FILE__) + '/../test_helper'
4
4
  require 'sass/css'
5
5
 
6
6
  class CSS2SassTest < Test::Unit::TestCase
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require 'test_helper'
4
- require 'sass/test_helper'
3
+ require File.dirname(__FILE__) + '/../test_helper'
4
+ require File.dirname(__FILE__) + '/test_helper'
5
5
  require 'sass/engine'
6
6
  require 'stringio'
7
7
  require 'mock_importer'
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
3
 
4
4
  class ExtendTest < Test::Unit::TestCase
5
5
  def test_basic
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'test/unit'
3
- require 'test_helper'
3
+ require File.dirname(__FILE__) + '/../test_helper'
4
4
  require 'sass/script'
5
5
 
6
6
  module Sass::Script::Functions
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
3
- require 'sass/test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
+ require File.dirname(__FILE__) + '/test_helper'
4
4
 
5
5
  require 'sass/plugin'
6
6
 
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
3
 
4
4
  begin
5
5
  require 'sass/less'
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
3
  require 'pathname'
4
4
 
5
5
  class LoggerTest < Test::Unit::TestCase
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
3
- require 'sass/test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
+ require File.dirname(__FILE__) + '/test_helper'
4
4
  require 'sass/plugin'
5
5
  require 'fileutils'
6
6
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require 'test_helper'
3
+ require File.dirname(__FILE__) + '/../test_helper'
4
4
  require 'sass/engine'
5
5
 
6
6
  class SassScriptConversionTest < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
3
  require 'sass/engine'
4
4
 
5
5
  module Sass::Script::Functions::UserFunctions
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require 'sass/scss/test_helper'
3
+ require File.dirname(__FILE__) + '/test_helper'
4
4
  require 'sass/scss/css_parser'
5
5
 
6
6
  # These tests just test the parsing of CSS
@@ -957,6 +957,10 @@ SCSS
957
957
 
958
958
  ## Regressions
959
959
 
960
+ def test_selector_without_closing_bracket
961
+ assert_not_parses('"]"', "foo[bar <err>{a: b}")
962
+ end
963
+
960
964
  def test_closing_line_comment_end_with_compact_output
961
965
  assert_equal(<<CSS, render(<<SCSS, :style => :compact))
962
966
  /* foo */
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require "sass/scss/test_helper"
3
+ require File.dirname(__FILE__) + '/../../test_helper'
4
4
  require 'sass/engine'
5
5
 
6
6
  class ScssRxTest < Test::Unit::TestCase
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require "sass/scss/test_helper"
3
+ require File.dirname(__FILE__) + '/test_helper'
4
4
 
5
5
  class ScssTest < Test::Unit::TestCase
6
6
  include ScssTestHelper
@@ -936,6 +936,31 @@ $vals: 1 2 3;
936
936
  SCSS
937
937
  end
938
938
 
939
+ def test_media_interpolation_with_reparse
940
+ assert_equal <<CSS, render(<<SCSS)
941
+ @media screen and (max-width: 300px) {
942
+ a: b; }
943
+ @media screen and (max-width: 300px) {
944
+ a: b; }
945
+ @media screen and (max-width: 300px) {
946
+ a: b; }
947
+ @media screen and (max-width: 300px), print and (max-width: 300px) {
948
+ a: b; }
949
+ CSS
950
+ $constraint: "(max-width: 300px)";
951
+ $fragment: "nd \#{$constraint}";
952
+ $comma: "een, pri";
953
+ @media screen and \#{$constraint} {a: b}
954
+ @media screen {
955
+ @media \#{$constraint} {a: b}
956
+ }
957
+ @media screen a\#{$fragment} {a: b}
958
+ @media scr\#{$comma}nt {
959
+ @media \#{$constraint} {a: b}
960
+ }
961
+ SCSS
962
+ end
963
+
939
964
  def test_moz_document_interpolation
940
965
  assert_equal <<CSS, render(<<SCSS)
941
966
  @-moz-document url(http://sass-lang.com/),
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require File.dirname(__FILE__) + '/../../test_helper'
2
2
  require 'sass/engine'
3
3
 
4
4
  module ScssTestHelper
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # -*- coding: utf-8 -*-
3
- require 'test_helper'
3
+ require File.dirname(__FILE__) + '/../../test_helper'
4
4
 
5
5
  unless Sass::Util.ruby1_8?
6
6
  class MultibyteStringScannerTest < Test::Unit::TestCase
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
2
+ require File.dirname(__FILE__) + '/../../test_helper'
3
3
 
4
4
  class SubsetMapTest < Test::Unit::TestCase
5
5
  def setup
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
- require 'test_helper'
2
+ require File.dirname(__FILE__) + '/../test_helper'
3
3
  require 'pathname'
4
4
 
5
5
  class UtilTest < Test::Unit::TestCase
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: 592302837
4
+ hash: 592302835
5
5
  prerelease: 6
6
6
  segments:
7
7
  - 3
8
8
  - 2
9
9
  - 0
10
10
  - alpha
11
- - 244
12
- version: 3.2.0.alpha.244
11
+ - 247
12
+ version: 3.2.0.alpha.247
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-05-31 00:00:00 -04:00
22
+ date: 2012-06-15 00:00:00 -04:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -154,6 +154,7 @@ files:
154
154
  - lib/sass/tree/content_node.rb
155
155
  - lib/sass/tree/css_import_node.rb
156
156
  - lib/sass/tree/variable_node.rb
157
+ - lib/sass/tree/warn_node.rb
157
158
  - lib/sass/tree/visitors/base.rb
158
159
  - lib/sass/tree/visitors/check_nesting.rb
159
160
  - lib/sass/tree/visitors/convert.rb
@@ -163,7 +164,6 @@ files:
163
164
  - lib/sass/tree/visitors/perform.rb
164
165
  - lib/sass/tree/visitors/set_options.rb
165
166
  - lib/sass/tree/visitors/to_css.rb
166
- - lib/sass/tree/warn_node.rb
167
167
  - lib/sass/tree/while_node.rb
168
168
  - lib/sass/tree/supports_node.rb
169
169
  - lib/sass/tree/trace_node.rb