sass 3.2.0.alpha.35 → 3.2.0.alpha.49
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/README.md +1 -1
- data/REVISION +1 -1
- data/VERSION +1 -1
- data/lib/sass.rb +22 -0
- data/lib/sass/engine.rb +2 -2
- data/lib/sass/environment.rb +0 -1
- data/lib/sass/exec.rb +1 -1
- data/lib/sass/importers/filesystem.rb +1 -1
- data/lib/sass/plugin.rb +4 -8
- data/lib/sass/plugin/compiler.rb +42 -17
- data/lib/sass/plugin/configuration.rb +0 -2
- data/lib/sass/repl.rb +0 -1
- data/lib/sass/script/funcall.rb +6 -1
- data/lib/sass/script/functions.rb +2 -2
- data/lib/sass/script/number.rb +1 -1
- data/lib/sass/script/parser.rb +12 -5
- data/lib/sass/script/variable.rb +0 -1
- data/lib/sass/scss/css_parser.rb +1 -0
- data/lib/sass/scss/parser.rb +37 -12
- data/lib/sass/scss/rx.rb +8 -3
- data/lib/sass/selector.rb +21 -0
- data/lib/sass/selector/abstract_sequence.rb +7 -0
- data/lib/sass/tree/media_node.rb +4 -4
- data/lib/sass/tree/rule_node.rb +5 -0
- data/lib/sass/tree/visitors/check_nesting.rb +10 -10
- data/lib/sass/tree/visitors/convert.rb +3 -3
- data/lib/sass/tree/visitors/cssize.rb +5 -1
- data/lib/sass/tree/visitors/perform.rb +16 -2
- data/lib/sass/tree/visitors/to_css.rb +2 -1
- data/lib/sass/util.rb +4 -1
- data/test/sass/conversion_test.rb +32 -2
- data/test/sass/engine_test.rb +105 -1
- data/test/sass/extend_test.rb +65 -0
- data/test/sass/importer_test.rb +7 -0
- data/test/sass/plugin_test.rb +16 -13
- data/test/sass/script_conversion_test.rb +2 -0
- data/test/sass/script_test.rb +18 -0
- data/test/sass/scss/scss_test.rb +34 -0
- data/test/sass/test_helper.rb +1 -1
- data/test/test_helper.rb +1 -0
- metadata +3 -3
    
        data/test/sass/extend_test.rb
    CHANGED
    
    | @@ -1339,6 +1339,71 @@ CSS | |
| 1339 1339 | 
             
            SCSS
         | 
| 1340 1340 | 
             
              end
         | 
| 1341 1341 |  | 
| 1342 | 
            +
              def test_basic_placeholder_selector
         | 
| 1343 | 
            +
                assert_equal <<CSS, render(<<SCSS)
         | 
| 1344 | 
            +
            .bar {
         | 
| 1345 | 
            +
              color: blue; }
         | 
| 1346 | 
            +
            CSS
         | 
| 1347 | 
            +
            %foo {color: blue}
         | 
| 1348 | 
            +
            .bar {@extend %foo}
         | 
| 1349 | 
            +
            SCSS
         | 
| 1350 | 
            +
              end
         | 
| 1351 | 
            +
             | 
| 1352 | 
            +
              def test_unused_placeholder_selector
         | 
| 1353 | 
            +
                assert_equal <<CSS, render(<<SCSS)
         | 
| 1354 | 
            +
            .baz {
         | 
| 1355 | 
            +
              color: blue; }
         | 
| 1356 | 
            +
            CSS
         | 
| 1357 | 
            +
            %foo {color: blue}
         | 
| 1358 | 
            +
            %bar {color: red}
         | 
| 1359 | 
            +
            .baz {@extend %foo}
         | 
| 1360 | 
            +
            SCSS
         | 
| 1361 | 
            +
              end
         | 
| 1362 | 
            +
             | 
| 1363 | 
            +
              def test_placeholder_descendant_selector
         | 
| 1364 | 
            +
                assert_equal <<CSS, render(<<SCSS)
         | 
| 1365 | 
            +
            #context .bar a {
         | 
| 1366 | 
            +
              color: blue; }
         | 
| 1367 | 
            +
            CSS
         | 
| 1368 | 
            +
            #context %foo a {color: blue}
         | 
| 1369 | 
            +
            .bar {@extend %foo}
         | 
| 1370 | 
            +
            SCSS
         | 
| 1371 | 
            +
              end
         | 
| 1372 | 
            +
             | 
| 1373 | 
            +
              def test_placeholder_selector_with_multiple_extenders
         | 
| 1374 | 
            +
                assert_equal <<CSS, render(<<SCSS)
         | 
| 1375 | 
            +
            .bar, .baz {
         | 
| 1376 | 
            +
              color: blue; }
         | 
| 1377 | 
            +
            CSS
         | 
| 1378 | 
            +
            %foo {color: blue}
         | 
| 1379 | 
            +
            .bar {@extend %foo}
         | 
| 1380 | 
            +
            .baz {@extend %foo}
         | 
| 1381 | 
            +
            SCSS
         | 
| 1382 | 
            +
              end
         | 
| 1383 | 
            +
             | 
| 1384 | 
            +
              def test_placeholder_selector_as_modifier
         | 
| 1385 | 
            +
                assert_equal <<CSS, render(<<SCSS)
         | 
| 1386 | 
            +
            a.baz.bar {
         | 
| 1387 | 
            +
              color: blue; }
         | 
| 1388 | 
            +
            CSS
         | 
| 1389 | 
            +
            a%foo.baz {color: blue}
         | 
| 1390 | 
            +
            .bar {@extend %foo}
         | 
| 1391 | 
            +
            div {@extend %foo}
         | 
| 1392 | 
            +
            SCSS
         | 
| 1393 | 
            +
              end
         | 
| 1394 | 
            +
             | 
| 1395 | 
            +
              def test_placeholder_interpolation
         | 
| 1396 | 
            +
                assert_equal <<CSS, render(<<SCSS)
         | 
| 1397 | 
            +
            .bar {
         | 
| 1398 | 
            +
              color: blue; }
         | 
| 1399 | 
            +
            CSS
         | 
| 1400 | 
            +
            $foo: foo;
         | 
| 1401 | 
            +
             | 
| 1402 | 
            +
            %\#{$foo} {color: blue}
         | 
| 1403 | 
            +
            .bar {@extend %foo}
         | 
| 1404 | 
            +
            SCSS
         | 
| 1405 | 
            +
              end
         | 
| 1406 | 
            +
             | 
| 1342 1407 | 
             
              private
         | 
| 1343 1408 |  | 
| 1344 1409 | 
             
              def render(sass, options = {})
         | 
    
        data/test/sass/importer_test.rb
    CHANGED
    
    | @@ -176,10 +176,17 @@ CSS | |
| 176 176 | 
             
                  file_system_importer
         | 
| 177 177 | 
             
                )
         | 
| 178 178 | 
             
              end
         | 
| 179 | 
            +
             | 
| 179 180 | 
             
              def fixture_dir
         | 
| 180 181 | 
             
                File.join(File.dirname(__FILE__), "fixtures")
         | 
| 181 182 | 
             
              end
         | 
| 183 | 
            +
             | 
| 182 184 | 
             
              def fixture_file(path)
         | 
| 183 185 | 
             
                File.join(fixture_dir, path)
         | 
| 184 186 | 
             
              end
         | 
| 187 | 
            +
             | 
| 188 | 
            +
              def test_absolute_files_across_template_locations
         | 
| 189 | 
            +
                importer = Sass::Importers::Filesystem.new(absolutize 'templates')
         | 
| 190 | 
            +
                assert_not_nil importer.mtime(absolutize('more_templates/more1.sass'), {})
         | 
| 191 | 
            +
              end
         | 
| 185 192 | 
             
            end
         | 
    
        data/test/sass/plugin_test.rb
    CHANGED
    
    | @@ -183,6 +183,7 @@ CSS | |
| 183 183 |  | 
| 184 184 | 
             
              def test_updating_stylesheets_callback
         | 
| 185 185 | 
             
                # Should run even when there's nothing to update
         | 
| 186 | 
            +
                Sass::Plugin.options[:template_location] = nil
         | 
| 186 187 | 
             
                assert_callback :updating_stylesheets, []
         | 
| 187 188 | 
             
              end
         | 
| 188 189 |  | 
| @@ -196,25 +197,25 @@ CSS | |
| 196 197 | 
             
                assert_no_callback :updating_stylesheets
         | 
| 197 198 | 
             
              end
         | 
| 198 199 |  | 
| 199 | 
            -
              def  | 
| 200 | 
            +
              def test_updated_stylesheet_callback_for_updated_template
         | 
| 200 201 | 
             
                Sass::Plugin.options[:always_update] = false
         | 
| 201 202 | 
             
                touch 'basic'
         | 
| 202 | 
            -
                assert_no_callback : | 
| 203 | 
            +
                assert_no_callback :updated_stylesheet, template_loc("complex"), tempfile_loc("complex") do
         | 
| 203 204 | 
             
                  assert_callbacks(
         | 
| 204 | 
            -
                    [: | 
| 205 | 
            -
                    [: | 
| 205 | 
            +
                    [:updated_stylesheet, template_loc("basic"), tempfile_loc("basic")],
         | 
| 206 | 
            +
                    [:updated_stylesheet, template_loc("import"), tempfile_loc("import")])
         | 
| 206 207 | 
             
                end
         | 
| 207 208 | 
             
              end
         | 
| 208 209 |  | 
| 209 | 
            -
              def  | 
| 210 | 
            +
              def test_updated_stylesheet_callback_for_fresh_template
         | 
| 210 211 | 
             
                Sass::Plugin.options[:always_update] = false
         | 
| 211 | 
            -
                assert_no_callback : | 
| 212 | 
            +
                assert_no_callback :updated_stylesheet
         | 
| 212 213 | 
             
              end
         | 
| 213 214 |  | 
| 214 | 
            -
              def  | 
| 215 | 
            +
              def test_updated_stylesheet_callback_for_error_template
         | 
| 215 216 | 
             
                Sass::Plugin.options[:always_update] = false
         | 
| 216 217 | 
             
                touch 'bork1'
         | 
| 217 | 
            -
                assert_no_callback : | 
| 218 | 
            +
                assert_no_callback :updated_stylesheet
         | 
| 218 219 | 
             
              end
         | 
| 219 220 |  | 
| 220 221 | 
             
              def test_not_updating_stylesheet_callback_for_fresh_template
         | 
| @@ -226,8 +227,8 @@ CSS | |
| 226 227 | 
             
                Sass::Plugin.options[:always_update] = false
         | 
| 227 228 | 
             
                assert_callback :not_updating_stylesheet, template_loc("complex"), tempfile_loc("complex") do
         | 
| 228 229 | 
             
                  assert_no_callbacks(
         | 
| 229 | 
            -
                    [: | 
| 230 | 
            -
                    [: | 
| 230 | 
            +
                    [:updated_stylesheet, template_loc("basic"), tempfile_loc("basic")],
         | 
| 231 | 
            +
                    [:updated_stylesheet, template_loc("import"), tempfile_loc("import")])
         | 
| 231 232 | 
             
                end
         | 
| 232 233 | 
             
              end
         | 
| 233 234 |  | 
| @@ -347,9 +348,11 @@ CSS | |
| 347 348 |  | 
| 348 349 | 
             
              def assert_callback(name, *expected_args)
         | 
| 349 350 | 
             
                run = false
         | 
| 351 | 
            +
                received_args = nil
         | 
| 350 352 | 
             
                Sass::Plugin.send("on_#{name}") do |*args|
         | 
| 351 | 
            -
                   | 
| 352 | 
            -
             | 
| 353 | 
            +
                  received_args = args
         | 
| 354 | 
            +
                  run ||= expected_args.zip(received_args).all? do |ea, ra|
         | 
| 355 | 
            +
                    ea.respond_to?(:call) ? ea.call(ra) : ea == ra
         | 
| 353 356 | 
             
                  end
         | 
| 354 357 | 
             
                end
         | 
| 355 358 |  | 
| @@ -359,7 +362,7 @@ CSS | |
| 359 362 | 
             
                  check_for_updates!
         | 
| 360 363 | 
             
                end
         | 
| 361 364 |  | 
| 362 | 
            -
                assert run, "Expected #{name} callback to be run with arguments:\n  #{expected_args.inspect}"
         | 
| 365 | 
            +
                assert run, "Expected #{name} callback to be run with arguments:\n  #{expected_args.inspect}\nHowever, it got:\n  #{received_args.inspect}"
         | 
| 363 366 | 
             
              end
         | 
| 364 367 |  | 
| 365 368 | 
             
              def assert_no_callback(name, *unexpected_args)
         | 
| @@ -223,6 +223,8 @@ RUBY | |
| 223 223 | 
             
                assert_renders '#{1 + 2}, #{3 + 4}'
         | 
| 224 224 | 
             
                assert_renders '#{1 + 2} ,#{3 + 4}'
         | 
| 225 225 | 
             
                assert_renders '#{1 + 2},#{3 + 4}'
         | 
| 226 | 
            +
                assert_renders '#{1 + 2}, #{3 + 4}, #{5 + 6}'
         | 
| 227 | 
            +
                assert_renders '3, #{3 + 4}, 11'
         | 
| 226 228 |  | 
| 227 229 | 
             
                assert_renders '3 / #{3 + 4}'
         | 
| 228 230 | 
             
                assert_renders '3 /#{3 + 4}'
         | 
    
        data/test/sass/script_test.rb
    CHANGED
    
    | @@ -7,6 +7,14 @@ module Sass::Script::Functions::UserFunctions | |
| 7 7 | 
             
                val.options[:foo]
         | 
| 8 8 | 
             
                Sass::Script::String.new("Options defined!")
         | 
| 9 9 | 
             
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def arg_error
         | 
| 12 | 
            +
                assert_options
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
            end
         | 
| 15 | 
            +
             | 
| 16 | 
            +
            module Sass::Script::Functions
         | 
| 17 | 
            +
              include Sass::Script::Functions::UserFunctions
         | 
| 10 18 | 
             
            end
         | 
| 11 19 |  | 
| 12 20 | 
             
            class SassScriptTest < Test::Unit::TestCase
         | 
| @@ -130,6 +138,8 @@ class SassScriptTest < Test::Unit::TestCase | |
| 130 138 | 
             
                assert_equal '3, 7', resolve('#{1 + 2}, #{3 + 4}')
         | 
| 131 139 | 
             
                assert_equal '3 ,7', resolve('#{1 + 2} ,#{3 + 4}')
         | 
| 132 140 | 
             
                assert_equal '3,7', resolve('#{1 + 2},#{3 + 4}')
         | 
| 141 | 
            +
                assert_equal '3, 7, 11', resolve('#{1 + 2}, #{3 + 4}, #{5 + 6}')
         | 
| 142 | 
            +
                assert_equal '3, 7, 11', resolve('3, #{3 + 4}, 11')
         | 
| 133 143 |  | 
| 134 144 | 
             
                assert_equal '3 / 7', resolve('3 / #{3 + 4}')
         | 
| 135 145 | 
             
                assert_equal '3 /7', resolve('3 /#{3 + 4}')
         | 
| @@ -414,6 +424,14 @@ SASS | |
| 414 424 | 
             
                assert_raise_message(Sass::SyntaxError, "() isn't a valid CSS value.") {resolve("nth(append((), ()), 1)")}
         | 
| 415 425 | 
             
              end
         | 
| 416 426 |  | 
| 427 | 
            +
              def test_deep_argument_error_not_unwrapped
         | 
| 428 | 
            +
                assert_raise_message(ArgumentError, 'wrong number of arguments (0 for 1)') {resolve("arg-error()")}
         | 
| 429 | 
            +
              end
         | 
| 430 | 
            +
             | 
| 431 | 
            +
              def test_shallow_argument_error_unwrapped
         | 
| 432 | 
            +
                assert_raise_message(Sass::SyntaxError, "wrong number of arguments (1 for 0) for `arg-error'") {resolve("arg-error(1)")}
         | 
| 433 | 
            +
              end
         | 
| 434 | 
            +
             | 
| 417 435 | 
             
              # Regression Tests
         | 
| 418 436 |  | 
| 419 437 | 
             
              def test_funcall_has_higher_precedence_than_color_name
         | 
    
        data/test/sass/scss/scss_test.rb
    CHANGED
    
    | @@ -1094,6 +1094,15 @@ SCSS | |
| 1094 1094 |  | 
| 1095 1095 | 
             
              # Regression
         | 
| 1096 1096 |  | 
| 1097 | 
            +
              def test_prop_name_interpolation_after_hyphen
         | 
| 1098 | 
            +
                assert_equal <<CSS, render(<<SCSS)
         | 
| 1099 | 
            +
            a {
         | 
| 1100 | 
            +
              -foo-bar: b; }
         | 
| 1101 | 
            +
            CSS
         | 
| 1102 | 
            +
            a { -\#{"foo"}-bar: b; }
         | 
| 1103 | 
            +
            SCSS
         | 
| 1104 | 
            +
              end
         | 
| 1105 | 
            +
             | 
| 1097 1106 | 
             
              def test_star_plus_and_parent
         | 
| 1098 1107 | 
             
                assert_equal <<CSS, render(<<SCSS)
         | 
| 1099 1108 | 
             
            * + html foo {
         | 
| @@ -1296,4 +1305,29 @@ CSS | |
| 1296 1305 | 
             
            foo {color: darken(black, 10%)}
         | 
| 1297 1306 | 
             
            SCSS
         | 
| 1298 1307 | 
             
              end
         | 
| 1308 | 
            +
             | 
| 1309 | 
            +
              # ref: https://github.com/nex3/sass/issues/104
         | 
| 1310 | 
            +
              def test_no_buffer_overflow
         | 
| 1311 | 
            +
                template = render <<SCSS
         | 
| 1312 | 
            +
            .aaa {
         | 
| 1313 | 
            +
              background-color: white;
         | 
| 1314 | 
            +
            }
         | 
| 1315 | 
            +
            .aaa .aaa .aaa {
         | 
| 1316 | 
            +
              background-color: black;
         | 
| 1317 | 
            +
            }   
         | 
| 1318 | 
            +
            .bbb {
         | 
| 1319 | 
            +
              @extend .aaa;
         | 
| 1320 | 
            +
            } 
         | 
| 1321 | 
            +
            .xxx {
         | 
| 1322 | 
            +
              @extend .bbb;
         | 
| 1323 | 
            +
            }
         | 
| 1324 | 
            +
            .yyy {
         | 
| 1325 | 
            +
              @extend .bbb;
         | 
| 1326 | 
            +
            }
         | 
| 1327 | 
            +
            .zzz {
         | 
| 1328 | 
            +
              @extend .bbb;
         | 
| 1329 | 
            +
            }
         | 
| 1330 | 
            +
            SCSS
         | 
| 1331 | 
            +
                Sass::SCSS::Parser.new(template, "test.scss").parse
         | 
| 1332 | 
            +
              end
         | 
| 1299 1333 | 
             
            end
         | 
    
        data/test/sass/test_helper.rb
    CHANGED
    
    
    
        data/test/test_helper.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: sass
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 3.2.0.alpha. | 
| 4 | 
            +
              version: 3.2.0.alpha.49
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - Nathan Weizenbaum
         | 
| @@ -11,7 +11,7 @@ autorequire: | |
| 11 11 | 
             
            bindir: bin
         | 
| 12 12 | 
             
            cert_chain: []
         | 
| 13 13 |  | 
| 14 | 
            -
            date:  | 
| 14 | 
            +
            date: 2012-01-04 00:00:00 -05:00
         | 
| 15 15 | 
             
            default_executable: 
         | 
| 16 16 | 
             
            dependencies: 
         | 
| 17 17 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -130,6 +130,7 @@ files: | |
| 130 130 | 
             
            - lib/sass/tree/root_node.rb
         | 
| 131 131 | 
             
            - lib/sass/tree/rule_node.rb
         | 
| 132 132 | 
             
            - lib/sass/tree/content_node.rb
         | 
| 133 | 
            +
            - lib/sass/tree/trace_node.rb
         | 
| 133 134 | 
             
            - lib/sass/tree/variable_node.rb
         | 
| 134 135 | 
             
            - lib/sass/tree/visitors/base.rb
         | 
| 135 136 | 
             
            - lib/sass/tree/visitors/check_nesting.rb
         | 
| @@ -141,7 +142,6 @@ files: | |
| 141 142 | 
             
            - lib/sass/tree/visitors/to_css.rb
         | 
| 142 143 | 
             
            - lib/sass/tree/warn_node.rb
         | 
| 143 144 | 
             
            - lib/sass/tree/while_node.rb
         | 
| 144 | 
            -
            - lib/sass/tree/trace_node.rb
         | 
| 145 145 | 
             
            - lib/sass/util.rb
         | 
| 146 146 | 
             
            - lib/sass/util/subset_map.rb
         | 
| 147 147 | 
             
            - lib/sass/version.rb
         |